Bladeren bron

add reverse for v1.0.2 分佣规则

tags/v1.0.2
huangjuajun 2 jaren geleden
bovenliggende
commit
17eacbea2a
3 gewijzigde bestanden met toevoegingen van 11 en 10 verwijderingen
  1. +2
    -2
      db/db_virtual_coin.go
  2. +7
    -2
      rule/relate_commission.go
  3. +2
    -6
      svc/reward_commission.go

+ 2
- 2
db/db_virtual_coin.go Bestand weergeven

@@ -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


+ 7
- 2
rule/relate_commission.go Bestand weergeven

@@ -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, &param.CommissionParam, isShare, param.Uid, param.Provider, dbName, isAllLevelReturn, map[string]string{})
_, _, _, _, lvUser, err := svc.GetRewardCommission(eg, &param.CommissionParam, isShare, param.Uid, param.Provider, dbName, isAllLevelReturn, map[string]string{}, virType)
if err != nil {
return err
}


+ 2
- 6
svc/reward_commission.go Bestand weergeven

@@ -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
}


Laden…
Annuleren
Opslaan