@@ -12,6 +12,7 @@ type CommissionParam struct { | |||||
LowestCouponPrice string `json:"lowestCouponPrice"` | LowestCouponPrice string `json:"lowestCouponPrice"` | ||||
MinGroupPrice string `json:"min_group_price"` | MinGroupPrice string `json:"min_group_price"` | ||||
PaidPrice string `json:"paid_price"` | PaidPrice string `json:"paid_price"` | ||||
Oid string `json:"oid"` //标记 | |||||
} | } | ||||
type CommissionFirstParam struct { | type CommissionFirstParam struct { | ||||
CommissionParam CommissionParam `json:"commission_param"` | CommissionParam CommissionParam `json:"commission_param"` | ||||
@@ -4,13 +4,11 @@ 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/db" | ||||
"code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git/db/model" | "code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git/db/model" | ||||
"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/md" | ||||
"code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git/svc" | |||||
zhios_order_relate_utils "code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git/utils" | zhios_order_relate_utils "code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git/utils" | ||||
zhios_order_relate_logx "code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git/utils/logx" | zhios_order_relate_logx "code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git/utils/logx" | ||||
"encoding/json" | |||||
"errors" | "errors" | ||||
"fmt" | |||||
"math" | "math" | ||||
"strconv" | |||||
"strings" | "strings" | ||||
"time" | "time" | ||||
"xorm.io/xorm" | "xorm.io/xorm" | ||||
@@ -18,101 +16,10 @@ import ( | |||||
// BatchGetPublicPlatoonRelateCommission 批量分佣 订单显示 | // BatchGetPublicPlatoonRelateCommission 批量分佣 订单显示 | ||||
func BatchGetPublicPlatoonRelateCommissionByOrder(engine *xorm.Engine, masterId string, PublicPlatoonRelateCommissionReqList []*md.PublicPlatoonRelateCommissionReq) (map[string]*md.PublicPlatoonRelateCommissionResp, error) { | func BatchGetPublicPlatoonRelateCommissionByOrder(engine *xorm.Engine, masterId string, PublicPlatoonRelateCommissionReqList []*md.PublicPlatoonRelateCommissionReq) (map[string]*md.PublicPlatoonRelateCommissionResp, error) { | ||||
var resp = make(map[string]*md.PublicPlatoonRelateCommissionResp) | |||||
userPublicPlatoonSetting, err := db.UserPublicPlatoonSettingGetOneByParams(engine, map[string]interface{}{ | |||||
"key": "is_open", | |||||
"value": 1, | |||||
}) | |||||
resp, err := svc.BatchGetPublicPlatoonRelateCommissionByOrder(engine, masterId, PublicPlatoonRelateCommissionReqList) | |||||
if err != nil { | if err != nil { | ||||
return nil, err | return nil, err | ||||
} | } | ||||
for _, param := range PublicPlatoonRelateCommissionReqList { | |||||
// 根据供应商 | |||||
rewardOpt, err := db.DbsPlanRewardByPvd(engine, param.Pvd) | |||||
if err != nil { | |||||
return nil, err | |||||
} | |||||
if rewardOpt == nil { | |||||
return nil, zhios_order_relate_logx.Warn("找不到方案记录") | |||||
} | |||||
if rewardOpt.State == 0 { | |||||
return nil, zhios_order_relate_logx.Warn("抽成方案未开启") | |||||
} | |||||
if rewardOpt.PlanCommissionId == 0 { | |||||
return nil, zhios_order_relate_logx.Warn("抽成方案未设置佣金方案id") | |||||
} | |||||
fmt.Println("抽成设置:", zhios_order_relate_utils.SerializeStr(rewardOpt)) | |||||
fmt.Println("commission id:", rewardOpt.PlanCommissionId) | |||||
//TODO::计算共富收益 | |||||
commissionOpt, err := db.DbsPlanCommissionById(engine, rewardOpt.PlanCommissionId) | |||||
if err != nil || commissionOpt == nil || commissionOpt.Id == 0 { | |||||
return nil, err | |||||
} | |||||
var subsidyTmp map[string]*md.LvGrade | |||||
if err := json.Unmarshal([]byte(commissionOpt.Data), &subsidyTmp); err != nil { | |||||
return nil, zhios_order_relate_logx.Warn(fmt.Sprintf("%s:分佣方案数据设置错误", masterId)) | |||||
} | |||||
lvGrade := subsidyTmp[param.UserLevel] | |||||
var selfRateList, commonWealthSystem, directPush map[string]string | |||||
for _, coinId := range lvGrade.ReturnType { | |||||
selfRateList[coinId] = zhios_order_relate_utils.Float64ToStr(zhios_order_relate_utils.StrToFloat64(lvGrade.SelfRateList[coinId]) * zhios_order_relate_utils.StrToFloat64(param.PendingAmount) / 100) | |||||
commonWealthSystem[coinId] = zhios_order_relate_utils.Float64ToStr(zhios_order_relate_utils.StrToFloat64(lvGrade.CommonWealthSystem[coinId]) * zhios_order_relate_utils.StrToFloat64(param.PendingAmount) / 100) | |||||
directPush[coinId] = zhios_order_relate_utils.Float64ToStr(zhios_order_relate_utils.StrToFloat64(lvGrade.DirectPush[coinId]) * zhios_order_relate_utils.StrToFloat64(param.PendingAmount)) | |||||
} | |||||
//TODO::本次消费产生的共富收益给到谁 | |||||
var nowBenefitUid string | |||||
userPublicPlatoonRelation, err := db.UserPublicPlatoonRelationGetOneByParams(engine, map[string]interface{}{ | |||||
"key": "uid", | |||||
"value": param.Uid, | |||||
}) | |||||
if err != nil { | |||||
return nil, err | |||||
} | |||||
if userPublicPlatoonRelation == nil { | |||||
return nil, errors.New("未查询到公排关系记录") | |||||
} | |||||
fatherPositions := strings.Split(userPublicPlatoonRelation.FatherUid, "-") | |||||
var fatherPosition string | |||||
userPublicPlatoonRelation.ReturnCommissionNum++ | |||||
remainder := (userPublicPlatoonRelation.ReturnCommissionNum) % userPublicPlatoonSetting.SeveralRows | |||||
if remainder == 0 { | |||||
fatherPosition = fatherPositions[userPublicPlatoonSetting.SeveralRows-1] | |||||
} else { | |||||
fatherPosition = fatherPositions[remainder-1] | |||||
} | |||||
nowBenefitUsers, err := db.UserPublicPlatoonRelationGetOneByParams(engine, map[string]interface{}{ | |||||
"key": "position", | |||||
"value": fatherPosition, | |||||
}) | |||||
if err != nil { | |||||
return nil, err | |||||
} | |||||
if nowBenefitUsers == nil { | |||||
return nil, errors.New("未查询到父级公排关系记录") | |||||
} | |||||
nowBenefitUid = zhios_order_relate_utils.AnyToString(nowBenefitUsers.Uid) | |||||
//TODO::更新 公排关系记录 中 `return_commission_num` | |||||
affected, err := db.UserPublicPlatoonRelationUpdate(engine.NewSession(), userPublicPlatoonRelation.Id, userPublicPlatoonRelation, "return_commission_num") | |||||
if err != nil { | |||||
return nil, err | |||||
} | |||||
if affected == 0 { | |||||
return nil, errors.New("更新公排关系记录失败") | |||||
} | |||||
resp[param.Oid] = &md.PublicPlatoonRelateCommissionResp{ | |||||
Uid: param.Uid, | |||||
CommonWealthBenefitUid: nowBenefitUid, | |||||
DirectPushBenefitUid: strconv.Itoa(userPublicPlatoonRelation.RecommendUid), | |||||
PendingAmount: param.PendingAmount, | |||||
Oid: param.Oid, | |||||
SelfRateList: selfRateList, | |||||
CommonWealthSystem: commonWealthSystem, | |||||
DirectPush: directPush, | |||||
} | |||||
} | |||||
return resp, nil | return resp, nil | ||||
} | } | ||||
@@ -45,7 +45,7 @@ func BatchGetCommissionByGoods(eg *xorm.Engine, dbName string, commissionParamLi | |||||
if param.GoodsId == "" { | if param.GoodsId == "" { | ||||
return errors.New("商品ID缺失") | return errors.New("商品ID缺失") | ||||
} | } | ||||
param.CommissionParam.Oid=param.GoodsId | |||||
_, _, _, _, lvUser, err := svc.GetRewardCommission(eg, ¶m.CommissionParam, isShare, param.Uid, param.Provider, dbName, isAllLevelReturn, map[string]string{}, virType) | _, _, _, _, lvUser, err := svc.GetRewardCommission(eg, ¶m.CommissionParam, isShare, param.Uid, param.Provider, dbName, isAllLevelReturn, map[string]string{}, virType) | ||||
if err != nil { | if err != nil { | ||||
return err | return err | ||||
@@ -96,6 +96,7 @@ func BatchGetCommissionByOrder(engine *xorm.Engine, dbName string, CommissionPar | |||||
return errors.New("订单缺失") | return errors.New("订单缺失") | ||||
} | } | ||||
param.CommissionParam.OldPrice = param.CommissionParam.GoodsPrice | param.CommissionParam.OldPrice = param.CommissionParam.GoodsPrice | ||||
param.CommissionParam.Oid=param.Oid | |||||
profit, pvdFee, sysFee, subsidyFee, lvUser, err := svc.GetRewardCommission(engine, ¶m.CommissionParam, isShare, param.Uid, param.Provider, dbName, isAllLevelReturn, map[string]string{}, virType) | profit, pvdFee, sysFee, subsidyFee, lvUser, err := svc.GetRewardCommission(engine, ¶m.CommissionParam, isShare, param.Uid, param.Provider, dbName, isAllLevelReturn, map[string]string{}, virType) | ||||
if err != nil { | if err != nil { | ||||
@@ -144,6 +145,8 @@ func SettleCommWithGoodsDetail(eg *xorm.Engine, dbName string, CommissionParam m | |||||
if virCfg != nil && virCfg.Val != "" { | if virCfg != nil && virCfg.Val != "" { | ||||
virType = virCfg.Val | virType = virCfg.Val | ||||
} | } | ||||
CommissionParam.CommissionParam.Oid=CommissionParam.GoodsId | |||||
profit, pvdFee, sysFee, subsidyFee, lvUser, err := svc.GetRewardCommission(eg, &CommissionParam.CommissionParam, isShare, CommissionParam.Uid, CommissionParam.Provider, dbName, isAllLevelReturn, mapData, virType) | profit, pvdFee, sysFee, subsidyFee, lvUser, err := svc.GetRewardCommission(eg, &CommissionParam.CommissionParam, isShare, CommissionParam.Uid, CommissionParam.Provider, dbName, isAllLevelReturn, mapData, virType) | ||||
return profit, pvdFee, sysFee, subsidyFee, lvUser, err | return profit, pvdFee, sysFee, subsidyFee, lvUser, err | ||||
} | } | ||||
@@ -165,6 +168,7 @@ func GetRewardCommission(eg *xorm.Engine, dbName, mode string, CommissionParam m | |||||
if CommissionParam.IsAllLevelReturn != 0 { | if CommissionParam.IsAllLevelReturn != 0 { | ||||
isAllLevelReturn = true | isAllLevelReturn = true | ||||
} | } | ||||
CommissionParam.CommissionParam.Oid=CommissionParam.GoodsId | |||||
var lvUser = &comm_plan.LvUser{} | var lvUser = &comm_plan.LvUser{} | ||||
var mapsDta = map[string]string{"show_level": CommissionParam.ShowLevel} | var mapsDta = map[string]string{"show_level": CommissionParam.ShowLevel} | ||||
if isAll { | if isAll { | ||||
@@ -48,7 +48,7 @@ func GetPlanCfg(eg *xorm.Engine, pvd, masterId string) (*comm_plan.PlanOpt, erro | |||||
if err != nil || commissionOpt == nil || commissionOpt.Id == 0 { | if err != nil || commissionOpt == nil || commissionOpt.Id == 0 { | ||||
return nil, err | return nil, err | ||||
} | } | ||||
if _, ok := comm_plan.Fn[commissionOpt.Mode]; !ok { | |||||
if _, ok := comm_plan.Fn[commissionOpt.Mode]; !ok && commissionOpt.Mode != "public_platoon" { | |||||
return nil, zhios_order_relate_logx.Warn("分佣模式不存在") | return nil, zhios_order_relate_logx.Warn("分佣模式不存在") | ||||
} | } | ||||
opt.Pvd = pvd | opt.Pvd = pvd | ||||
@@ -0,0 +1,114 @@ | |||||
package svc | |||||
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/md" | |||||
zhios_order_relate_utils "code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git/utils" | |||||
zhios_order_relate_logx "code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git/utils/logx" | |||||
"encoding/json" | |||||
"errors" | |||||
"fmt" | |||||
"strconv" | |||||
"strings" | |||||
"xorm.io/xorm" | |||||
) | |||||
// BatchGetPublicPlatoonRelateCommission 批量分佣 订单显示 | |||||
func BatchGetPublicPlatoonRelateCommissionByOrder(engine *xorm.Engine, masterId string, PublicPlatoonRelateCommissionReqList []*md.PublicPlatoonRelateCommissionReq) (map[string]*md.PublicPlatoonRelateCommissionResp, error) { | |||||
var resp = make(map[string]*md.PublicPlatoonRelateCommissionResp) | |||||
userPublicPlatoonSetting, err := db.UserPublicPlatoonSettingGetOneByParams(engine, map[string]interface{}{ | |||||
"key": "is_open", | |||||
"value": 1, | |||||
}) | |||||
if err != nil { | |||||
return nil, err | |||||
} | |||||
for _, param := range PublicPlatoonRelateCommissionReqList { | |||||
// 根据供应商 | |||||
rewardOpt, err := db.DbsPlanRewardByPvd(engine, param.Pvd) | |||||
if err != nil { | |||||
return nil, err | |||||
} | |||||
if rewardOpt == nil { | |||||
return nil, zhios_order_relate_logx.Warn("找不到方案记录") | |||||
} | |||||
if rewardOpt.State == 0 { | |||||
return nil, zhios_order_relate_logx.Warn("抽成方案未开启") | |||||
} | |||||
if rewardOpt.PlanCommissionId == 0 { | |||||
return nil, zhios_order_relate_logx.Warn("抽成方案未设置佣金方案id") | |||||
} | |||||
fmt.Println("抽成设置:", zhios_order_relate_utils.SerializeStr(rewardOpt)) | |||||
fmt.Println("commission id:", rewardOpt.PlanCommissionId) | |||||
//TODO::计算共富收益 | |||||
commissionOpt, err := db.DbsPlanCommissionById(engine, rewardOpt.PlanCommissionId) | |||||
if err != nil || commissionOpt == nil || commissionOpt.Id == 0 { | |||||
return nil, err | |||||
} | |||||
var subsidyTmp map[string]*md.LvGrade | |||||
if err := json.Unmarshal([]byte(commissionOpt.Data), &subsidyTmp); err != nil { | |||||
return nil, zhios_order_relate_logx.Warn(fmt.Sprintf("%s:分佣方案数据设置错误", masterId)) | |||||
} | |||||
lvGrade := subsidyTmp[param.UserLevel] | |||||
var selfRateList, commonWealthSystem, directPush map[string]string | |||||
for _, coinId := range lvGrade.ReturnType { | |||||
selfRateList[coinId] = zhios_order_relate_utils.Float64ToStr(zhios_order_relate_utils.StrToFloat64(lvGrade.SelfRateList[coinId]) * zhios_order_relate_utils.StrToFloat64(param.PendingAmount) / 100) | |||||
commonWealthSystem[coinId] = zhios_order_relate_utils.Float64ToStr(zhios_order_relate_utils.StrToFloat64(lvGrade.CommonWealthSystem[coinId]) * zhios_order_relate_utils.StrToFloat64(param.PendingAmount) / 100) | |||||
directPush[coinId] = zhios_order_relate_utils.Float64ToStr(zhios_order_relate_utils.StrToFloat64(lvGrade.DirectPush[coinId]) * zhios_order_relate_utils.StrToFloat64(param.PendingAmount)) | |||||
} | |||||
//TODO::本次消费产生的共富收益给到谁 | |||||
var nowBenefitUid string | |||||
userPublicPlatoonRelation, err := db.UserPublicPlatoonRelationGetOneByParams(engine, map[string]interface{}{ | |||||
"key": "uid", | |||||
"value": param.Uid, | |||||
}) | |||||
if err != nil { | |||||
return nil, err | |||||
} | |||||
if userPublicPlatoonRelation == nil { | |||||
return nil, errors.New("未查询到公排关系记录") | |||||
} | |||||
fatherPositions := strings.Split(userPublicPlatoonRelation.FatherUid, "-") | |||||
var fatherPosition string | |||||
userPublicPlatoonRelation.ReturnCommissionNum++ | |||||
remainder := (userPublicPlatoonRelation.ReturnCommissionNum) % userPublicPlatoonSetting.SeveralRows | |||||
if remainder == 0 { | |||||
fatherPosition = fatherPositions[userPublicPlatoonSetting.SeveralRows-1] | |||||
} else { | |||||
fatherPosition = fatherPositions[remainder-1] | |||||
} | |||||
nowBenefitUsers, err := db.UserPublicPlatoonRelationGetOneByParams(engine, map[string]interface{}{ | |||||
"key": "position", | |||||
"value": fatherPosition, | |||||
}) | |||||
if err != nil { | |||||
return nil, err | |||||
} | |||||
if nowBenefitUsers == nil { | |||||
return nil, errors.New("未查询到父级公排关系记录") | |||||
} | |||||
nowBenefitUid = zhios_order_relate_utils.AnyToString(nowBenefitUsers.Uid) | |||||
//TODO::更新 公排关系记录 中 `return_commission_num` | |||||
affected, err := db.UserPublicPlatoonRelationUpdate(engine.NewSession(), userPublicPlatoonRelation.Id, userPublicPlatoonRelation, "return_commission_num") | |||||
if err != nil { | |||||
return nil, err | |||||
} | |||||
if affected == 0 { | |||||
return nil, errors.New("更新公排关系记录失败") | |||||
} | |||||
resp[param.Oid] = &md.PublicPlatoonRelateCommissionResp{ | |||||
Uid: param.Uid, | |||||
CommonWealthBenefitUid: nowBenefitUid, | |||||
DirectPushBenefitUid: strconv.Itoa(userPublicPlatoonRelation.RecommendUid), | |||||
PendingAmount: param.PendingAmount, | |||||
Oid: param.Oid, | |||||
SelfRateList: selfRateList, | |||||
CommonWealthSystem: commonWealthSystem, | |||||
DirectPush: directPush, | |||||
} | |||||
} | |||||
return resp, nil | |||||
} |
@@ -17,6 +17,9 @@ func GetRewardCommission(engine *xorm.Engine, rmd *md.CommissionParam, isShare b | |||||
if virType == "commission" { | if virType == "commission" { | ||||
rmd.GoodsPrice = rmd.Commission | rmd.GoodsPrice = rmd.Commission | ||||
} | } | ||||
if rmd.Oid == "" { | |||||
rmd.Oid = "1" | |||||
} | |||||
var ( | var ( | ||||
err error | err error | ||||
uid = 0 | uid = 0 | ||||
@@ -53,12 +56,6 @@ func GetRewardCommission(engine *xorm.Engine, rmd *md.CommissionParam, isShare b | |||||
return 0, 0, 0, 0, nil, errors.New("分佣方案未设置") | return 0, 0, 0, 0, nil, errors.New("分佣方案未设置") | ||||
} | } | ||||
var userRelationship *[]md.UserRelation | |||||
if returnAllLevel { | |||||
userRelationship, err = UserRelativeNetwork(engine, uid) | |||||
} else { | |||||
userRelationship = nil | |||||
} | |||||
// 获取全部佣金 | // 获取全部佣金 | ||||
com, price := getCommission(rmd, provider) | com, price := getCommission(rmd, provider) | ||||
fmt.Println(com) | fmt.Println(com) | ||||
@@ -67,15 +64,73 @@ func GetRewardCommission(engine *xorm.Engine, rmd *md.CommissionParam, isShare b | |||||
if zhios_order_relate_utils.InArr(cfg.Mode, []string{"lv_price", "lv_winery"}) && zhios_order_relate_utils.StrToFloat64(rmd.OldPrice) > 0 { //价格为基数 | if zhios_order_relate_utils.InArr(cfg.Mode, []string{"lv_price", "lv_winery"}) && zhios_order_relate_utils.StrToFloat64(rmd.OldPrice) > 0 { //价格为基数 | ||||
comf = zhios_order_relate_utils.StrToFloat64(rmd.OldPrice) | comf = zhios_order_relate_utils.StrToFloat64(rmd.OldPrice) | ||||
} | } | ||||
// userRelationship == nil 是只返回第一层 即用户自己的 | |||||
pvdFee, sysFee, subsidyFee, ulink, err := CalcCommission(uid, level, 0, ownbuyReturnType, comf, zhios_order_relate_utils.StrToFloat64(price), isShare, cfg, userRelationship, newProvider, newLevel, engine) | |||||
if err != nil { | |||||
return 0, 0, 0, 0, nil, nil | |||||
if cfg.Mode != "public_platoon" { //公排走另一个制度 | |||||
var userRelationship *[]md.UserRelation | |||||
if returnAllLevel { | |||||
userRelationship, err = UserRelativeNetwork(engine, uid) | |||||
} else { | |||||
userRelationship = nil | |||||
} | |||||
// userRelationship == nil 是只返回第一层 即用户自己的 | |||||
pvdFee, sysFee, subsidyFee, ulink, err := CalcCommission(uid, level, 0, ownbuyReturnType, comf, zhios_order_relate_utils.StrToFloat64(price), isShare, cfg, userRelationship, newProvider, newLevel, engine) | |||||
if err != nil { | |||||
return 0, 0, 0, 0, nil, nil | |||||
} | |||||
if ulink == nil { | |||||
return 0, 0, 0, 0, nil, nil | |||||
} | |||||
return ulink.Profit, pvdFee, sysFee, subsidyFee, ulink, nil | |||||
} else { //公排 | |||||
//佣金扣除抽成后 | |||||
fee, pvdFee, sysFee := CommFee(comf, cfg, "commission") | |||||
////积分扣除抽成后 | |||||
//var integralSysFee float64 = 0 | |||||
//integralFee, _, integralSysFee := CommFee(comf, cfg, "integral") | |||||
//调用公排制度 | |||||
var PublicPlatoonRelateCommissionReqList = []*md.PublicPlatoonRelateCommissionReq{ | |||||
{ | |||||
Pvd: newProvider, | |||||
Uid: zhios_order_relate_utils.IntToStr(uid), | |||||
UserLevel: zhios_order_relate_utils.IntToStr(level), | |||||
PendingAmount: zhios_order_relate_utils.Float64ToStr(fee), | |||||
Oid: rmd.Oid, | |||||
}, | |||||
} | |||||
order, err := BatchGetPublicPlatoonRelateCommissionByOrder(engine, masterId, PublicPlatoonRelateCommissionReqList) | |||||
if err != nil || order[rmd.Oid] == nil { | |||||
return 0, 0, 0, 0, nil, nil | |||||
} | |||||
reward := order[rmd.Oid] | |||||
profit := zhios_order_relate_utils.StrToFloat64(reward.SelfRateList["0"]) | |||||
var ulink = &comm_plan.LvUser{} | |||||
//共富收益处理 | |||||
ulink = getRewardLink(reward.CommonWealthBenefitUid, 2, reward.CommonWealthSystem, ulink) | |||||
//直推收益处理 | |||||
ulink = getRewardLink(reward.DirectPushBenefitUid, 1, reward.DirectPush, ulink) | |||||
//自购 | |||||
ulink = getRewardLink(reward.Uid, 0, reward.SelfRateList, ulink) | |||||
return profit, pvdFee, sysFee, 0, nil, nil | |||||
} | |||||
} | |||||
func getRewardLink(uid string, diff int, reward map[string]string, ulinkParent *comm_plan.LvUser) *comm_plan.LvUser { | |||||
var SubsidyFee = zhios_order_relate_utils.StrToFloat64(reward["0"]) | |||||
var SubsidyFeeList = make([]*comm_plan.VirtualCoinCommission, 0) | |||||
for k, v := range reward { | |||||
var tmp = &comm_plan.VirtualCoinCommission{ | |||||
Cid: k, | |||||
Val: zhios_order_relate_utils.StrToFloat64(v), | |||||
} | |||||
SubsidyFeeList = append(SubsidyFeeList, tmp) | |||||
} | } | ||||
if ulink == nil { | |||||
return 0, 0, 0, 0, nil, nil | |||||
//组装数据 | |||||
var ulink = &comm_plan.LvUser{ | |||||
Uid: zhios_order_relate_utils.StrToInt(uid), | |||||
SubsidyFee: SubsidyFee, | |||||
SubsidyFeeList: SubsidyFeeList, | |||||
Diff: diff, | |||||
ParentUser: ulinkParent, | |||||
} | } | ||||
return ulink.Profit, pvdFee, sysFee, subsidyFee, ulink, nil | |||||
return ulink | |||||
} | } | ||||
func getCommission(d *md.CommissionParam, provider string) (string, string) { | func getCommission(d *md.CommissionParam, provider string) (string, string) { | ||||