后台:修改白名单

This commit is contained in:
luying
2021-12-08 17:35:23 +08:00
parent fc38485f94
commit 46108f90f2
14 changed files with 56 additions and 43 deletions
+4 -7
View File
@@ -29,7 +29,6 @@ export default class Auth extends Service {
public async deviceLogin(isGuest: boolean, token: string, deviceId: string, platform: string, pkgName: string, serverType: string, getuiCID: string) {
const ctx = this.ctx;
const ip = ctx.request.ip;
let user = await UserModel.findUserByToken(token);
@@ -46,7 +45,7 @@ export default class Auth extends Service {
});
} else {
user = await UserModel.createUser(isGuest, tel, token, platform, pkgName, serverType, deviceId, 0, ip);
user = await UserModel.createUser(isGuest, tel, token, platform, pkgName, serverType, deviceId, 0, ctx.clientIp);
if (getuiCID) {//更新个推cid
await UserModel.updateGetuiCID(tel, getuiCID);
}
@@ -66,7 +65,7 @@ export default class Auth extends Service {
}
} else {
const token = ctx.service.utils.generateStr(256);
user = await UserModel.updateToken(user.tel, token, deviceId, ip);
user = await UserModel.updateToken(user.tel, token, deviceId, ctx.clientIp);
if (getuiCID) {//更新个推cid
await UserModel.updateGetuiCID(user.tel, getuiCID);
}
@@ -188,7 +187,6 @@ export default class Auth extends Service {
*/
public async smsLogin(tel: string, deviceId: string, code: string, platform: string, pkgName: string, serverType: string, getuiCID: string) {
const ctx = this.ctx;
const ip = ctx.request.ip;
// 参数检查
const telVerify = this.checkTelNo(tel);
if (telVerify.status !== 0) {
@@ -218,7 +216,7 @@ export default class Auth extends Service {
// 用户注册登录
const token = ctx.service.utils.generateStr(256);
const user = await UserModel.createOrUpdate(false, tel, token, platform, pkgName, serverType, deviceId, ip);
const user = await UserModel.createOrUpdate(false, tel, token, platform, pkgName, serverType, deviceId, ctx.clientIp);
if (getuiCID) {//更新个推cid
await UserModel.updateGetuiCID(tel, getuiCID);
}
@@ -403,7 +401,6 @@ export default class Auth extends Service {
const { channelType, pst, clientId, deviceId, platform, platformAppid, childGameId, pkgName, serverType, getuiCID } = params;
const ctx = this.ctx;
const ip = ctx.request.ip;
let requestResult = await loginValidata(channelType, { clientId, pst, platformAppid, childGameId });
if(!requestResult) return this.ctx.service.utils.resResult(STATUS.CHANNEL_ERR);
@@ -416,7 +413,7 @@ export default class Auth extends Service {
const token = ctx.service.utils.generateStr(256);
let user = await UserModel.createOrUpdateChannelUser(channelId, channelType, {
...requestResult.data, childGameId, platformAppid
}, token, platform, pkgName, serverType, deviceId, ip);
}, token, platform, pkgName, serverType, deviceId, ctx.clientIp);
if (getuiCID) {//更新个推cid
await UserModel.updateGetuiCIDByChannel(channelId, getuiCID);
}
+1 -6
View File
@@ -29,14 +29,12 @@ export default class Sdk extends Service {
public async pay37Callback(params: PayCallback37Data) {
const { ctx } = this;
const { app } = ctx;
let ip = typeof ctx.header['x-real-ip'] == 'string'? ctx.header['x-real-ip']: ctx.header['x-real-ip'][0];
console.log('*****pay37Callback', ip)
let checkResult = this.check37Sign(params);
if(!checkResult) return ctx.service.utils.resResult(PAY_37_CALLBACK_CODE.MD5_ERR, '');
console.log('*****pay37Callback check sign ok')
if(gameData.whiteip.indexOf(ip) == -1) {
if(gameData.whiteip.indexOf(ctx.clientIp) == -1) {
return ctx.service.utils.resResult(PAY_37_CALLBACK_CODE.IP_LIMIT, '');
}
@@ -95,9 +93,6 @@ export default class Sdk extends Service {
}
public treatRoleOrGuildNameValidate(params: RoleNameCallBackParam|GuildNameCallBackParam|GetGuildInfoByUserParam) {
const { ctx } = this;
let ip = ctx.header['x-real-ip'];
console.log('*****', ip)
if(!params.checkParams()) return SDK_37_TREAT_CODE.WRONG_PARAMS;