Browse Source

Merge remote-tracking branch 'origin/master'

master
huangjiajun 10 months ago
parent
commit
9c1640de12
2 changed files with 36 additions and 2 deletions
  1. +1
    -1
      rule/one_circles/one_circles_public_platoon_user_relation_commission.go
  2. +35
    -1
      rule/public_platoon_double_network_relate_commission.go

+ 1
- 1
rule/one_circles/one_circles_public_platoon_user_relation_commission.go View File

@@ -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("非运行时间")
}


+ 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