From 51a217be756f07db7b70b9e3438c10f1f5331625 Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Wed, 7 Feb 2024 18:41:19 +0800 Subject: [PATCH 1/2] update --- .../one_circles_public_platoon_user_relation_commission.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rule/one_circles/one_circles_public_platoon_user_relation_commission.go b/rule/one_circles/one_circles_public_platoon_user_relation_commission.go index d84f586..856a74b 100644 --- a/rule/one_circles/one_circles_public_platoon_user_relation_commission.go +++ b/rule/one_circles/one_circles_public_platoon_user_relation_commission.go @@ -812,7 +812,7 @@ const OneCirclesDealUserPublicPlatoonPunishLockKey = "one_circles_deal_user_publ func OneCirclesDealUserPublicPlatoonPunish(engine *xorm.Engine, masterId string) (err error) { now := time.Now() fmt.Println(now.Hour()) - if !(now.Hour() > 3 && now.Hour() < 8) { + if !(now.Hour() > 22 && now.Hour() < 24) { //TODO::只在凌晨一点 ~ 凌晨 8 点运行 return errors.New("非运行时间") } From 0ddfce2376a5d46ada77e91ad6cc28f0ba6d59a0 Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Thu, 8 Feb 2024 11:07:01 +0800 Subject: [PATCH 2/2] update --- ...latoon_double_network_relate_commission.go | 36 ++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/rule/public_platoon_double_network_relate_commission.go b/rule/public_platoon_double_network_relate_commission.go index 460d285..506c93d 100644 --- a/rule/public_platoon_double_network_relate_commission.go +++ b/rule/public_platoon_double_network_relate_commission.go @@ -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, ×)