diff --git a/rule/public_platoon_relate_commission.go b/rule/public_platoon_relate_commission.go index dc2ed8a..5cd773f 100644 --- a/rule/public_platoon_relate_commission.go +++ b/rule/public_platoon_relate_commission.go @@ -45,6 +45,9 @@ func AddPublicPlatoonRelateCommission(engine *xorm.Engine, AddPublicPlatoonRelat } if userPublicPlatoonRelation != nil { 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) if err != nil { return nil, err diff --git a/rule/small_public_platoon_relate_commission.go b/rule/small_public_platoon_relate_commission.go index 739671c..c847885 100644 --- a/rule/small_public_platoon_relate_commission.go +++ b/rule/small_public_platoon_relate_commission.go @@ -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) // 3、插入 user_public_platoon_relation 记录 + if userPublicPlatoonSetting.SettleDay == 0 { + userPublicPlatoonSetting.SettleDay = 30 + } now := time.Now() userPublicPlatoonRelation.Uid = uid userPublicPlatoonRelation.FatherUid = fatherUid @@ -324,7 +327,7 @@ func naturalSmallPublicPlatoon(engine *xorm.Engine, uid int, originalPosition *i 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 @@ -416,9 +419,23 @@ func smallFindWaitForDealUsers(engine *xorm.Engine, page, pageSize int) (err err // SmallUpdateWaitForSettlementDate 改变 `wait_for_settlement_date` 待结算时间 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天后 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) if err != nil { return