Browse Source

update

master
DengBiao 10 months ago
parent
commit
ce67552d91
1 changed files with 4 additions and 6 deletions
  1. +4
    -6
      rule/one_circles/one_circles_star_level_dividends.go

+ 4
- 6
rule/one_circles/one_circles_star_level_dividends.go View File

@@ -28,9 +28,6 @@ func SettlementStarLevelDividends(engine *xorm.Engine, masterId string) (err err
} }
//TODO::增加“悲观锁”防止串行 //TODO::增加“悲观锁”防止串行
getString, _ := cache.GetString(SettlementStarLevelDividendsLockKey) getString, _ := cache.GetString(SettlementStarLevelDividendsLockKey)
//if err != nil {
// return err
//}
if getString != "" { if getString != "" {
fmt.Println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", "上一次结算未执行完") fmt.Println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", "上一次结算未执行完")
return errors.New("上一次结算未执行完") return errors.New("上一次结算未执行完")
@@ -130,6 +127,7 @@ func SettlementStarLevelDividends(engine *xorm.Engine, masterId string) (err err
fmt.Println("err:::::66666", err1) fmt.Println("err:::::66666", err1)
return err1 return err1
} }
vipLevelUserTotalMap[v.VipLevelId] = map[string]int64{}
vipLevelUserTotalMap[v.VipLevelId]["count"] = count vipLevelUserTotalMap[v.VipLevelId]["count"] = count
vipLevelUserTotalMap[v.VipLevelId]["weight"] = int64(userLevel.LevelWeight) vipLevelUserTotalMap[v.VipLevelId]["weight"] = int64(userLevel.LevelWeight)
} }
@@ -145,12 +143,12 @@ func SettlementStarLevelDividends(engine *xorm.Engine, masterId string) (err err
var totalDividendValue = decimal.Decimal{} var totalDividendValue = decimal.Decimal{}
for _, item := range users { for _, item := range users {
var siginDividendValue = decimal.Decimal{} var siginDividendValue = decimal.Decimal{}
for _, v := range vipLevelUserTotalMap {
if int(v["weight"]) < allUserLevelMap[item.Level].LevelWeight {
for k, v := range vipLevelUserTotalMap {
if int(v["weight"]) > allUserLevelMap[item.Level].LevelWeight {
continue continue
} }
if vipEquitySettingMap[zhios_order_relate_utils.IntToStr(item.Level)] != "" && vipLevelUserTotalMap[zhios_order_relate_utils.IntToStr(item.Level)]["count"] > 0 { if vipEquitySettingMap[zhios_order_relate_utils.IntToStr(item.Level)] != "" && vipLevelUserTotalMap[zhios_order_relate_utils.IntToStr(item.Level)]["count"] > 0 {
dividendValue, _ := decimal.NewFromString(vipEquitySettingMap[zhios_order_relate_utils.IntToStr(item.Level)])
dividendValue, _ := decimal.NewFromString(vipEquitySettingMap[k])
userTotal := decimal.NewFromInt(vipLevelUserTotalMap[zhios_order_relate_utils.IntToStr(item.Level)]["count"]) userTotal := decimal.NewFromInt(vipLevelUserTotalMap[zhios_order_relate_utils.IntToStr(item.Level)]["count"])
siginDividendValue = siginDividendValue.Add(dividendValue.Div(userTotal)) siginDividendValue = siginDividendValue.Add(dividendValue.Div(userTotal))
} }


Loading…
Cancel
Save