sdk:37ios支付及退款
This commit is contained in:
@@ -109,9 +109,10 @@ export enum FIRST_GIFT_STATE {
|
||||
export enum PAY_TYPE {
|
||||
TEST = 0, // 测试
|
||||
THREE_SEVEN = 1, // 37
|
||||
WX = 2, // 微信
|
||||
ALI = 3, // 阿里
|
||||
APPLE = 4, // 苹果
|
||||
THREE_SEVEN_IOS = 2, // 37ios
|
||||
WX = 3, // 微信
|
||||
ALI = 4, // 阿里
|
||||
APPLE = 5, // 苹果
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -122,6 +123,8 @@ export enum ORDER_STATE {
|
||||
RESULT_SUCCESS = 1, // 订单成功并结算奖励
|
||||
CHECK_ORDER = 2, // 触发查询订单
|
||||
RESULT_FAIL = 3, // 订单失败
|
||||
CHECK_TO_REFUND = 4, // 触发查询要去退款
|
||||
REFUND = 5, // 已退款
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -27,6 +27,7 @@ export enum SDK_37_CONST {
|
||||
LOGIN_KEY = '3PerD)H!JdTC_pEUnZl8vXKgasj5;7Q~', // 登录KEY
|
||||
PAY_KEY = '0;_Zy.qodXCF8NGQmrOYltk%HgfAz*39', // 重置KEY
|
||||
CHAT_KEY = '3PerD)H!JdTC_pEUnZl8vXKgasj5;7Q~', // 聊天KEY
|
||||
IOS_PID = 'zyz',
|
||||
}
|
||||
|
||||
export enum SDK_TA_CONST {
|
||||
|
||||
@@ -237,6 +237,7 @@ export enum REDIS_KEY {
|
||||
SHOW_LINEUP ="showLineup", // 展示阵容
|
||||
SYS_SERVER ='sysServer', // 全服connector服
|
||||
PAY_CHANNEL = 'pay', // 支付订阅频道
|
||||
REFUND_CHANNEL = 'refund', // 退款频道
|
||||
TREAT_ROLE_CHANNEL = 'treatRole', // 处理玩家账号名频道
|
||||
TREAT_GUILD_CHANNEL = 'treatGuild', // 处理公会账号名频道
|
||||
GUILD_FUND = 'guildFund', // 限时排行
|
||||
|
||||
@@ -520,6 +520,19 @@ export const PAY_37_CALLBACK_CODE = {
|
||||
PAY_ERR: { code: 10, simStr: '充值失败' }
|
||||
}
|
||||
|
||||
export const PAY_IOS_37_CALLBACK_CODE = {
|
||||
SUCCESS: { code: 1, simStr: '发货成功' },
|
||||
FAIL: { code: -1, simStr: '发货失败' },
|
||||
USER_NOT_FOUND: { code: -2, simStr: '用户不存在' },
|
||||
ROLE_NOT_FOUND: { code: -3, simStr: '角色不存在' },
|
||||
IP_LIMIT: { code: -4, simStr: 'IP限制' },
|
||||
MD5_ERR: { code: -5, simStr: 'md5校验错误' },
|
||||
ORDER_DUPLICATE: { code: -6, simStr: '订单号重复' },
|
||||
TIME_IS_EXPIRED: { code: -7, simStr: 'time时间已过期' },
|
||||
SERVER_IS_BUSY: { code: -8, simStr: '游戏服务器繁忙' },
|
||||
WRONG_PARAM: { code: -9, simStr: '参数错误' },
|
||||
}
|
||||
|
||||
export const SDK_37_TREAT_CODE = {
|
||||
SUCCESS: { code: 1, simStr: '成功' },
|
||||
WRONG_PARAMS: { code: -1, simStr: '参数错误' },
|
||||
@@ -528,4 +541,13 @@ export const SDK_37_TREAT_CODE = {
|
||||
ERR: { code: -4, simStr: '其他错误' },
|
||||
USER_NOT_FOUND: { code: -5, simStr: '用户不存在' },
|
||||
ROLE_NOT_FOUND: { code: -6, simStr: '角色不存在' },
|
||||
}
|
||||
|
||||
export const SDK_37_REFUND_CODE = {
|
||||
SUCCESS: { code: 1, simStr: '扣除元宝成功' },
|
||||
FAIL: { code: -1, simStr: '扣除元宝失败' },
|
||||
ROLE_NOT_FOUND: { code: -2, simStr: '角色不存在' },
|
||||
IP_LIMIT: { code: -3, simStr: 'IP限制' },
|
||||
MD5_ERR: { code: -4, simStr: 'md5校验错误' },
|
||||
TIME_IS_EXPIRED: { code: -6, simStr: 'time时间已过期' },
|
||||
}
|
||||
@@ -68,6 +68,22 @@ export default class UserOrder extends BaseModel {
|
||||
return result;
|
||||
}
|
||||
|
||||
// 准备退款
|
||||
public static async startRefund(roleId: string, localOrderID: string, message: string = '') {
|
||||
let result: UserOrderModelType = await UserOrderModel.findOneAndUpdate({ roleId, localOrderID },
|
||||
{ $set: { state: ORDER_STATE.CHECK_TO_REFUND, message } },
|
||||
{ new: true }).lean(true);
|
||||
return result;
|
||||
}
|
||||
|
||||
// 退款
|
||||
public static async refund(roleId: string, localOrderID: string, message: string = '') {
|
||||
let result: UserOrderModelType = await UserOrderModel.findOneAndUpdate({ roleId, localOrderID },
|
||||
{ $set: { state: ORDER_STATE.REFUND, message } },
|
||||
{ new: true }).lean(true);
|
||||
return result;
|
||||
}
|
||||
|
||||
//查询成功订单详情
|
||||
public static async findSuccessOrderByProductID(productID: string, roleId: string, activityId: number) {
|
||||
let result: UserOrderModelType[] = await UserOrderModel.find({ productID, roleId, activityId, state: ORDER_STATE.RESULT_SUCCESS }).lean(true);
|
||||
|
||||
@@ -338,4 +338,44 @@ export class GetServerListParam {
|
||||
checkParams() {
|
||||
return this.appid != undefined && this.gid != undefined && this.time != undefined && this.sign != undefined
|
||||
}
|
||||
}
|
||||
|
||||
export class IOSRefundParam {
|
||||
appid: string; // pid, 平台id
|
||||
uid: number; // 用户id
|
||||
game_id: number; // 发行游戏id
|
||||
fx_c_game_id: string; // 子游戏id
|
||||
sid: number; // 游戏服id
|
||||
actor_id: string; // 角色id
|
||||
order_id: string; // 37订单号
|
||||
order_no: string; // 本地订单号
|
||||
money: number; // 金额
|
||||
game_coin: number; // 元宝数
|
||||
product_id: string; // 商品id
|
||||
time: number; // 请求时间
|
||||
ext: string; // 扩展参数
|
||||
sign: string; // 签名
|
||||
|
||||
constructor(data: any) {
|
||||
this.appid = data.appid;
|
||||
this.uid = data.uid;
|
||||
this.game_id = data.game_id;
|
||||
this.fx_c_game_id = data.fx_c_game_id;
|
||||
this.sid = data.sid;
|
||||
this.actor_id = data.actor_id;
|
||||
this.order_id = data.order_id;
|
||||
this.order_no = data.order_no;
|
||||
this.money = data.money;
|
||||
this.game_coin = data.game_coin;
|
||||
this.product_id = data.product_id;
|
||||
this.time = data.time;
|
||||
this.ext = data.ext;
|
||||
this.sign = data.sign;
|
||||
}
|
||||
|
||||
getBody() {
|
||||
let { appid, uid, game_id, sid, actor_id, order_id, order_no, money, game_coin, product_id, time, ext } = this;
|
||||
return { appid, uid, game_id, sid, actor_id, order_id, order_no, money, game_coin, product_id, time, ext }
|
||||
}
|
||||
|
||||
}
|
||||
@@ -63,7 +63,14 @@ export function get37GetServerMd5Sign(body: GetServerListParam, key: string) {
|
||||
return sign
|
||||
}
|
||||
|
||||
export async function loginValidate37(clientId: string, pst: string, platformAppid: string = SDK_37_CONST.PID, childGameId: number = SDK_37_CONST.FX_C_GAME_ID) {
|
||||
export async function loginValidate37(clientId: string, pst: string, platform: string, platformAppid: string, childGameId: number = SDK_37_CONST.FX_C_GAME_ID) {
|
||||
if(!platformAppid) {
|
||||
if(platform == 'android') {
|
||||
platformAppid = SDK_37_CONST.PID;
|
||||
} else if(platform == 'ios' ){
|
||||
platformAppid = SDK_37_CONST.IOS_PID;
|
||||
}
|
||||
}
|
||||
let result: string = await request37(SDK_37_ADDR.LOGIN, {
|
||||
clientid: clientId,
|
||||
pid: platformAppid,
|
||||
@@ -86,10 +93,10 @@ export async function loginValidate37(clientId: string, pst: string, platformApp
|
||||
return json;
|
||||
}
|
||||
|
||||
export async function loginValidata(channelType: string, params: { clientId: string, pst: string, platformAppid: string, childGameId: number }) {
|
||||
export async function loginValidata(channelType: string, params: { clientId: string, pst: string, platform: string, platformAppid: string, childGameId: number }) {
|
||||
if(channelType == '37') {
|
||||
let { clientId, pst, platformAppid, childGameId } = params;
|
||||
return await loginValidate37(clientId, pst, platformAppid, childGameId);
|
||||
let { clientId, pst, platform, platformAppid, childGameId } = params;
|
||||
return await loginValidate37(clientId, pst, platform, platformAppid, childGameId);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user