From 4c8e27b68f6dcc150386e99f2fe2de774cef945b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Fri, 22 Jul 2022 18:53:48 +0800 Subject: [PATCH 1/8] 1 --- controllers/tonglian_callback.go | 1 - 1 file changed, 1 deletion(-) diff --git a/controllers/tonglian_callback.go b/controllers/tonglian_callback.go index e34461869..e9bfa2434 100644 --- a/controllers/tonglian_callback.go +++ b/controllers/tonglian_callback.go @@ -27,7 +27,6 @@ func (c *TongLianController) Msg() { if err == nil { err = financial.OnTLPayCallback(call) } - globals.SugarLogger.Debug("err==============", err) c.Data["json"] = call c.ServeJSON() } else { From dceafe02da72628a962acf113f656499f6aca112 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Fri, 22 Jul 2022 19:29:26 +0800 Subject: [PATCH 2/8] 1 --- business/q_bida/q_bida_server.go | 5 ++++- controllers/tonglian_callback.go | 11 ++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/business/q_bida/q_bida_server.go b/business/q_bida/q_bida_server.go index ce6d926b6..aef54f989 100644 --- a/business/q_bida/q_bida_server.go +++ b/business/q_bida/q_bida_server.go @@ -383,7 +383,10 @@ func CreateOrder2QBiDa(order *model.UserVendorOrder) error { makeOrder.ReceiveName = receiveAddress.ConsigneeName makeOrder.ReceivePhone = receiveAddress.ConsigneeMobile otherId, err := createOtherOrder(makeOrder) - + if err != nil { + globals.SugarLogger.Debug("err==========", err) + } + order.Remark = fmt.Sprintf("%s", err.Error()) order.OtherWayBill = otherId order.OrderStatus = model.OrderStatusWaitPickup order.UpdatedAt = time.Now() diff --git a/controllers/tonglian_callback.go b/controllers/tonglian_callback.go index e9bfa2434..6572311de 100644 --- a/controllers/tonglian_callback.go +++ b/controllers/tonglian_callback.go @@ -24,10 +24,15 @@ func (c *TongLianController) Msg() { if c.Ctx.Input.Method() == http.MethodPost { call, err := api.TLpayAPI.GetCallbackMsg(getUsefulRequest2(c.Ctx)) globals.SugarLogger.Debugf("tonglianapi callback callbackResponse:%s", utils.Format4Output(call, true)) - if err == nil { - err = financial.OnTLPayCallback(call) + if err != nil { + c.Abort("404") + return } - c.Data["json"] = call + if err = financial.OnTLPayCallback(call); err != nil { + c.Abort("404") + return + } + c.Data["json"] = "success" c.ServeJSON() } else { c.Abort("404") From 9a3c23cb93bbc07353205e00a3db14c516b2f331 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Mon, 25 Jul 2022 09:41:42 +0800 Subject: [PATCH 3/8] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=89=93=E5=8D=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/model/user_vendor_order.go | 1 + business/q_bida/q_bida_server.go | 11 ++++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/business/model/user_vendor_order.go b/business/model/user_vendor_order.go index c82ed9e3a..25f2014fa 100644 --- a/business/model/user_vendor_order.go +++ b/business/model/user_vendor_order.go @@ -35,6 +35,7 @@ type UserVendorOrder struct { OrderStatus int `orm:"size(8);column(order_status)" json:"orderType"` // 订单状态(2-待支付,3-支付失败,4-支付成功,10预下单11待取件12运输中15已签收16取消订单17终止揽收,150取消) Img string `orm:"size(1024);column(img)" json:"img"` // 包裹图片 IsForward int `orm:"column(is_forward)" json:"isForward"` // 1否,2是 转寄单 + ErrorMsg string `orm:"size(1024);column(error_msg)" json:"errorMsg"` // 平台错误 } const ( diff --git a/business/q_bida/q_bida_server.go b/business/q_bida/q_bida_server.go index aef54f989..8acb2c4f6 100644 --- a/business/q_bida/q_bida_server.go +++ b/business/q_bida/q_bida_server.go @@ -386,11 +386,12 @@ func CreateOrder2QBiDa(order *model.UserVendorOrder) error { if err != nil { globals.SugarLogger.Debug("err==========", err) } - order.Remark = fmt.Sprintf("%s", err.Error()) + globals.SugarLogger.Debug("otherId==========", otherId) + order.ErrorMsg = err.Error() order.OtherWayBill = otherId order.OrderStatus = model.OrderStatusWaitPickup order.UpdatedAt = time.Now() - if _, err = dao.UpdateEntity(dao.GetDB(), order, "OtherWayBill", "OrderStatus", "UpdatedAt"); err != nil { + if _, err = dao.UpdateEntity(dao.GetDB(), order, "OtherWayBill", "OrderStatus", "UpdatedAt", "ErrorMsg"); err != nil { return err } return nil @@ -527,7 +528,7 @@ func DeleteOrderByLocalId(userId, localId string) (int64, error) { // UpdateOrderStatus 查询所有支付成功的订单 func UpdateOrderStatus() { - globals.SugarLogger.Debug("没十分钟更新一下订单,定时任务") + globals.SugarLogger.Debug("每十分钟更新一下订单,定时任务") // 查询状态值为【4-支付成功,10预下单11待取件12运输中17终止揽收】//2,3 15已签收16取消订单 完成订单 db := dao.GetDB() sql := `SELECT * FROM user_vendor_order WHERE order_status IN (4,10,11,12,17) AND deleted_at = ?` @@ -539,11 +540,11 @@ func UpdateOrderStatus() { } for _, v := range data { - if v.LocalWayBill == v.OtherWayBill { + if v.LocalWayBill == v.OtherWayBill && v.OrderStatus == model.OrderStatusSuccessPay { globals.SugarLogger.Debug("ERROR ", "第三方订单Id写入错误,") continue } - if v.OrderStatus == 2 || v.OrderStatus == 3 || v.OrderStatus == 15 || v.OrderStatus == 16 { + if v.OrderStatus == 2 || v.OrderStatus == 3 || v.OrderStatus == 15 || v.OrderStatus == 16 || v.OrderStatus == 115 { continue } otherOrder, err := QueryOrderDetail(v.Type, v.OtherWayBill) From dd77bc44b98ff49a00f2e586e9afc6397f5e1e46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Mon, 25 Jul 2022 10:09:37 +0800 Subject: [PATCH 4/8] 1 --- business/jxstore/financial/financial.go | 4 ++-- business/q_bida/q_bida_server.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/business/jxstore/financial/financial.go b/business/jxstore/financial/financial.go index 5d81f52bf..cb222f4c2 100644 --- a/business/jxstore/financial/financial.go +++ b/business/jxstore/financial/financial.go @@ -283,7 +283,7 @@ func onTLpayFinished(call *tonglianpayapi.CallBackResult) (err error) { return err } userOrder := model.UserVendorOrder{LocalWayBill: order.OrderID} - if err := dao.GetEntity(db, &userOrder, `LocalWayBill`); err != nil { + if err := dao.GetEntity(db, &userOrder, "LocalWayBill"); err != nil { dao.Rollback(db, txdb) return err } @@ -296,7 +296,7 @@ func onTLpayFinished(call *tonglianpayapi.CallBackResult) (err error) { if call.TrxStatus == tonglianpayapi.TrxStatusSuccess { switch order.OrderType { case model.PayType4Express: - err = q_bida.CreateOrder2QBiDa(&userOrder) + err = q_bida.CreateOrder2QBiDa(&userOrder, order.OrderID) case model.PayType4Member, model.PayType4Recharge: err = OnPayFinished(order) } diff --git a/business/q_bida/q_bida_server.go b/business/q_bida/q_bida_server.go index 8acb2c4f6..536f4bc50 100644 --- a/business/q_bida/q_bida_server.go +++ b/business/q_bida/q_bida_server.go @@ -336,7 +336,7 @@ func QueryUserOrderList(userId string, expressType, orderStatus int, pageNum, pa } // CreateOrder2QBiDa 订单回调成功,且为运费支付时使用该接口 -func CreateOrder2QBiDa(order *model.UserVendorOrder) error { +func CreateOrder2QBiDa(order *model.UserVendorOrder, orderId string) error { //// 加载订单 //order := &model.UserVendorOrder{} //sql := `SELECT * FROM user_vendor_order WHERE local_way_bill = ? ` @@ -384,10 +384,10 @@ func CreateOrder2QBiDa(order *model.UserVendorOrder) error { makeOrder.ReceivePhone = receiveAddress.ConsigneeMobile otherId, err := createOtherOrder(makeOrder) if err != nil { + order.ErrorMsg = err.Error() globals.SugarLogger.Debug("err==========", err) } globals.SugarLogger.Debug("otherId==========", otherId) - order.ErrorMsg = err.Error() order.OtherWayBill = otherId order.OrderStatus = model.OrderStatusWaitPickup order.UpdatedAt = time.Now() From d43159df8e5f55cab2f97d44f6b1dc8ff64f51f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Mon, 25 Jul 2022 10:17:16 +0800 Subject: [PATCH 5/8] 1 --- business/q_bida/q_bida_server.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/business/q_bida/q_bida_server.go b/business/q_bida/q_bida_server.go index 536f4bc50..2ab37a15c 100644 --- a/business/q_bida/q_bida_server.go +++ b/business/q_bida/q_bida_server.go @@ -348,6 +348,8 @@ func CreateOrder2QBiDa(order *model.UserVendorOrder, orderId string) error { // globals.SugarLogger.Debug("Callback Success But Order Status Update Fail ....") // return errors.New("Callback Success But Order Status Update Fail ") //} + globals.SugarLogger.Debug("order==================", order) + globals.SugarLogger.Debug("order==================", order.LocalWayBill) // 创建QBIDA订单 makeOrder := &bida.MakeOrderReq{ From cff7df7bb046ebd541b36a93000ff2bea43e95a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Mon, 25 Jul 2022 10:35:42 +0800 Subject: [PATCH 6/8] 1 --- business/q_bida/q_bida_server.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/business/q_bida/q_bida_server.go b/business/q_bida/q_bida_server.go index 2ab37a15c..8a0720969 100644 --- a/business/q_bida/q_bida_server.go +++ b/business/q_bida/q_bida_server.go @@ -236,7 +236,9 @@ func CancelWayOrder(ctx *jxcontext.Context, userId string, param *bida.CancelOrd OrderNo: order.OtherWayBill, Type: param.Type, } - api.QBiDaAPI.CancelOrder(cancelParma) + if err := api.QBiDaAPI.CancelOrder(cancelParma); err != nil { + return err + } // 暂时考虑余额支付渠道,加载order表判断支付渠道方式 orderWay := &model.Order{OrderID: param.OrderNo, UserID: userId} if err := dao.GetEntity(dao.GetDB(), orderWay, "OrderID", "UserID"); err != nil { From 006fa482c9d5de427b2f45b0c367e481ed2c4164 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Mon, 25 Jul 2022 10:41:26 +0800 Subject: [PATCH 7/8] 1 --- business/q_bida/q_bida_server.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/business/q_bida/q_bida_server.go b/business/q_bida/q_bida_server.go index 8a0720969..5ae0cad30 100644 --- a/business/q_bida/q_bida_server.go +++ b/business/q_bida/q_bida_server.go @@ -236,9 +236,10 @@ func CancelWayOrder(ctx *jxcontext.Context, userId string, param *bida.CancelOrd OrderNo: order.OtherWayBill, Type: param.Type, } - if err := api.QBiDaAPI.CancelOrder(cancelParma); err != nil { - return err - } + api.QBiDaAPI.CancelOrder(cancelParma) + //if err := api.QBiDaAPI.CancelOrder(cancelParma); err != nil { + // return err + //} // 暂时考虑余额支付渠道,加载order表判断支付渠道方式 orderWay := &model.Order{OrderID: param.OrderNo, UserID: userId} if err := dao.GetEntity(dao.GetDB(), orderWay, "OrderID", "UserID"); err != nil { From 273aa3164fbc887ac30837bd4ce1b25410ca498c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Mon, 25 Jul 2022 10:48:09 +0800 Subject: [PATCH 8/8] =?UTF-8?q?=E5=8F=96=E6=B6=88=E8=AE=A2=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/q_bida/q_bida_server.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/business/q_bida/q_bida_server.go b/business/q_bida/q_bida_server.go index 5ae0cad30..8a0720969 100644 --- a/business/q_bida/q_bida_server.go +++ b/business/q_bida/q_bida_server.go @@ -236,10 +236,9 @@ func CancelWayOrder(ctx *jxcontext.Context, userId string, param *bida.CancelOrd OrderNo: order.OtherWayBill, Type: param.Type, } - api.QBiDaAPI.CancelOrder(cancelParma) - //if err := api.QBiDaAPI.CancelOrder(cancelParma); err != nil { - // return err - //} + if err := api.QBiDaAPI.CancelOrder(cancelParma); err != nil { + return err + } // 暂时考虑余额支付渠道,加载order表判断支付渠道方式 orderWay := &model.Order{OrderID: param.OrderNo, UserID: userId} if err := dao.GetEntity(dao.GetDB(), orderWay, "OrderID", "UserID"); err != nil {