From 3a3e2891ca7b36a53076fb3625cc106b9f7caaa1 Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Wed, 20 Dec 2023 16:53:15 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/db/db_order.go | 7 +++++++ app/db/model/ord_list.go | 1 + consume/zhios_order_hjy.go | 4 ++-- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/app/db/db_order.go b/app/db/db_order.go index 4f11f47..a1bf315 100644 --- a/app/db/db_order.go +++ b/app/db/db_order.go @@ -177,6 +177,13 @@ func OrderListByPvdOid(sess *xorm.Session, oid string) (*model.OrdList, error) { } return &o, nil } +func OrderListByhjyOid(sess *xorm.Session, oid string) (*model.OrdList, error) { + var o model.OrdList + if has, err := sess.Where("hjy_oid=?", oid).Get(&o); err != nil || !has { + return nil, logx.Error(err) + } + return &o, nil +} func OrderListByUpdateOrd(sess *xorm.Session, ord *model.OrdList) (bool, error) { if row, err := sess.Where("pvd_oid = ? ", ord.PvdOid).AllCols().Update(ord); row == 0 || err != nil { return false, logx.Warn(err) diff --git a/app/db/model/ord_list.go b/app/db/model/ord_list.go index 2558f09..44c6754 100644 --- a/app/db/model/ord_list.go +++ b/app/db/model/ord_list.go @@ -56,5 +56,6 @@ type OrdList struct { FastSuccess int `xorm:"not null default 0 INT(1)" json:"fast_success"` BuckleCommission string `json:"buckle_commission" xorm:"DECIMAL(20,2)"` OrderFormType int `xorm:"not null default 0 INT(1)" json:"order_form_type"` + HjyOid int `xorm:"not null default 0 INT(11)" json:"hjy_oid"` TikTokTeamRealCommission string `json:"tik_tok_team_real_commission" xorm:"not null default 0.00 comment('') DECIMAL(20,8)"` } diff --git a/consume/zhios_order_hjy.go b/consume/zhios_order_hjy.go index 103e28e..8571148 100644 --- a/consume/zhios_order_hjy.go +++ b/consume/zhios_order_hjy.go @@ -140,7 +140,7 @@ func handleZhiosOrderHjy(msg []byte) error { defer sess.Close() sess.Begin() - ordData, err := db.OrderListByPvdOid(sess, canalMsg.Oid) + ordData, err := db.OrderListByhjyOid(sess, canalMsg.Oid) if err != nil || ordData == nil { return nil } @@ -163,7 +163,7 @@ func handleZhiosOrderHjy(msg []byte) error { sess.Commit() return nil } - isSettle, settleTime := GetHjyOrderCommission(eg, canalMsg.Mid, utils.Int64ToStr(ordData.OrdId)) + isSettle, settleTime := GetHjyOrderCommission(eg, canalMsg.Mid, utils.IntToStr(ordData.HjyOid)) if isSettle == "1" { ordData.State = 5 ordData.SettleAt = int(utils.TimeStdParseUnix(settleTime))