huangjiajun 3 mesi fa
parent
commit
0e5833120d
1 ha cambiato i file con 33 aggiunte e 5 eliminazioni
  1. +33
    -5
      rule/consume_integral_settlement.go

+ 33
- 5
rule/consume_integral_settlement.go Vedi File

@@ -126,18 +126,46 @@ func DailySettlementBlockConsumeIntegral(engine *xorm.Engine, mid string, isTask
uids := make([]int, 0)
storeUids := make([]int, 0)
for _, v := range subsidyWithUserForConsumeList {
uids = append(uids, v.Uid)
if zhios_order_relate_utils.InArrToInt(v.Uid, uids) == false {
uids = append(uids, v.Uid)
}
}
for _, v := range subsidyWithUserForExperienceList {
uids = append(uids, v.Uid)
if zhios_order_relate_utils.InArrToInt(v.Uid, uids) == false {
uids = append(uids, v.Uid)
}
}
for _, v := range subsidyWithUserForStoreList {
storeUids = append(storeUids, v.Uid)
if zhios_order_relate_utils.InArrToInt(v.Uid, storeUids) == false {
storeUids = append(storeUids, v.Uid)
}
}
userStatusList := userStatus(session, uids, 0, subsidyBase)
storeStatusList := userStatus(session, storeUids, 1, subsidyBase)

for _, v := range uids {
sql := `select stop_date from subsidy_with_user_flow order by create_at desc where uid=%d and kind in(1,2) limit 1`
sql = fmt.Sprintf(sql, v)
one, _ := db.QueryNativeStringSess(session, sql)
if userStatusList[v]["status"] != "1" {
userStatusList[v]["date"] = time.Now().Format("2006-01-02")
if len(one) > 0 && one[0]["stop_date"] != "" {
userStatusList[v]["date"] = one[0]["stop_date"]
}
}
}
for _, v := range storeUids {
sql := `select stop_date from subsidy_with_user_flow order by create_at desc where uid=%d and kind=3 limit 1`
sql = fmt.Sprintf(sql, v)
one, _ := db.QueryNativeStringSess(session, sql)
if storeStatusList[v]["status"] != "1" {
storeStatusList[v]["date"] = time.Now().Format("2006-01-02")
if len(one) > 0 && one[0]["stop_date"] != "" {
storeStatusList[v]["date"] = one[0]["stop_date"]
}
}
}
if hasConsumeTotal > 0 {

for _, v := range subsidyWithUserForConsumeList {
if v.LeaveDay > 0 && userStatusList[v.Uid]["status"] == "1" {
consumeTotalMap[v.Uid] = consumeTotalMap[v.Uid].Add(decimal.NewFromFloat(consumeValue))
@@ -149,7 +177,7 @@ func DailySettlementBlockConsumeIntegral(engine *xorm.Engine, mid string, isTask
if userStatusList[v.Uid]["status"] == "1" {
err1 = DealUserConsumeIntegral(session, &v, consumeValue, mid)
} else {
err1 = DealUserConsumeIntegralStop(session, &v, consumeValue, mid, storeStatusList[v.Uid]["date"])
err1 = DealUserConsumeIntegralStop(session, &v, consumeValue, mid, userStatusList[v.Uid]["date"])
}
if err1 != nil {
_ = session.Rollback()


Caricamento…
Annulla
Salva