Browse Source

add for reverse:v1.5.7 公排加入调整

tags/v1.5.7
huangjiajun 2 years ago
parent
commit
cfc7e37c11
2 changed files with 18 additions and 3 deletions
  1. +1
    -0
      db/model/user_public_platoon_setting.go
  2. +17
    -3
      rule/public_platoon_relate_commission.go

+ 1
- 0
db/model/user_public_platoon_setting.go View File

@@ -16,4 +16,5 @@ type UserPublicPlatoonSetting struct {
SystemPunishTask string `json:"system_punish_task" xorm:"comment('处罚任务条件') TEXT"`
RewardTask string `json:"reward_task" xorm:"comment('奖励任务条件') TEXT"`
SystemPunishReplace int `json:"system_punish_replace" xorm:"default 0 comment('是否位置滑落 被新用户替换 0否 1是') INT(1)"`
SettleDay int `json:"settle_day" xorm:"not null default 30 comment('结算天数') INT(11)"`
}

+ 17
- 3
rule/public_platoon_relate_commission.go View File

@@ -135,7 +135,9 @@ func publicPlatoon(engine *xorm.Engine, uid, recommendUid int, userPublicPlatoon

//唯一标识符(父级id-uid-等级-位置)
var uniqueIdentifier = zhios_order_relate_utils.IntToStr(pid) + "-" + zhios_order_relate_utils.IntToStr(uid) + "-" + zhios_order_relate_utils.IntToStr(int(level)) + "-" + zhios_order_relate_utils.IntToStr(position)

if userPublicPlatoonSetting.SettleDay == 0 {
userPublicPlatoonSetting.SettleDay = 30
}
// 3、插入 user_public_platoon_relation 记录
now := time.Now()
userPublicPlatoonRelation.Uid = uid
@@ -145,7 +147,7 @@ func publicPlatoon(engine *xorm.Engine, uid, recommendUid int, userPublicPlatoon
userPublicPlatoonRelation.Level = int(level)
userPublicPlatoonRelation.Position = position
userPublicPlatoonRelation.UniqueIdentifier = uniqueIdentifier
userPublicPlatoonRelation.WaitForSettlementDate = now.AddDate(0, 0, 30).Format("2006-01-02")
userPublicPlatoonRelation.WaitForSettlementDate = now.AddDate(0, 0, userPublicPlatoonSetting.SettleDay).Format("2006-01-02")
userPublicPlatoonRelation.JoinAt = now
userPublicPlatoonRelation.CreateAt = now
userPublicPlatoonRelation.UpdateAt = now
@@ -227,9 +229,21 @@ func FindWaitForDealUsers(engine *xorm.Engine, page, pageSize int) (err error, r

// UpdateWaitForSettlementDate 改变 `wait_for_settlement_date` 待结算时间
func UpdateWaitForSettlementDate(engine *xorm.Engine, userIds []string) (err error) {
//查找 `user_public_platoon_setting` 基础设置
userPublicPlatoonSetting, err := db.UserPublicPlatoonSettingGetOneByParams(engine, map[string]interface{}{
"key": "is_open",
"value": 1,
})
if err != nil {
return err
}
settleDay := 30
if userPublicPlatoonSetting != nil && userPublicPlatoonSetting.SettleDay == 0 {
settleDay = 30
}
//Todo:: 将 user_public_platoon_relation 中 wait_for_settlement_date 设置为 30天后
sql := "update user_public_platoon_amount set wait_for_settlement_date = ? where uid in (" + strings.Join(userIds, ",") + ")"
waitForSettlementDate := time.Now().AddDate(0, 0, 30).Format("2006-01-02")
waitForSettlementDate := time.Now().AddDate(0, 0, settleDay).Format("2006-01-02")
_, err = engine.Exec(sql, waitForSettlementDate)
if err != nil {
return


Loading…
Cancel
Save