|
|
@@ -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 |
|
|
|