Merge remote-tracking branch 'origin/mark' into yonghui
This commit is contained in:
@@ -256,8 +256,8 @@ func GenOrderNo(ctx *jxcontext.Context) (orderNo int64) {
|
||||
|
||||
func GenRefundID(order *model.GoodsOrder) (refundID int64) {
|
||||
const suffix = 100000
|
||||
orderID := utils.Str2Int64(order.VendorOrderID) * suffix
|
||||
orderID += int64(time.Now().Sub(order.OrderFinishedAt) / time.Minute)
|
||||
refundID = utils.Str2Int64(order.VendorOrderID) * suffix
|
||||
refundID += int64(time.Now().Sub(order.OrderFinishedAt) / time.Minute)
|
||||
return refundID
|
||||
}
|
||||
|
||||
@@ -514,9 +514,11 @@ func CancelOrder(ctx *jxcontext.Context, order *model.GoodsOrder, reason string)
|
||||
if orderPay.Status == model.PayStatusYes {
|
||||
refundID := utils.Int64ToStr(GenRefundID(order))
|
||||
orderPayRefund, err2 := refundOrderByWX(ctx, orderPay, refundID)
|
||||
if err = err2; err == nil {
|
||||
if err2 == nil {
|
||||
dao.WrapAddIDCULDEntity(orderPayRefund, ctx.GetUserName())
|
||||
errList.AddErr(dao.CreateEntity(dao.GetDB(), orderPay))
|
||||
errList.AddErr(dao.CreateEntity(dao.GetDB(), orderPayRefund))
|
||||
} else {
|
||||
errList.AddErr(err2)
|
||||
}
|
||||
} else {
|
||||
orderPay.Status = model.PayStatusCanceled
|
||||
@@ -524,7 +526,9 @@ func CancelOrder(ctx *jxcontext.Context, order *model.GoodsOrder, reason string)
|
||||
errList.AddErr(err2)
|
||||
}
|
||||
}
|
||||
errList.AddErr(changeOrderStatus(order.VendorOrderID, model.OrderStatusCanceled, reason))
|
||||
if errList.GetErrListAsOne() == nil {
|
||||
errList.AddErr(changeOrderStatus(order.VendorOrderID, model.OrderStatusCanceled, reason))
|
||||
}
|
||||
err = errList.GetErrListAsOne()
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user