feat(活动): 37通用对接接口

This commit is contained in:
luying
2023-04-04 18:53:02 +08:00
parent 16eace7d4c
commit ad808162d7
9 changed files with 252 additions and 30 deletions
+1
View File
@@ -28,6 +28,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
SEND_GIFT_KEY = '5f6d68715?44f6~b7a16_77881=994241', // 发奖励KEY
IOS_PID = 'zyz',
BACKEND_KEY = 'zyzbackend2022',
PUBLIC_GIFT_KEY = 'zyzbackend202304',
+3 -1
View File
@@ -783,7 +783,7 @@ export const BACKEND_37_CODE = {
LOGIN_FAIL: { code: -5, simStr: '登录失败' },
}
export const SDK_37_SEND_GIFT_RESULT_CODE = {
export const SDK_37_ACTIVITY_CODE = {
SUCCESS: { code: 1, simStr: '成功' },
WRONG_PARAMS: { code: 10001, simStr: '参数异常' },
ROLE_NOT_FOUND: { code: 10002, simStr: '角色不存在' },
@@ -795,4 +795,6 @@ export const SDK_37_SEND_GIFT_RESULT_CODE = {
GIFT_CODE_HAS_EXPIRED: { code: 20005, simStr: '礼包码已过期' },
GIFT_CODE_NOT_START: { code: 20006, simStr: '礼包码暂未开启' },
GIFT_CHANNEL_ERR: { code: 20007, simStr: '礼包不可在此渠道使用' },
TIME_IS_EXPIRED: { code: 20008, simStr: '时间戳已过期' },
SERVER_NOT_FOUND: { code: 20009, simStr: '服务器未找到' },
}
+1 -1
View File
@@ -350,7 +350,7 @@ export default class Role extends BaseModel {
hasPushMsg: boolean;
public static async findAllByUid(uid: number, getters = false, virtuals = true) {
const role: RoleType[] = await RoleModel.find({ 'userInfo.uid': uid }).select('roleId roleName serverId head frame spine heads frames spines lv updatedAt').lean({ getters, virtuals });
const role: RoleType[] = await RoleModel.find({ 'userInfo.uid': uid }).select('roleId roleName serverId head frame spine heads frames spines lv updatedAt createTime').lean({ getters, virtuals });
return role;
}
+1 -1
View File
@@ -246,7 +246,7 @@ export default class User extends BaseModel {
}
public static async findUserByChannel(channelId: string) {
const user: UserType = await UserModel.findOne({ channelId }).select('uid token serverType auth tel userCode pkgName ip deviceId channelId').lean({ getters: true });
const user: UserType = await UserModel.findOne({ channelId }).select('uid token serverType auth tel userCode pkgName ip deviceId channelId channelInfo').lean({ getters: true });
return user;
}
+50
View File
@@ -448,4 +448,54 @@ export class SendGiftCodeParam {
let { user_id, server_id, role_id, gift_id, order_id, time } = this;
return { user_id, server_id, role_id, gift_id, order_id, time }
}
}
export class GetRoleByServerParam {
user_id: number; // 用户id
server_id: number; // 区服id
time: number; // 时间戳
sign: string; // 37给的签名
constructor(data: any) {
this.user_id = data.user_id;
this.server_id = data.server_id;
this.time = data.time;
this.sign = data.sign;
}
checkParams() {
return this.user_id != undefined && this.server_id != undefined && this.time != undefined && this.sign != undefined
}
}
export class GetRoleByUidParam {
user_id: number; // 用户id
time: number; // 时间戳
sign: string; // 37给的签名
constructor(data: any) {
this.user_id = data.user_id;
this.time = data.time;
this.sign = data.sign;
}
checkParams() {
return this.user_id != undefined && this.time != undefined && this.sign != undefined
}
}
export class GetServerParam {
server_id: number; // 用户id
time: number; // 时间戳
sign: string; // 37给的签名
constructor(data: any) {
this.server_id = data.server_id;
this.time = data.time;
this.sign = data.sign;
}
checkParams() {
return this.server_id != undefined && this.time != undefined && this.sign != undefined
}
}