diff --git a/db/db_virtual_coin.go b/db/db_virtual_coin.go index 13fcc13..51fb167 100644 --- a/db/db_virtual_coin.go +++ b/db/db_virtual_coin.go @@ -13,13 +13,13 @@ func VirtualCoinListInUse(Db *xorm.Engine, masterId string) ([]*model.VirtualCoi var m []*model.VirtualCoin cacheKey := fmt.Sprintf(md.VirtualCoinCfgCacheKey, masterId) - err := cache.GetJson(cacheKey, &m) + err := zhios_order_relate_cache.GetJson(cacheKey, &m) if err != nil || len(m) == 0 { err := Db.Where("is_use=1").Find(&m) if err != nil { return nil, err } - cache.SetJson(cacheKey, m, md.CfgCacheTime) + zhios_order_relate_cache.SetJson(cacheKey, m, md.CfgCacheTime) } return m, nil diff --git a/rule/relate_commission.go b/rule/relate_commission.go index 95d2fbf..8abf2b5 100644 --- a/rule/relate_commission.go +++ b/rule/relate_commission.go @@ -1,6 +1,7 @@ package rule import ( + "code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git/db" "code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git/lib/comm_plan" "code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git/md" "code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git/svc" @@ -24,7 +25,11 @@ func BatchGetCommission(eg *xorm.Engine, dbName string, commissionParamList []*m group, _ := errgroup.WithContext(context.Background()) var mu sync.Mutex - + virCfg := db.SysCfgFindWithDb(eg, dbName, "virtual_coin_rebate_type") + var virType = "price" + if virCfg["virtual_coin_rebate_type"] != "" { + virType = virCfg["virtual_coin_rebate_type"] + } for _, param := range commissionParamList { param := param // 为下面的闭包创建局部变量 group.Go(func() error { @@ -40,7 +45,7 @@ func BatchGetCommission(eg *xorm.Engine, dbName string, commissionParamList []*m return errors.New("商品ID缺失") } - _, _, _, _, lvUser, err := svc.GetRewardCommission(eg, ¶m.CommissionParam, isShare, param.Uid, param.Provider, dbName, isAllLevelReturn, map[string]string{}) + _, _, _, _, lvUser, err := svc.GetRewardCommission(eg, ¶m.CommissionParam, isShare, param.Uid, param.Provider, dbName, isAllLevelReturn, map[string]string{}, virType) if err != nil { return err } diff --git a/svc/reward_commission.go b/svc/reward_commission.go index 0f28dd2..2a6a2a6 100644 --- a/svc/reward_commission.go +++ b/svc/reward_commission.go @@ -13,12 +13,8 @@ import ( // getRewardCommission is 获取制度后的佣金 // 返回:单个佣金、层级佣金、错误 -func GetRewardCommission(engine *xorm.Engine, rmd *md.CommissionParam, isShare bool, userId, provider, masterId string, returnAllLevel bool, extraData map[string]string) (float64, float64, float64, float64, *comm_plan.LvUser, error) { - virCfg := db.SysCfgFindWithDb(engine, masterId, "virtual_coin_rebate_type") - var virType = "price" - if virCfg["virtual_coin_rebate_type"] != "" { - virType = virCfg["virtual_coin_rebate_type"] - } +func GetRewardCommission(engine *xorm.Engine, rmd *md.CommissionParam, isShare bool, userId, provider, masterId string, returnAllLevel bool, extraData map[string]string,virType string) (float64, float64, float64, float64, *comm_plan.LvUser, error) { + if virType == "commission" { rmd.GoodsPrice = rmd.Commission }