huangjiajun преди 11 месеца
родител
ревизия
c5d98de3ed
променени са 1 файла, в които са добавени 15 реда и са изтрити 13 реда
  1. +15
    -13
      consume/zhios_order_hjy.go

+ 15
- 13
consume/zhios_order_hjy.go Целия файл

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

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

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

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

sess.Commit()

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

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

}
var selfRate float64 = 0
var subsidyRate float64 = 0
//处理记录佣金
@@ -252,15 +250,19 @@ func handleZhiosOrderHjy(msg []byte) error {
ordData.PlanCommissionId = opt.PlanCommissionId
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()
return nil
}
fmt.Println(lvUser)

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


Зареждане…
Отказ
Запис