支付:代金券功能
This commit is contained in:
@@ -37,6 +37,7 @@ export const CONSUME_TYPE = {
|
||||
AP: 15, // 回复体力道具
|
||||
DICE: 16, // 骰子
|
||||
DRAWING: 17, // 图纸
|
||||
VOUCHER: 18, // 代金券
|
||||
};
|
||||
|
||||
export enum ROLE_TERAPH {
|
||||
@@ -147,6 +148,7 @@ const itid_array = [
|
||||
{ id: 60, name: '衣服天晶石', table: 'jewel' },
|
||||
{ id: 61, name: '头饰天晶石', table: 'jewel' },
|
||||
{ id: 62, name: '行具天晶石', table: 'jewel' },
|
||||
{ id: 63, name: '代金券', table: 'item', type: CONSUME_TYPE.VOUCHER }
|
||||
];
|
||||
|
||||
export const ITID = new Map<number, { id: number, name: string, table: string, type?: number, isCurrency?: boolean, equipJewel?: number }>();
|
||||
@@ -167,7 +169,8 @@ export const CURRENCY_TYPE = {
|
||||
DUNGEON: "dungeon",
|
||||
NORMAL_DICE: "normalDice",
|
||||
SPECIAL_DICE: "specialDice",
|
||||
KING_EXP: 'kingExp'
|
||||
KING_EXP: 'kingExp',
|
||||
VOUCHER: 'voucher',
|
||||
}
|
||||
|
||||
const currencyArr = [
|
||||
@@ -183,7 +186,8 @@ const currencyArr = [
|
||||
{ "gid": 40007, "name": "秘境币", "type": CURRENCY_TYPE.DUNGEON },
|
||||
{ "gid": 72011, "name": "普通骰子", "type": CURRENCY_TYPE.NORMAL_DICE },
|
||||
{ "gid": 72021, "name": "天机骰子", "type": CURRENCY_TYPE.SPECIAL_DICE },
|
||||
{ "gid": 72030, "name": "主公经验", "type": CURRENCY_TYPE.KING_EXP }
|
||||
{ "gid": 72030, "name": "主公经验", "type": CURRENCY_TYPE.KING_EXP },
|
||||
{ "gid": 81000, "name": "代金券", "type": CURRENCY_TYPE.VOUCHER}
|
||||
];
|
||||
export const CURRENCY = new Map<number, { gid: number, name: string, type: string }>();
|
||||
export const CURRENCY_BY_TYPE = new Map<string, number>();
|
||||
|
||||
@@ -1011,6 +1011,7 @@ export enum ITEM_CHANGE_REASON {
|
||||
RESET_TALENT = 147, // 洗点
|
||||
RECEIVE_TOWER_BOX = 148, // 领取镇念塔节点奖励
|
||||
ACT_DAILY_COIN_RECEIVE_BOX = 149, // 招财进宝领取宝箱
|
||||
USE_VOUCHER = 150, // 使用代金券
|
||||
}
|
||||
|
||||
export enum TA_EVENT {
|
||||
|
||||
@@ -522,7 +522,9 @@ export const STATUS = {
|
||||
CHANNEL_INFO_NOT_FOUND: { code: 70014, simStr: '未找到玩家渠道数据' },
|
||||
ACTIVITY_TASK_NOT_COMPLETE: { code: 70015, simStr: '条件未达成' },
|
||||
ORDER_CANNOT_BUY: { code: 70016, simStr: '该礼包不可购买' },
|
||||
|
||||
VOUCHER_NOT_ENOUGH: { code: 70017, simStr: '代金券不足' },
|
||||
ORDER_STATUS_ERROR: { code: 70018, simStr: '订单状态错误' },
|
||||
PAY_NOT_OPEN: { code: 70019, simStr: '支付功能暂未开启' }
|
||||
}
|
||||
|
||||
export const PAY_37_CALLBACK_CODE = {
|
||||
|
||||
@@ -112,6 +112,9 @@ export default class UserLog extends BaseModel {
|
||||
@prop({ required: false })
|
||||
orderStatus: number; // 订单状态
|
||||
|
||||
@prop({ required: false })
|
||||
useVoucher: boolean; // 是否使用代金券
|
||||
|
||||
// 道具相关
|
||||
@prop({ required: false })
|
||||
itemId: number; // 道具id
|
||||
|
||||
@@ -34,6 +34,8 @@ export default class UserOrder extends BaseModel {
|
||||
activityId: number; // 活动ID
|
||||
@prop({ required: true })
|
||||
paramStr: string; // 订单参数
|
||||
@prop({ required: true })
|
||||
useVoucher: boolean; // 使用代金券
|
||||
|
||||
|
||||
//保存平台订单号
|
||||
@@ -122,9 +124,9 @@ export default class UserOrder extends BaseModel {
|
||||
|
||||
|
||||
//新增订单
|
||||
public static async applyOrder(serverId: number, roleId: string, productID: string, localOrderID: string, orderID: string, price: number, payType: number, activityId: number, paramStr: string, message: string) {
|
||||
public static async applyOrder(serverId: number, roleId: string, productID: string, localOrderID: string, orderID: string, price: number, payType: number, activityId: number, paramStr: string, message: string, useVoucher: boolean) {
|
||||
let result: UserOrderModelType = await UserOrderModel.findOneAndUpdate({ serverId, roleId, productID, localOrderID, orderID, payType, activityId },
|
||||
{ $set: { price, state: ORDER_STATE.APPLY, message, paramStr: paramStr ? paramStr : '' } },
|
||||
{ $set: { price, state: ORDER_STATE.APPLY, message, paramStr: paramStr ? paramStr : '', useVoucher } },
|
||||
{ upsert: true, new: true }).lean(true);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -33,6 +33,8 @@ export interface DicServerConst {
|
||||
readonly DEBUG_TIME: number;
|
||||
// 是否检查屏蔽词
|
||||
readonly CHECK_WORD: number;
|
||||
// 是否可以支付
|
||||
readonly CAN_PAY: number;
|
||||
}
|
||||
|
||||
export const dicServerConst: DicServerConst = {} as DicServerConst;
|
||||
|
||||
@@ -57,10 +57,10 @@ export async function savePayLog(order: UserOrderModelType) {
|
||||
try {
|
||||
let role = await RoleModel.findByRoleId(order.roleId, 'userInfo roleId roleName serverId');
|
||||
let params = getParamByRole(role);
|
||||
let { productID, message: productName, price, localOrderID, orderID, state } = order;
|
||||
let { productID, message: productName, price, localOrderID, orderID, state, useVoucher } = order;
|
||||
let dicRmb = gameData.rmb.get(productID);
|
||||
let isYuanbao = dicRmb.type == ACTIVITY_TYPE.YUAN_BAO_SHOP;
|
||||
await UserLogModel.createRecord({ type: LOG_TYPE.PAY, ...params, productID, productName, price, isYuanbao, localOrderID, orderID, totalPay: role.totalPay, orderStatus: state });
|
||||
await UserLogModel.createRecord({ type: LOG_TYPE.PAY, ...params, productID, productName, price, isYuanbao, localOrderID, orderID, totalPay: role.totalPay, orderStatus: state, useVoucher });
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
|
||||
@@ -157,4 +157,8 @@ export function isDebugPay() {
|
||||
|
||||
export function isCheckWord(isDevelop = false) {
|
||||
return gameData.serverConst.CHECK_WORD === 1 && !isDevelop;
|
||||
}
|
||||
|
||||
export function canPay() {
|
||||
return gameData.serverConst.CAN_PAY === 1;
|
||||
}
|
||||
@@ -18,5 +18,6 @@
|
||||
],
|
||||
"DEBUG_PAY": 0,
|
||||
"DEBUG_TIME": 1,
|
||||
"CHECK_WORD": 1
|
||||
"CHECK_WORD": 1,
|
||||
"CAN_PAY": 1
|
||||
}
|
||||
Reference in New Issue
Block a user