Browse Source

update 共富制度

tags/v1.6.4
DengBiao 2 years ago
parent
commit
99bdffa1a3
2 changed files with 22 additions and 2 deletions
  1. +3
    -0
      rule/public_platoon_relate_commission.go
  2. +19
    -2
      rule/small_public_platoon_relate_commission.go

+ 3
- 0
rule/public_platoon_relate_commission.go View File

@@ -45,6 +45,9 @@ func AddPublicPlatoonRelateCommission(engine *xorm.Engine, AddPublicPlatoonRelat
} }
if userPublicPlatoonRelation != nil { if userPublicPlatoonRelation != nil {
userPublicPlatoonRelation.Uid = zhios_order_relate_utils.StrToInt(param.Uid) userPublicPlatoonRelation.Uid = zhios_order_relate_utils.StrToInt(param.Uid)
uniqueIdentifier := strings.Split(userPublicPlatoonRelation.UniqueIdentifier, "-")
uniqueIdentifier[1] = param.Uid
userPublicPlatoonRelation.UniqueIdentifier = strings.Join(uniqueIdentifier, "-")
updateAffected, err := db.UserPublicPlatoonRelationUpdate(engine.NewSession(), userPublicPlatoonRelation.Id, userPublicPlatoonRelation) updateAffected, err := db.UserPublicPlatoonRelationUpdate(engine.NewSession(), userPublicPlatoonRelation.Id, userPublicPlatoonRelation)
if err != nil { if err != nil {
return nil, err return nil, err


+ 19
- 2
rule/small_public_platoon_relate_commission.go View File

@@ -316,6 +316,9 @@ func naturalSmallPublicPlatoon(engine *xorm.Engine, uid int, originalPosition *i
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) 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)


// 3、插入 user_public_platoon_relation 记录 // 3、插入 user_public_platoon_relation 记录
if userPublicPlatoonSetting.SettleDay == 0 {
userPublicPlatoonSetting.SettleDay = 30
}
now := time.Now() now := time.Now()
userPublicPlatoonRelation.Uid = uid userPublicPlatoonRelation.Uid = uid
userPublicPlatoonRelation.FatherUid = fatherUid userPublicPlatoonRelation.FatherUid = fatherUid
@@ -324,7 +327,7 @@ func naturalSmallPublicPlatoon(engine *xorm.Engine, uid int, originalPosition *i
userPublicPlatoonRelation.Level = int(level) userPublicPlatoonRelation.Level = int(level)
userPublicPlatoonRelation.Position = position userPublicPlatoonRelation.Position = position
userPublicPlatoonRelation.UniqueIdentifier = uniqueIdentifier 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.JoinAt = now
userPublicPlatoonRelation.CreateAt = now userPublicPlatoonRelation.CreateAt = now
userPublicPlatoonRelation.UpdateAt = now userPublicPlatoonRelation.UpdateAt = now
@@ -416,9 +419,23 @@ func smallFindWaitForDealUsers(engine *xorm.Engine, page, pageSize int) (err err


// SmallUpdateWaitForSettlementDate 改变 `wait_for_settlement_date` 待结算时间 // SmallUpdateWaitForSettlementDate 改变 `wait_for_settlement_date` 待结算时间
func SmallUpdateWaitForSettlementDate(engine *xorm.Engine, userIds []string) (err error) { func SmallUpdateWaitForSettlementDate(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
} else {
settleDay = userPublicPlatoonSetting.SettleDay
}
//Todo:: 将 user_public_platoon_relation 中 wait_for_settlement_date 设置为 30天后 //Todo:: 将 user_public_platoon_relation 中 wait_for_settlement_date 设置为 30天后
sql := "update user_small_public_platoon_relation set wait_for_settlement_date = ? where uid in (" + strings.Join(userIds, ",") + ")" sql := "update user_small_public_platoon_relation 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) _, err = engine.Exec(sql, waitForSettlementDate)
if err != nil { if err != nil {
return return


Loading…
Cancel
Save