sdk:修复登录接口
This commit is contained in:
@@ -609,7 +609,7 @@ export class RoleHandler {
|
||||
let role = await RoleModel.findByRoleId(roleId);
|
||||
let user = await UserModel.findUserByUid(role.userInfo.uid);
|
||||
|
||||
reportTAEvent(roleId, 'test', user.ip);
|
||||
reportTAEvent(user.userCode, role.serverId, 'test', user.ip);
|
||||
|
||||
return resResult(STATUS.SUCCESS);
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ export async function checkGuildName(guildCode: string, serverId: number, name:
|
||||
let body = new CheckGuild37Params(guildCode, serverId, 1, name);
|
||||
nameResult = await request37Post(SDK_37_ADDR.CHECK_UNION, body, SDK_37_CONST.CHAT_KEY);
|
||||
}
|
||||
if(notice != undefined) {
|
||||
if(notice) {
|
||||
let body = new CheckGuild37Params(guildCode, serverId, 2, notice);
|
||||
noticeResult = await request37Post(SDK_37_ADDR.CHECK_UNION, body, SDK_37_CONST.CHAT_KEY);
|
||||
}
|
||||
@@ -83,7 +83,7 @@ export async function checkGuildName(guildCode: string, serverId: number, name:
|
||||
export async function treatRoleName(roleId: string) {
|
||||
let role = await RoleModel.findByRoleId(roleId);
|
||||
if(role && role.sdkMark) { // 有设置标记的情况下
|
||||
let newName = roleId;
|
||||
let newName = "默认玩家名";
|
||||
// 新名字上传
|
||||
await checkRoleName(roleId, newName, role);
|
||||
// 改名字
|
||||
@@ -112,7 +112,7 @@ export async function treatGuildName(content: string) {
|
||||
let guild = await GuildModel.findByCode(params.code, params.serverId);
|
||||
if(guild && guild.sdkMark) { // 有设置标记的情况下
|
||||
if(params.type == 1) { // 公会名
|
||||
let newName = guild.code;
|
||||
let newName = "默认公会名";
|
||||
// 新名字上传
|
||||
await checkGuildName(params.code, params.serverId, newName, undefined);
|
||||
await GuildModel.updateInfo(params.code, { name: newName, sdkMark: false });
|
||||
@@ -154,11 +154,12 @@ export function connectThinkingData(app: Application) {
|
||||
app.set('ta', ta);
|
||||
}
|
||||
|
||||
export function reportTAEvent(roleId: string, eventName: string, ip: string) {
|
||||
export function reportTAEvent(userCode: string, serverId: number, eventName: string, ip: string) {
|
||||
console.log(userCode, serverId)
|
||||
let ta = pinus.app.get('ta');
|
||||
let event = {
|
||||
// 账号 ID (可选)
|
||||
accountId: roleId,
|
||||
accountId: `${userCode}`,
|
||||
// 访客 ID (可选),账号 ID 和访客 ID 不可以都为空
|
||||
distinctId: "",
|
||||
// 事件名称 (必填)
|
||||
@@ -169,13 +170,10 @@ export function reportTAEvent(roleId: string, eventName: string, ip: string) {
|
||||
ip: ip,
|
||||
// 事件属性 (可选)
|
||||
properties: {
|
||||
prop_date: new Date(),
|
||||
prop_double: 134.1,
|
||||
prop_string: "hello world",
|
||||
prop_int: 67
|
||||
serverId
|
||||
},
|
||||
callback() {
|
||||
console.log('*****测试接入事件')
|
||||
callback(err) {
|
||||
console.log('*****测试接入事件', err)
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
@@ -803,7 +803,7 @@ export default class GMUsers extends Service {
|
||||
console.log(dicWar.previousGk)
|
||||
if(dicWar.previousGk && preGkIndex == -1) {
|
||||
let _dicWar = gameData.war.get(dicWar.previousGk);
|
||||
newWarStar.push({ id: _dicWar.war_id, warType: _dicWar.warType, star: 3, stars: [1,1,1] });
|
||||
newWarStar.push({ id: _dicWar.war_id, warType: _dicWar.warType, star: 0, stars: [] });
|
||||
}
|
||||
if(insertParams.length > 0) {
|
||||
await RScriptRecordModel.insertScripts(roleId, insertParams);
|
||||
|
||||
@@ -745,4 +745,4 @@ export enum THINKING_DATA_MODE_LIST {
|
||||
BATCH = 'batch',
|
||||
LOGGING = 'logging',
|
||||
}
|
||||
export const THINKING_DATA_MODE = THINKING_DATA_MODE_LIST.DEBUG;
|
||||
export let THINKING_DATA_MODE = THINKING_DATA_MODE_LIST.BATCH;
|
||||
@@ -59,7 +59,7 @@ export function loadWar() {
|
||||
arr.forEach(o => {
|
||||
o.fixReward = parseFixReward(o.fixReward);
|
||||
o.conditionReward = parseConditionReward(o.conditionReward);
|
||||
o.parseRandomReward = parseRandomReward(o.parseRandomReward);
|
||||
o.parseRandomReward = parseRandomReward(o.RandomReward||o.randomReward);
|
||||
o.detailUIBg = parseDetailUIBg(o.detailUIBg);
|
||||
o.jackpotReward = parseJackpotReward(o.jackpotReward);
|
||||
o.teammateReward = parseFixReward(o.teammateReward);
|
||||
|
||||
@@ -20,7 +20,7 @@ export async function httpRequest(url: string, method: string, body: any, header
|
||||
url,
|
||||
method,
|
||||
headers,
|
||||
body,
|
||||
body: JSON.stringify(body),
|
||||
timeout,
|
||||
JSON: true
|
||||
}
|
||||
@@ -152,7 +152,7 @@ export async function vidHttpRequest(addr: string, body: any) {
|
||||
export async function request37(url: string, body: any, key: string) {
|
||||
body['sign'] = get37Md5Sign(body, key);
|
||||
|
||||
let result = await httpRequest(url, HTTP_METHOD.POST, body, {});
|
||||
let result = await httpRequestForm(url, HTTP_METHOD.POST, body, 1000);
|
||||
console.log('******result', result)
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -54,8 +54,8 @@ export function get37PostMd5Sign(body: any, key: string) {
|
||||
return getMd5ObjSign(body, '', (str) => `${str}${key}`);
|
||||
}
|
||||
|
||||
export async function loginValidate37(clientId: string, pst: string, platformAppid: string, childGameId: number) {
|
||||
let result: LoginValidataReturn37 = await request37(SDK_37_ADDR.LOGIN, {
|
||||
export async function loginValidate37(clientId: string, pst: string, platformAppid: string = SDK_37_CONST.PID, childGameId: number = SDK_37_CONST.FX_C_GAME_ID) {
|
||||
let result: string = await request37(SDK_37_ADDR.LOGIN, {
|
||||
clientid: clientId,
|
||||
pid: platformAppid,
|
||||
game_id: SDK_37_CONST.GAME_ID,
|
||||
@@ -63,11 +63,18 @@ export async function loginValidate37(clientId: string, pst: string, platformApp
|
||||
time: nowSeconds(),
|
||||
c_game_id: childGameId
|
||||
}, SDK_37_CONST.LOGIN_KEY);
|
||||
if (result && result.code !== 1) {
|
||||
console.error(result.msg);
|
||||
|
||||
let json: LoginValidataReturn37;
|
||||
try {
|
||||
json = JSON.parse(result);
|
||||
}catch(e) {
|
||||
console.log(e);
|
||||
}
|
||||
if (json && json.code !== 1) {
|
||||
console.error(json.msg);
|
||||
}
|
||||
|
||||
return result;
|
||||
return json;
|
||||
}
|
||||
|
||||
export async function loginValidata(channelType: string, params: { clientId: string, pst: string, platformAppid: string, childGameId: number }) {
|
||||
|
||||
@@ -398,6 +398,7 @@ export default class Auth extends Service {
|
||||
|
||||
let requestResult = await loginValidata(channelType, { clientId, pst, platformAppid, childGameId });
|
||||
if(!requestResult) return this.ctx.service.utils.resResult(STATUS.CHANNEL_ERR);
|
||||
|
||||
if(requestResult.code != 1) {
|
||||
return this.ctx.service.utils.resResult(STATUS.VALIDATE_ERR, requestResult);
|
||||
}
|
||||
|
||||
@@ -100,10 +100,10 @@ export default class Sdk extends Service {
|
||||
return SDK_37_TREAT_CODE.TIME_IS_EXPIRED;
|
||||
}
|
||||
|
||||
if(gameData.whiteip.indexOf(ip) == -1) {
|
||||
console.error('用户名或军团名违规处理, ip限制', ip);
|
||||
return SDK_37_TREAT_CODE.ERR;
|
||||
}
|
||||
// if(gameData.whiteip.indexOf(ip) == -1) {
|
||||
// console.error('用户名或军团名违规处理, ip限制', ip);
|
||||
// return SDK_37_TREAT_CODE.ERR;
|
||||
// }
|
||||
return SDK_37_TREAT_CODE.SUCCESS
|
||||
}
|
||||
|
||||
@@ -121,13 +121,13 @@ export default class Sdk extends Service {
|
||||
let user = await UserModel.findUserByChannel(channelId);
|
||||
if(!user) {
|
||||
console.error('用户名违规处理, 未找到玩家账号', channelId);
|
||||
return SDK_37_TREAT_CODE.ERR.code;
|
||||
return SDK_37_TREAT_CODE.SUCCESS.code;
|
||||
}
|
||||
|
||||
let role = await RoleModel.findByUidAndSetMark(user.uid, params.sid);
|
||||
if(!role) {
|
||||
console.error('用户名违规处理, 未找到玩家角色', user.uid, params.sid);
|
||||
return SDK_37_TREAT_CODE.ERR.code;
|
||||
return SDK_37_TREAT_CODE.SUCCESS.code;
|
||||
}
|
||||
|
||||
if(params.actor.trim() != role.roleName.trim() || params.actor_id.trim() != role.roleId.trim()) {
|
||||
@@ -156,7 +156,10 @@ export default class Sdk extends Service {
|
||||
|
||||
// 1. 标记军团违规
|
||||
let guild = await GuildModel.findByCodeAndSetMark(params.guildid, params.sid);
|
||||
if(!guild) return SDK_37_TREAT_CODE.ERR.code;
|
||||
if(!guild) {
|
||||
console.log('未找到军团', params.guildid);
|
||||
return SDK_37_TREAT_CODE.SUCCESS.code;
|
||||
}
|
||||
|
||||
// 2. redis发布
|
||||
let redisClient: RedisClient = app.context.redisClient;
|
||||
|
||||
Reference in New Issue
Block a user