聊天:添加屏蔽
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { REDIS_KEY, SDK_37_ADDR, SDK_37_CONST } from '../consts';
|
||||
import { request37 } from './httpUtil';
|
||||
import { nowSeconds } from './timeUtil';
|
||||
import { LoginValidataReturn37 } from '../domain/sdk';
|
||||
import { LoginValidataReturn37, Chat37Params } from '../domain/sdk';
|
||||
import * as crypto from 'crypto'
|
||||
|
||||
// 通用加密方法
|
||||
@@ -43,14 +43,21 @@ export function get37Md5Sign(body: any, key: string) {
|
||||
return getMd5ObjSign(body, '&', (str) => `${str}&${key}`);
|
||||
}
|
||||
|
||||
export async function loginValidate37(clientId: string, pst: string) {
|
||||
export function get37CheckChatMd5Sign(body: Chat37Params, key: string) {
|
||||
let { game_key = '', sid = '', username = '', channel = '', to_username = '', ip = '', time } = body;
|
||||
let str = `${game_key}${sid}${username}${to_username}${channel}${ip}${time}${key}`;
|
||||
console.log('** origin str', body, str);
|
||||
return md5(str);
|
||||
}
|
||||
|
||||
export async function loginValidate37(clientId: string, pst: string, platformAppid: string, childGameId: number) {
|
||||
let result: LoginValidataReturn37 = await request37(SDK_37_ADDR.LOGIN, {
|
||||
clientid: clientId,
|
||||
pid: SDK_37_CONST.PID,
|
||||
pid: platformAppid,
|
||||
game_id: SDK_37_CONST.GAME_ID,
|
||||
pst,
|
||||
time: nowSeconds(),
|
||||
c_game_id: SDK_37_CONST.FX_C_GAME_ID
|
||||
c_game_id: childGameId
|
||||
}, SDK_37_CONST.LOGIN_KEY);
|
||||
if (result && result.code !== 1) {
|
||||
console.error(result.msg);
|
||||
@@ -59,9 +66,10 @@ export async function loginValidate37(clientId: string, pst: string) {
|
||||
return result;
|
||||
}
|
||||
|
||||
export async function loginValidata(channelType: string, clientId: string, pst: string) {
|
||||
export async function loginValidata(channelType: string, params: { clientId: string, pst: string, platformAppid: string, childGameId: number }) {
|
||||
if(channelType == '37') {
|
||||
return await loginValidate37(clientId, pst);
|
||||
let { clientId, pst, platformAppid, childGameId } = params;
|
||||
return await loginValidate37(clientId, pst, platformAppid, childGameId);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
@@ -72,7 +80,6 @@ export function getChannelId(channelType: string, uid: number|string) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
/********* 厚土防沉迷 *********/
|
||||
|
||||
export function getVidObjSign(body: any) {
|
||||
|
||||
Reference in New Issue
Block a user