|
|
@@ -16,13 +16,13 @@ import ( |
|
|
|
// 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 |
|
|
|
} |
|
|
|
//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) |
|
|
@@ -79,21 +79,21 @@ func BatchGetPublicPlatoonRelateCommissionByOrder(engine *xorm.Engine, masterId |
|
|
|
fatherPositions := strings.Split(userPublicPlatoonRelation.FatherUid, "-") |
|
|
|
var fatherPosition string |
|
|
|
userPublicPlatoonRelation.ReturnCommissionNum++ |
|
|
|
if len(fatherPositions) < userPublicPlatoonSetting.SeveralRows { |
|
|
|
remainder1 := (userPublicPlatoonRelation.ReturnCommissionNum) % len(fatherPositions) |
|
|
|
if remainder1 == 0 { |
|
|
|
fatherPosition = fatherPositions[len(fatherPositions)-1] |
|
|
|
} else { |
|
|
|
fatherPosition = fatherPositions[len(fatherPositions)-remainder1] |
|
|
|
} |
|
|
|
//if len(fatherPositions) < userPublicPlatoonSetting.SeveralRows { |
|
|
|
remainder1 := (userPublicPlatoonRelation.ReturnCommissionNum) % len(fatherPositions) |
|
|
|
if remainder1 == 0 { |
|
|
|
fatherPosition = fatherPositions[len(fatherPositions)-1] |
|
|
|
} else { |
|
|
|
remainder2 := (userPublicPlatoonRelation.ReturnCommissionNum) % userPublicPlatoonSetting.SeveralRows |
|
|
|
if remainder2 == 0 { |
|
|
|
fatherPosition = fatherPositions[userPublicPlatoonSetting.SeveralRows-1] |
|
|
|
} else { |
|
|
|
fatherPosition = fatherPositions[remainder2-1] |
|
|
|
} |
|
|
|
} |
|
|
|
fatherPosition = fatherPositions[len(fatherPositions)-remainder1] |
|
|
|
} |
|
|
|
//} else { |
|
|
|
// remainder2 := (userPublicPlatoonRelation.ReturnCommissionNum) % userPublicPlatoonSetting.SeveralRows |
|
|
|
// if remainder2 == 0 { |
|
|
|
// fatherPosition = fatherPositions[userPublicPlatoonSetting.SeveralRows-1] |
|
|
|
// } else { |
|
|
|
// fatherPosition = fatherPositions[remainder2-1] |
|
|
|
// } |
|
|
|
//} |
|
|
|
|
|
|
|
nowBenefitUsers, err := db.UserPublicPlatoonRelationGetOneByParams(engine, map[string]interface{}{ |
|
|
|
"key": "position", |
|
|
|