京西商城订单取消
This commit is contained in:
@@ -159,6 +159,23 @@ func CreateOrder(ctx *jxcontext.Context, jxOrder *JxOrderInfo, addressID int64,
|
||||
return outJxOrder, err
|
||||
}
|
||||
|
||||
// 买家取消(或申请取消)订单
|
||||
func BuyerCancelOrder(ctx *jxcontext.Context, orderID int64) (canceled bool, err error) {
|
||||
order, err := partner.CurOrderManager.LoadOrder(utils.Int64ToStr(orderID), model.VendorIDJX)
|
||||
if err == nil {
|
||||
if order.Status < model.OrderStatusNew {
|
||||
order.Status = model.OrderStatusCanceled
|
||||
order.VendorStatus = utils.Int2Str(model.OrderStatusCanceled)
|
||||
if err = partner.CurOrderManager.UpdateOrderFields(order, []string{model.FieldStatus, "VendorStatus"}); err == nil {
|
||||
canceled = true
|
||||
}
|
||||
} else {
|
||||
err = changeOrderStatus(utils.Int64ToStr(orderID), model.OrderStatusApplyCancel, fmt.Sprintf("用户%s主动取消", ctx.GetUserName()))
|
||||
}
|
||||
}
|
||||
return canceled, err
|
||||
}
|
||||
|
||||
func Pay4Order(ctx *jxcontext.Context, orderID int64, payType int, vendorPayType string) (orderPay *model.OrderPay, err error) {
|
||||
order, err := partner.CurOrderManager.LoadOrder(utils.Int64ToStr(orderID), model.VendorIDJX)
|
||||
if err == nil {
|
||||
@@ -535,6 +552,15 @@ func CancelOrder(ctx *jxcontext.Context, order *model.GoodsOrder, reason string)
|
||||
return err
|
||||
}
|
||||
|
||||
func AgreeOrRefuseCancel(ctx *jxcontext.Context, order *model.GoodsOrder, isAgree bool, reason string) (err error) {
|
||||
if isAgree {
|
||||
err = CancelOrder(ctx, order, reason)
|
||||
} else {
|
||||
err = changeOrderStatus(order.VendorOrderID, model.OrderStatusUndoApplyCancel, reason)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
// todo 消息用异步可能导致丢失,单同步又有重入相关的问题
|
||||
func callNewOrder(order *model.GoodsOrder) (err error) {
|
||||
jxutils.CallMsgHandlerAsync(func() {
|
||||
|
||||
@@ -86,6 +86,10 @@ func (c *PurchaseHandler) GetOrderRealMobile(ctx *jxcontext.Context, order *mode
|
||||
}
|
||||
|
||||
func (c *PurchaseHandler) AgreeOrRefuseCancel(ctx *jxcontext.Context, order *model.GoodsOrder, isAgree bool, reason string) (err error) {
|
||||
if model.IsOrderJXTemp(order) {
|
||||
} else {
|
||||
err = localjx.AgreeOrRefuseCancel(ctx, order, isAgree, reason)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user