删除旧充值方式

This commit is contained in:
richboo111
2022-07-25 11:00:56 +08:00
4 changed files with 31 additions and 12 deletions

View File

@@ -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,13 @@ func onTLpayFinished(call *tonglianpayapi.CallBackResult) (err error) {
if call.TrxStatus == tonglianpayapi.TrxStatusSuccess {
switch order.OrderType {
case model.PayType4Express:
<<<<<<< HEAD
err = q_bida.CreateOrder2QBiDa(&userOrder)
=======
err = q_bida.CreateOrder2QBiDa(&userOrder, order.OrderID)
case model.PayType4Member, model.PayType4Recharge:
err = OnPayFinished(order)
>>>>>>> 273aa3164fbc887ac30837bd4ce1b25410ca498c
}
}
return err

View File

@@ -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 (

View File

@@ -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 {
@@ -336,7 +338,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 = ? `
@@ -348,6 +350,8 @@ func CreateOrder2QBiDa(order *model.UserVendorOrder) 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{
@@ -383,11 +387,15 @@ func CreateOrder2QBiDa(order *model.UserVendorOrder) error {
makeOrder.ReceiveName = receiveAddress.ConsigneeName
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.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
@@ -524,7 +532,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 = ?`
@@ -536,11 +544,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)

View File

@@ -24,11 +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
}
globals.SugarLogger.Debug("err==============", err)
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")