Files
ZYZ/shared/pubUtils/sdkUtil.ts
2021-11-08 17:47:30 +08:00

34 lines
1.0 KiB
TypeScript

import { SDK_37_ADDR, SDK_37_CONST } from '../consts';
import { request37 } from './httpUtil';
import { nowSeconds } from './timeUtil';
import { LoginValidataReturn37 } from '../domain/sdk';
/************** 37sdk **************/
export async function loginValidate37(clientId: string, pst: string) {
let result: LoginValidataReturn37 = await request37(SDK_37_ADDR.LOGIN, {
clientid: clientId,
pid: SDK_37_CONST.PID,
game_id: SDK_37_CONST.GAME_ID,
pst,
time: nowSeconds(),
c_game_id: SDK_37_CONST.FX_C_GAME_ID
}, SDK_37_CONST.LOGIN_KEY);
if (result && result.code !== 1) {
console.error(result.msg);
}
return result;
}
export async function loginValidata(channelType: string, clientId: string, pst: string) {
if(channelType == '37') {
return await loginValidate37(clientId, pst);
} else {
return false;
}
}
export function getChannelId(channelType: string, uid: number|string) {
return `${channelType}: ${uid}`;
}