huangjiajun 2 weeks ago
parent
commit
5ebd4346b5
4 changed files with 30 additions and 22 deletions
  1. +1
    -0
      md/commission_parameter.go
  2. +8
    -7
      md/small_public_platoon_relate_commission.go
  3. +7
    -6
      svc/reward_commission.go
  4. +14
    -9
      svc/small_public_platoon_relate_commission.go

+ 1
- 0
md/commission_parameter.go View File

@@ -24,6 +24,7 @@ type CommissionParam struct {
MinLevel int `json:"min_level"`
DouyinBili string `json:"douyin_bili"`
ServiceUid string `json:"service_uid"`
ReturnCommissionNum string `json:"return_commission_num"`
}
type CommissionFirstParam struct {
CommissionParam CommissionParam `json:"commission_param"`


+ 8
- 7
md/small_public_platoon_relate_commission.go View File

@@ -11,13 +11,14 @@ type SmallLvGrade struct {
}

type SmallPublicPlatoonRelateCommissionReq struct {
Pvd string `json:"pvd"` //平台供应商 (taobao/jd/pdd/mall_goods ...)
Uid string `json:"uid"`
UserLevel string `json:"user_level"` //用户等级
PendingAmount string `json:"pending_amount"` //待处理金额
Oid string `json:"oid"` //订单id
PendingIntegral string `json:"pending_integral"` //待处理金额
ServiceUid string `json:"service_uid"`
Pvd string `json:"pvd"` //平台供应商 (taobao/jd/pdd/mall_goods ...)
Uid string `json:"uid"`
UserLevel string `json:"user_level"` //用户等级
PendingAmount string `json:"pending_amount"` //待处理金额
Oid string `json:"oid"` //订单id
PendingIntegral string `json:"pending_integral"` //待处理金额
ServiceUid string `json:"service_uid"`
ReturnCommissionNum string `json:"return_commission_num"`
}

type SmallPublicPlatoonRelateCommissionResp struct {


+ 7
- 6
svc/reward_commission.go View File

@@ -105,12 +105,13 @@ func GetRewardCommission(engine *xorm.Engine, rmd *md.CommissionParam, isShare b
if userPublicPlatoonSetting.IsUseSmallPublicPlatoon == 1 { //小公排
var PublicPlatoonRelateCommissionReqList = []*md.SmallPublicPlatoonRelateCommissionReq{
{
Pvd: newProvider,
Uid: zhios_order_relate_utils.IntToStr(uid),
UserLevel: zhios_order_relate_utils.IntToStr(level),
PendingAmount: zhios_order_relate_utils.Float64ToStrByPrec(fee, 9),
PendingIntegral: zhios_order_relate_utils.Float64ToStrByPrec(integralFee, 9),
Oid: rmd.Oid,
Pvd: newProvider,
Uid: zhios_order_relate_utils.IntToStr(uid),
UserLevel: zhios_order_relate_utils.IntToStr(level),
PendingAmount: zhios_order_relate_utils.Float64ToStrByPrec(fee, 9),
PendingIntegral: zhios_order_relate_utils.Float64ToStrByPrec(integralFee, 9),
Oid: rmd.Oid,
ReturnCommissionNum: rmd.ReturnCommissionNum,
},
}
var order = make(map[string]*md.SmallPublicPlatoonRelateCommissionResp)


+ 14
- 9
svc/small_public_platoon_relate_commission.go View File

@@ -105,7 +105,11 @@ func benefitUid(engine *xorm.Engine, param *md.SmallPublicPlatoonRelateCommissio
} else {
fatherPositions := strings.Split(userPublicPlatoonRelation.FatherUid, "-")
var fatherPosition string
userPublicPlatoonRelation.ReturnCommissionNum++
if zhios_order_relate_utils.StrToInt(param.ReturnCommissionNum) > 0 {
userPublicPlatoonRelation.ReturnCommissionNum = zhios_order_relate_utils.StrToInt(param.ReturnCommissionNum)
} else {
userPublicPlatoonRelation.ReturnCommissionNum++
}
userPublicPlatoonSetting, err := db.UserPublicPlatoonSettingGetOneByParams(engine, map[string]interface{}{
"key": "is_open",
"value": 1,
@@ -145,14 +149,15 @@ func benefitUid(engine *xorm.Engine, param *md.SmallPublicPlatoonRelateCommissio
nowBenefitUid = zhios_order_relate_utils.AnyToString(nowBenefitUsers.Uid)
}
}

//TODO::更新 公排关系记录 中 `return_commission_num`
affected, err := db.UserSmallPublicPlatoonRelationUpdate(engine.NewSession(), userPublicPlatoonRelation.Id, userPublicPlatoonRelation, "return_commission_num")
if err != nil {
return nowBenefitUid, nil, err
}
if affected == 0 {
return nowBenefitUid, nil, errors.New("更新公排关系记录失败")
if zhios_order_relate_utils.StrToInt(param.ReturnCommissionNum) == 0 {
//TODO::更新 公排关系记录 中 `return_commission_num`
affected, err := db.UserSmallPublicPlatoonRelationUpdate(engine.NewSession(), userPublicPlatoonRelation.Id, userPublicPlatoonRelation, "return_commission_num")
if err != nil {
return nowBenefitUid, nil, err
}
if affected == 0 {
return nowBenefitUid, nil, errors.New("更新公排关系记录失败")
}
}
}
return nowBenefitUid, nil, nil


Loading…
Cancel
Save