From ce67552d91acc2a92c92dcc9f4ece44f51495c50 Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Wed, 31 Jan 2024 23:14:25 +0800 Subject: [PATCH] update --- rule/one_circles/one_circles_star_level_dividends.go | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/rule/one_circles/one_circles_star_level_dividends.go b/rule/one_circles/one_circles_star_level_dividends.go index f81942d..b5e78b2 100644 --- a/rule/one_circles/one_circles_star_level_dividends.go +++ b/rule/one_circles/one_circles_star_level_dividends.go @@ -28,9 +28,6 @@ func SettlementStarLevelDividends(engine *xorm.Engine, masterId string) (err err } //TODO::增加“悲观锁”防止串行 getString, _ := cache.GetString(SettlementStarLevelDividendsLockKey) - //if err != nil { - // return err - //} if getString != "" { fmt.Println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", "上一次结算未执行完") return errors.New("上一次结算未执行完") @@ -130,6 +127,7 @@ func SettlementStarLevelDividends(engine *xorm.Engine, masterId string) (err err fmt.Println("err:::::66666", err1) return err1 } + vipLevelUserTotalMap[v.VipLevelId] = map[string]int64{} vipLevelUserTotalMap[v.VipLevelId]["count"] = count vipLevelUserTotalMap[v.VipLevelId]["weight"] = int64(userLevel.LevelWeight) } @@ -145,12 +143,12 @@ func SettlementStarLevelDividends(engine *xorm.Engine, masterId string) (err err var totalDividendValue = decimal.Decimal{} for _, item := range users { 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 } 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"]) siginDividendValue = siginDividendValue.Add(dividendValue.Div(userTotal)) }