订单:回调信息修改
This commit is contained in:
@@ -36,6 +36,8 @@ export default class UserOrder extends BaseModel {
|
||||
paramStr: string; // 订单参数
|
||||
@prop({ required: true })
|
||||
useVoucher: boolean; // 使用代金券
|
||||
@prop({ required: true })
|
||||
callbackMsg: string; // 信息
|
||||
|
||||
|
||||
//保存平台订单号
|
||||
@@ -47,41 +49,41 @@ export default class UserOrder extends BaseModel {
|
||||
}
|
||||
|
||||
//校验订单
|
||||
public static async check(roleId: string, localOrderID: string, message: string = '') {
|
||||
public static async check(roleId: string, localOrderID: string, callbackMsg: string = '') {
|
||||
let result: UserOrderModelType = await UserOrderModel.findOneAndUpdate({ roleId, localOrderID, state: { $ne: ORDER_STATE.RESULT_SUCCESS } },
|
||||
{ $set: { state: ORDER_STATE.CHECK_ORDER, message } },
|
||||
{ $set: { state: ORDER_STATE.CHECK_ORDER, callbackMsg } },
|
||||
{ new: true }).lean(true);
|
||||
return result;
|
||||
}
|
||||
|
||||
//订单支付失败
|
||||
public static async fail(roleId: string, localOrderID: string, message: string = '') {
|
||||
public static async fail(roleId: string, localOrderID: string, callbackMsg: string = '') {
|
||||
let result: UserOrderModelType = await UserOrderModel.findOneAndUpdate({ roleId, localOrderID, state: { $ne: ORDER_STATE.RESULT_SUCCESS } },
|
||||
{ $set: { state: ORDER_STATE.RESULT_FAIL, message } },
|
||||
{ $set: { state: ORDER_STATE.RESULT_FAIL, callbackMsg } },
|
||||
{ new: true }).lean(true);
|
||||
return result;
|
||||
}
|
||||
|
||||
//订单支付成功
|
||||
public static async success(roleId: string, localOrderID: string, rewardResult: string, message: string = '') {
|
||||
public static async success(roleId: string, localOrderID: string, rewardResult: string, callbackMsg: string = '') {
|
||||
let result: UserOrderModelType = await UserOrderModel.findOneAndUpdate({ roleId, localOrderID, state: { $ne: ORDER_STATE.RESULT_SUCCESS } },
|
||||
{ $set: { state: ORDER_STATE.RESULT_SUCCESS, rewardResult, message } },
|
||||
{ $set: { state: ORDER_STATE.RESULT_SUCCESS, rewardResult, callbackMsg } },
|
||||
{ new: true }).lean(true);
|
||||
return result;
|
||||
}
|
||||
|
||||
// 准备退款
|
||||
public static async startRefund(roleId: string, localOrderID: string, message: string = '') {
|
||||
public static async startRefund(roleId: string, localOrderID: string, callbackMsg: string = '') {
|
||||
let result: UserOrderModelType = await UserOrderModel.findOneAndUpdate({ roleId, localOrderID },
|
||||
{ $set: { state: ORDER_STATE.CHECK_TO_REFUND, message } },
|
||||
{ $set: { state: ORDER_STATE.CHECK_TO_REFUND, callbackMsg } },
|
||||
{ new: true }).lean(true);
|
||||
return result;
|
||||
}
|
||||
|
||||
// 退款
|
||||
public static async refund(roleId: string, localOrderID: string, message: string = '') {
|
||||
public static async refund(roleId: string, localOrderID: string, callbackMsg: string = '') {
|
||||
let result: UserOrderModelType = await UserOrderModel.findOneAndUpdate({ roleId, localOrderID },
|
||||
{ $set: { state: ORDER_STATE.REFUND, message } },
|
||||
{ $set: { state: ORDER_STATE.REFUND, callbackMsg } },
|
||||
{ new: true }).lean(true);
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user