@@ -24,6 +24,7 @@ type CommissionParam struct { | |||||
MinLevel int `json:"min_level"` | MinLevel int `json:"min_level"` | ||||
DouyinBili string `json:"douyin_bili"` | DouyinBili string `json:"douyin_bili"` | ||||
ServiceUid string `json:"service_uid"` | ServiceUid string `json:"service_uid"` | ||||
ReturnCommissionNum string `json:"return_commission_num"` | |||||
} | } | ||||
type CommissionFirstParam struct { | type CommissionFirstParam struct { | ||||
CommissionParam CommissionParam `json:"commission_param"` | CommissionParam CommissionParam `json:"commission_param"` | ||||
@@ -11,13 +11,14 @@ type SmallLvGrade struct { | |||||
} | } | ||||
type SmallPublicPlatoonRelateCommissionReq 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 { | type SmallPublicPlatoonRelateCommissionResp struct { | ||||
@@ -105,12 +105,13 @@ func GetRewardCommission(engine *xorm.Engine, rmd *md.CommissionParam, isShare b | |||||
if userPublicPlatoonSetting.IsUseSmallPublicPlatoon == 1 { //小公排 | if userPublicPlatoonSetting.IsUseSmallPublicPlatoon == 1 { //小公排 | ||||
var PublicPlatoonRelateCommissionReqList = []*md.SmallPublicPlatoonRelateCommissionReq{ | 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) | var order = make(map[string]*md.SmallPublicPlatoonRelateCommissionResp) | ||||
@@ -105,7 +105,11 @@ func benefitUid(engine *xorm.Engine, param *md.SmallPublicPlatoonRelateCommissio | |||||
} else { | } else { | ||||
fatherPositions := strings.Split(userPublicPlatoonRelation.FatherUid, "-") | fatherPositions := strings.Split(userPublicPlatoonRelation.FatherUid, "-") | ||||
var fatherPosition string | 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{}{ | userPublicPlatoonSetting, err := db.UserPublicPlatoonSettingGetOneByParams(engine, map[string]interface{}{ | ||||
"key": "is_open", | "key": "is_open", | ||||
"value": 1, | "value": 1, | ||||
@@ -145,14 +149,15 @@ func benefitUid(engine *xorm.Engine, param *md.SmallPublicPlatoonRelateCommissio | |||||
nowBenefitUid = zhios_order_relate_utils.AnyToString(nowBenefitUsers.Uid) | 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 | return nowBenefitUid, nil, nil | ||||