支付:代金券功能
This commit is contained in:
@@ -175,7 +175,7 @@ export async function settleOrder(order: UserOrderModelType, serverId: number, s
|
||||
let result = await makeOrder(order, sid);
|
||||
if (result.code !== 0) {//结算失败
|
||||
console.log(`支付失败..... ${JSON.stringify(result)}`)
|
||||
reportTAEvent(order.roleId, TA_EVENT.RECHARGE_FAIL, { pay_id: order.localOrderID, charge_id: order.productID, pay_name: order.message, pay_amount: order.price, pay_channel: order.payType })
|
||||
reportTAEvent(order.roleId, TA_EVENT.RECHARGE_FAIL, { pay_id: order.localOrderID, charge_id: order.productID, pay_name: order.message, pay_amount: order.price, pay_channel: order.payType, pay_type: order.useVoucher? "现金": "代金券" })
|
||||
savePayLog(order);
|
||||
return resResult(result);
|
||||
}
|
||||
@@ -188,7 +188,7 @@ export async function settleOrder(order: UserOrderModelType, serverId: number, s
|
||||
//成长任务
|
||||
await checkTask(serverId, order.roleId, sid, TASK_TYPE.ACTIVITY_RMB, { count: order.price });
|
||||
if(order.payType != PAY_TYPE.TEST) {
|
||||
reportTAEvent(order.roleId, TA_EVENT.RECHARGE_SUCCESS, { pay_id: order.localOrderID, charge_id: order.productID, pay_name: order.message, pay_amount: order.price, pay_channel: order.payType })
|
||||
reportTAEvent(order.roleId, TA_EVENT.RECHARGE_SUCCESS, { pay_id: order.localOrderID, charge_id: order.productID, pay_name: order.message, pay_amount: order.price, pay_channel: order.payType, pay_type: order.useVoucher? "现金": "代金券" })
|
||||
reportTAUserSet(TA_USERSET_TYPE.SET_ONCE, order.roleId, { first_pay_time: new Date() });
|
||||
reportTAUserSet(TA_USERSET_TYPE.SET, order.roleId, { last_pay_time: new Date() });
|
||||
reportTAUserSet(TA_USERSET_TYPE.ADD, order.roleId, { total_revenue: order.price });
|
||||
@@ -291,6 +291,23 @@ export async function settleOrderFromRedisPub(message: string) {
|
||||
return true
|
||||
}
|
||||
|
||||
export async function settleOrderFromHandler(localOrderID: string, roleId: string, serverId: number, sid: string ) {
|
||||
|
||||
let order = await UserOrderModel.findOrder(localOrderID);
|
||||
if(!order || order.state != ORDER_STATE.APPLY) {
|
||||
return STATUS.DUPLICATE_ORDER;
|
||||
}
|
||||
if(order.roleId != roleId) {
|
||||
console.log('订单玩家错误');
|
||||
return STATUS.ORDER_STATUS_ERROR;
|
||||
}
|
||||
|
||||
let result = await settleOrder(order, serverId, sid);
|
||||
await UserOrderModel.saveOrderID(order.roleId, order.localOrderID, '', JSON.stringify(result));
|
||||
|
||||
return STATUS.SUCCESS
|
||||
}
|
||||
|
||||
export async function refundOrderFromRedisPub(message: string) {
|
||||
console.log('**********refundOrderFromRedisPub*******')
|
||||
console.log('message: ', message);
|
||||
|
||||
@@ -474,6 +474,15 @@ export function getHonourObject(count: number) {
|
||||
return { id: CURRENCY_BY_TYPE.get(CURRENCY_TYPE.HONOUR), count };
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 获取代金券物品 { id, count }
|
||||
* @param count 元宝数量
|
||||
*/
|
||||
export function getVoucherObject(count: number) {
|
||||
return { id: CURRENCY_BY_TYPE.get(CURRENCY_TYPE.VOUCHER), count };
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 返回 解锁头像/相框
|
||||
* @param conditions 解锁条件
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { pinus } from "pinus";
|
||||
|
||||
export function isDevelopEnv() {
|
||||
const envs = ['development', 'monitor']
|
||||
const envs = ['development', 'monitor', 'alpha', 'dev'];
|
||||
return envs.indexOf(pinus.app.get('env')) != -1;
|
||||
}
|
||||
Reference in New Issue
Block a user