Browse Source

更新

three
huangjiajun 11 months ago
parent
commit
c5d98de3ed
1 changed files with 15 additions and 13 deletions
  1. +15
    -13
      consume/zhios_order_hjy.go

+ 15
- 13
consume/zhios_order_hjy.go View File

@@ -93,6 +93,7 @@ func GetHjyOrderCommission(eg *xorm.Engine, dbName, order_id string) (string, st
str += hjyAppSecret str += hjyAppSecret
param["sign"] = utils.Md5(str) param["sign"] = utils.Md5(str)
post, _ := utils.CurlPost(url, param, nil) post, _ := utils.CurlPost(url, param, nil)
fmt.Println(string(post))
var data md.HjyOrderCommisisonData var data md.HjyOrderCommisisonData
json.Unmarshal(post, &data) json.Unmarshal(post, &data)
if data.Code != 0 { if data.Code != 0 {
@@ -144,21 +145,19 @@ func handleZhiosOrderHjy(msg []byte) error {
if err != nil || ordData == nil { if err != nil || ordData == nil {
return nil return nil
} }
if ordData.OrderFormType < 0 || ordData.State > 3 {
if ordData.OrderFormType < 0 {
sess.Commit() sess.Commit()


return nil return nil
} }
user, _ := db.UserFindByID(eg, ordData.Uid) user, _ := db.UserFindByID(eg, ordData.Uid)
if user == nil { if user == nil {
fmt.Println(user)
sess.Commit() sess.Commit()


return nil return nil
} }
if ordData.OrderFormType < 0 {
sess.Commit()
return nil
}

if ordData.State == 5 { if ordData.State == 5 {
sess.Commit() sess.Commit()
return nil return nil
@@ -172,6 +171,8 @@ func handleZhiosOrderHjy(msg []byte) error {
//加入分佣关系链 //加入分佣关系链
opts, commissionOpts, _ := svc.GetAllPlan(eg, canalMsg.Mid) opts, commissionOpts, _ := svc.GetAllPlan(eg, canalMsg.Mid)
if opts == nil { if opts == nil {
fmt.Println(opts)

sess.Commit() sess.Commit()


return nil return nil
@@ -184,6 +185,8 @@ func handleZhiosOrderHjy(msg []byte) error {
var rmd = md3.CommissionParam{IsTikTokTeamOrder: utils.IntToStr(ordData.IsTikTokTeamOrder)} var rmd = md3.CommissionParam{IsTikTokTeamOrder: utils.IntToStr(ordData.IsTikTokTeamOrder)}
opt, err := svc.GetPlanCfg(eg, pvd, canalMsg.Mid, opts, commissionOpts, map[int]string{}, &rmd) opt, err := svc.GetPlanCfg(eg, pvd, canalMsg.Mid, opts, commissionOpts, map[int]string{}, &rmd)
if err != nil { if err != nil {
fmt.Println(err)

sess.Commit() sess.Commit()
return nil return nil
} }
@@ -222,6 +225,7 @@ func handleZhiosOrderHjy(msg []byte) error {
} }
commissionList, err := GetCommissionByCommApi(eg, canalMsg.Mid, req) commissionList, err := GetCommissionByCommApi(eg, canalMsg.Mid, req)
if err != nil || commissionList.LvUser == nil { if err != nil || commissionList.LvUser == nil {
fmt.Println(err)
sess.Commit() sess.Commit()
return nil return nil
} }
@@ -234,12 +238,6 @@ func handleZhiosOrderHjy(msg []byte) error {
ordData.PvdCommission = pvdFee ordData.PvdCommission = pvdFee
ordData.SysCommission = sysFee ordData.SysCommission = sysFee
ordData.BuckleCommission = utils.Float64ToStr(BenefitAll) ordData.BuckleCommission = utils.Float64ToStr(BenefitAll)
if ordData.OrderFormType == 2 {
ordData.OrderFormType = -2
} else {
ordData.OrderFormType = -1

}
var selfRate float64 = 0 var selfRate float64 = 0
var subsidyRate float64 = 0 var subsidyRate float64 = 0
//处理记录佣金 //处理记录佣金
@@ -252,15 +250,19 @@ func handleZhiosOrderHjy(msg []byte) error {
ordData.PlanCommissionId = opt.PlanCommissionId ordData.PlanCommissionId = opt.PlanCommissionId
ordData.BenefitList = SerializeLvUser(NewCalcLvUserFee(lvUser)) ordData.BenefitList = SerializeLvUser(NewCalcLvUserFee(lvUser))
} }
has, _ := db.OrderListByUpdateOrd(sess, ordData)
if has == false {
_, err = db.OrderListByUpdateOrd(sess, ordData)
if err != nil {
fmt.Println(err)

sess.Rollback() sess.Rollback()
return nil return nil
} }
fmt.Println(lvUser)


//批量写入 //批量写入
if lvUser != nil { if lvUser != nil {
err := OrderRelateInsert1(eg, sess, ordData.OrdId, ordData.Pvd, ordData.CreateAt, lvUser, ordData, canalMsg.Mid, true, opt.Mode, "1") err := OrderRelateInsert1(eg, sess, ordData.OrdId, ordData.Pvd, ordData.CreateAt, lvUser, ordData, canalMsg.Mid, true, opt.Mode, "1")
fmt.Println(err)
if err != nil { if err != nil {
sess.Rollback() sess.Rollback()
return err return err


Loading…
Cancel
Save