Browse Source

update

master
DengBiao 10 months ago
parent
commit
0ddfce2376
1 changed files with 35 additions and 1 deletions
  1. +35
    -1
      rule/public_platoon_double_network_relate_commission.go

+ 35
- 1
rule/public_platoon_double_network_relate_commission.go View File

@@ -4,6 +4,7 @@ import (
"code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git/db"
"code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git/db/model"
"code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git/md"
"code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git/svc"
zhios_order_relate_utils "code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git/utils"
zhios_order_relate_logx "code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git/utils/logx"
"errors"
@@ -24,7 +25,7 @@ rank 用户总排名
previousRow 上一层级
diffValue 距离上一层级差值
*/
func EstimateUserPosition(engine *xorm.Engine, uid int) (total, level, levelRank, rank, previousRow int, diffValue string, err error) {
func EstimateUserPosition(engine *xorm.Engine, uid int, dbName string) (total, level, levelRank, rank, previousRow int, diffValue string, err error) {
//1、查找 `user_public_platoon_setting` 基础设置
userPublicPlatoonSetting, err := db.UserPublicPlatoonSettingGetOneByParams(engine, map[string]interface{}{
"key": "is_open",
@@ -41,6 +42,39 @@ func EstimateUserPosition(engine *xorm.Engine, uid int) (total, level, levelRank
if err != nil {
return
}
if rank == 0 {
userPublicPlatoonDoubleNetworkSetting, err1 := db.UserPublicPlatoonDoubleNetworkSettingGetOneByParams(engine, map[string]interface{}{
"key": "is_open",
"value": 1,
})
if err1 != nil {
err = err1
return
}
coinAmount, err2 := svc.GetUserCoinAmount(engine.NewSession(), dbName, userPublicPlatoonDoubleNetworkSetting.CoinId, uid)
if err2 != nil {
err = err2
return
}
userProfile, err3 := db.UserProfileFindByID(engine, uid)
if err3 != nil {
err = err3
return
}
_, err4 := db.UserPublicPlatoonDoubleNetworkUserCoinRecordInsert(engine, &model.UserPublicPlatoonDoubleNetworkUserCoinRecord{
Uid: uid,
LastAmount: coinAmount,
Amount: coinAmount,
RecommendUid: userProfile.ParentUid,
CoinId: userPublicPlatoonDoubleNetworkSetting.CoinId,
CreateAt: time.Now().Format("2006-01-02 15:04:05"),
UpdateAt: time.Now().Format("2006-01-02 15:04:05"),
})
if err4 != nil {
err = err4
return
}
}
rows := float64(userPublicPlatoonSetting.SeveralRows)
times := float64(userPublicPlatoonSetting.SeveralTimes)
level = makeSearchLevelByPosition(&rank, rows, &times)


Loading…
Cancel
Save