Browse Source

更新

guide_order
huangjiajun 2 weeks ago
parent
commit
6a680bf390
4 changed files with 26 additions and 2 deletions
  1. +2
    -0
      app/db/model/four_newcomers_free_product.go
  2. +3
    -0
      app/db/model/ord_list.go
  3. +20
    -1
      app/svc/svc_order_track_save_create_update_zero.go
  4. +1
    -1
      consume/zhios_order_track_create_for_pdd_zero_consume.go

+ 2
- 0
app/db/model/four_newcomers_free_product.go View File

@@ -28,6 +28,8 @@ type FourNewcomersFreeProduct struct {
CouponUrl string `json:"coupon_url" xorm:"not null default '' comment('优惠券链接') VARCHAR(255)"`
Commission string `json:"commission" xorm:"not null default '' comment('') VARCHAR(255)"`
ActivityId string `json:"activity_id" xorm:"not null default '' comment('') VARCHAR(255)"`
CheckPrice string `json:"check_price" xorm:"not null default '' comment('') VARCHAR(255)"`
NewData string `json:"new_data" xorm:"not null default '' comment('') VARCHAR(255)"`
Amount int `json:"amount" xorm:"not null default 0 comment('总数') INT(11)"`
ReturnType int `json:"return_type" xorm:"default 0 comment('0平台补贴 1 淘礼金补贴') INT(1)"`
OwnbuyReturnType int `json:"ownbuy_return_type" xorm:"default 0 comment('自购补贴:1开启、0关闭') INT(1)"`


+ 3
- 0
app/db/model/ord_list.go View File

@@ -31,6 +31,7 @@ type OrdList struct {
PlanCommissionState int `xorm:"not null default 0 TINYINT(1)" json:"plan_commission_state"`
Reason string `xorm:"not null default '' VARCHAR(32)" json:"reason"`
State int `xorm:"not null default 0 TINYINT(1)" json:"state"`
OldState int `xorm:"not null default 0 TINYINT(1)" json:"old_state"`
LockState int `xorm:"not null default 0 TINYINT(1)" json:"lock_state"`
CreateAt int `xorm:"not null default 0 INT(10)" json:"create_at"`
UpdateAt int `xorm:"not null default 0 INT(11)" json:"update_at"`
@@ -54,6 +55,7 @@ type OrdList struct {
IsTikTokTeamOrder int `xorm:"not null default 0 INT(1)" json:"is_tik_tok_team_order"`
TikTokTeamCommission string `json:"tik_tok_team_commission" xorm:"not null default 0.00 comment('') DECIMAL(20,8)"`
TikTokTeamRealCommission string `json:"tik_tok_team_real_commission" xorm:"not null default 0.00 comment('') DECIMAL(20,8)"`
ReturnMoney string `json:"return_money" xorm:"not null default 0.00 comment('') DECIMAL(20,8)"`
IsFastSign int `xorm:"not null default 0 INT(1)" json:"is_fast_sign"`
IsWaitReduce int `xorm:"not null default 0 INT(1)" json:"is_wait_reduce"`
FastSignId string `xorm:"not null default '' VARCHAR(100)" json:"fast_sign_id"`
@@ -62,6 +64,7 @@ type OrdList struct {
FastSuccess int `xorm:"not null default 0 INT(1)" json:"fast_success"`
OrderFormType int `xorm:"not null default 0 INT(1)" json:"order_form_type"`
IsTotal int `xorm:"not null default 0 INT(1)" json:"is_total"`
FreezeTime int `xorm:"not null default 0 INT(1)" json:"freeze_time"`
TaskType string `xorm:"not null default '' VARCHAR(100)" json:"task_type"`
NumItemId string `xorm:"not null default '' VARCHAR(100)" json:"num_item_id"`
}

+ 20
- 1
app/svc/svc_order_track_save_create_update_zero.go View File

@@ -165,6 +165,11 @@ func OrderSaveCreateUpdateZero(eg *xorm.Engine, pvd string, ordData *[]md.OrderI
var returnMoneyReqList = make([]map[string]string, 0)

for _, v := range *existOrds {
if v.OldState != 4 {
v.OldState = ords[v.PvdOid].State
_ = db.DbsOrderUpdate(eg, v.OrdId, &v)
}

if v.State == 4 {
continue
}
@@ -179,6 +184,7 @@ func OrderSaveCreateUpdateZero(eg *xorm.Engine, pvd string, ordData *[]md.OrderI
_ = db.DbsOrderUpdate(eg, v.OrdId, &v)
}
}

if int(ords[v.PvdOid].ConfirmAt) > 0 && v.ConfirmAt != int(ords[v.PvdOid].ConfirmAt) {
v.ConfirmAt = int(ords[v.PvdOid].ConfirmAt)
_ = db.DbsOrderUpdate(eg, v.OrdId, &v)
@@ -565,7 +571,7 @@ func OrderSaveCreateUpdateZero(eg *xorm.Engine, pvd string, ordData *[]md.OrderI
v.Pid = "self"
}
v.Pid = strings.ReplaceAll(v.Pid, "relationfree_", "free_")
state := v.State
allCommission := v.Commission
newPvd := pvd
//判断是饿了么的
@@ -648,6 +654,8 @@ func OrderSaveCreateUpdateZero(eg *xorm.Engine, pvd string, ordData *[]md.OrderI
v.OrderType = md.OrderTypeFree
}
freeOrderType := v.OrderType
returnMoney := "0"
freezeTime := "96"
if v.OrderType == 20 {
if user == nil || user.Uid == 0 { //判断免单的如果没有用户不跟这个订单
continue
@@ -659,7 +667,15 @@ func OrderSaveCreateUpdateZero(eg *xorm.Engine, pvd string, ordData *[]md.OrderI
// 切换免单活动的分佣方案, 如1元购等
optPvd = "fourFree_" + utils.IntToStr(freeOrder.PriceType)
opt = opts[optPvd]
if freeOrder.IsShow == 0 || utils.StrToFloat64(freeOrder.CheckPrice) != v.PaidPrice {
v.State = 4
}
returnMoney = freeOrder.ReturnMoney
if gjson.Get(freeOrder.NewData, "freeze_time").String() != "" {
freezeTime = gjson.Get(freeOrder.NewData, "freeze_time").String()
}
} else {
state = 4
v.State = 4
}
}
@@ -754,6 +770,7 @@ func OrderSaveCreateUpdateZero(eg *xorm.Engine, pvd string, ordData *[]md.OrderI
}
// 插入新订单
newOrd := &model.OrdList{
OldState: state,
ServiceUid: utils.StrToInt(ServiceUid),
WaitSettleAt: int(v.WaitSettleAt),
NumItemId: v.SkuId,
@@ -799,6 +816,8 @@ func OrderSaveCreateUpdateZero(eg *xorm.Engine, pvd string, ordData *[]md.OrderI
IsTikTokTeamOrder: v.IsTikTokTeamOrder,
TikTokTeamCommission: v.TikTokTeamCommission,
TikTokTeamRealCommission: v.TikTokTeamRealCommission,
ReturnMoney: returnMoney,
FreezeTime: utils.StrToInt(freezeTime),
}
if v.State == md.OrderStateSucc && v.ConfirmAt == 0 {
newOrd.ConfirmAt = now


+ 1
- 1
consume/zhios_order_track_create_for_pdd_zero_consume.go View File

@@ -81,7 +81,7 @@ func handleZhiosOrderTrackCreateForPddZeroConsume(msgData []byte) error {
return nil
}
engine := db.DBs[msg.DbName]
err = svc2.OrderSaveCreateUpdate(engine, msg.Pvd, msg.OrderData, msg.Opts, msg.SecondOpts, msg.DbName)
err = svc2.OrderSaveCreateUpdateZero(engine, msg.Pvd, msg.OrderData, msg.Opts, msg.SecondOpts, msg.DbName)
if err != nil {
fmt.Println("order_track_create_for_Pdd_ERR:::::::::::>>>>>>>>>", err.Error())
return err


Loading…
Cancel
Save