sdk: 登录
This commit is contained in:
34
shared/pubUtils/sdkUtil.ts
Normal file
34
shared/pubUtils/sdkUtil.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
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}`;
|
||||
}
|
||||
Reference in New Issue
Block a user