sdk:修复登录接口

This commit is contained in:
luying
2021-11-12 16:10:20 +08:00
parent 3a45e8457f
commit c62cd91a10
9 changed files with 38 additions and 29 deletions

View File

@@ -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 }) {