huangjiajun 2 ay önce
ebeveyn
işleme
58c93f2a91
1 değiştirilmiş dosya ile 24 ekleme ve 29 silme
  1. +24
    -29
      rule/consume_integral_settlement.go

+ 24
- 29
rule/consume_integral_settlement.go Dosyayı Görüntüle

@@ -123,54 +123,49 @@ func DailySettlementBlockConsumeIntegral(engine *xorm.Engine, mid string, isTask
return err, totalMap, storeTotalMap
}
//读出用户冻结情况
uids := make([]string, 0)
storeUids := make([]string, 0)
uids := make([]int, 0)
storeUids := make([]int, 0)
for _, v := range subsidyWithUserForConsumeList {
if zhios_order_relate_utils.InArr(zhios_order_relate_utils.IntToStr(v.Uid), uids) == false {
uids = append(uids, zhios_order_relate_utils.IntToStr(v.Uid))
if zhios_order_relate_utils.InArrToInt(v.Uid, uids) == false {
uids = append(uids, v.Uid)
}
}
for _, v := range subsidyWithUserForExperienceList {
if zhios_order_relate_utils.InArr(zhios_order_relate_utils.IntToStr(v.Uid), uids) == false {
uids = append(uids, zhios_order_relate_utils.IntToStr(v.Uid))
if zhios_order_relate_utils.InArrToInt(v.Uid, uids) == false {
uids = append(uids, v.Uid)
}
}
for _, v := range subsidyWithUserForStoreList {
if zhios_order_relate_utils.InArr(zhios_order_relate_utils.IntToStr(v.Uid), storeUids) == false {
storeUids = append(storeUids, zhios_order_relate_utils.IntToStr(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)
sql := `select uid,stop_date from subsidy_with_user_flow where uid in(%s) and kind in(1,2) order by create_at desc limit 1`
sql = fmt.Sprintf(sql, strings.Join(uids, ","))
one, _ := db.QueryNativeStringSess(session, sql)
for _, v := range uids {
if userStatusList[zhios_order_relate_utils.StrToInt(v)]["status"] != "1" {
userStatusList[zhios_order_relate_utils.StrToInt(v)]["date"] = time.Now().Format("2006-01-02")
for _, v1 := range one {
if v1["uid"] == v {
userStatusList[zhios_order_relate_utils.StrToInt(v)]["date"] = v1["stop_date"]
}
sql := `select stop_date from subsidy_with_user_flow where uid=%d and kind in(1,2) order by create_at desc 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"]
}
}
}
storesql := `select uid,stop_date from subsidy_with_user_flow where uid in(%s) and kind=3 order by create_at desc limit 1`
storesql = fmt.Sprintf(storesql, strings.Join(uids, ","))
storeone, _ := db.QueryNativeStringSess(session, storesql)
for _, v := range storeUids {
if storeStatusList[zhios_order_relate_utils.StrToInt(v)]["status"] != "1" {
storeStatusList[zhios_order_relate_utils.StrToInt(v)]["date"] = time.Now().Format("2006-01-02")
for _, v1 := range storeone {
if v1["uid"] == v {
storeStatusList[zhios_order_relate_utils.StrToInt(v)]["date"] = v1["stop_date"]
}
sql := `select stop_date from subsidy_with_user_flow where uid=%d and kind=3 order by create_at desc 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))
@@ -815,7 +810,7 @@ func DealUserStoreAmountFlow(session *xorm.Session, uid int, experienceIntegralV
return nil

}
func userStatus(sess *xorm.Session, uid []string, types int, base *model.SubsidyBase) map[int]map[string]string {
func userStatus(sess *xorm.Session, uid []int, types int, base *model.SubsidyBase) map[int]map[string]string {
statusList := make(map[int]map[string]string)
if len(uid) == 0 {
return statusList


Yükleniyor…
İptal
Kaydet