sdk:添加获取服务器列表、本地屏蔽词库

This commit is contained in:
luying
2021-11-18 16:06:05 +08:00
parent 18c256ba2b
commit 624aa2b5f1
15 changed files with 59596 additions and 36 deletions
+14 -5
View File
@@ -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, Chat37Params } from '../domain/sdk';
import { LoginValidataReturn37, Chat37Params, GetServerListParam } from '../domain/sdk';
import * as crypto from 'crypto'
// 通用加密方法
@@ -39,21 +39,30 @@ export async function checkMd5Sign(obj: any, treatStr?: (str: string) => string)
/************** 37sdk **************/
export function get37Md5Sign(body: any, key: string) {
export function get37Md5SignA(body: any, key: string) {
return getMd5ObjSign(body, '&', (str) => `${str}&${key}`);
}
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);
let sign = md5(str);
console.log('** origin str', body, str, sign);
return sign;
}
export function get37PostMd5Sign(body: any, key: string) {
export function get37Md5SignB(body: any, key: string) {
return getMd5ObjSign(body, '', (str) => `${str}${key}`);
}
export function get37GetServerMd5Sign(body: GetServerListParam, key: string) {
let { time, appid, gid } = body;
let str = `${time}${appid}${gid}${key}`;
let sign = md5(str);
console.log('** origin str', body, str, sign);
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) {
let result: string = await request37(SDK_37_ADDR.LOGIN, {
clientid: clientId,