diff --git a/src/services/system.ts b/src/services/system.ts index e3bff42..85d734e 100644 --- a/src/services/system.ts +++ b/src/services/system.ts @@ -45,10 +45,10 @@ const system = { }, /* 发往网关的请求 */ // 登陆 - login: async (userId: string, userPhone: string) => { + login: async (userId: string, userPhone: string, api: string) => { const res = await fetchLocalApi( 'login', - { userId, userPhone }, + { userId, userPhone, api }, { silent: true }, ); sendSocketMessage(`login:${userPhone}`); diff --git a/src/services/user.ts b/src/services/user.ts index 3f3d1cd..11f8a5b 100644 --- a/src/services/user.ts +++ b/src/services/user.ts @@ -34,16 +34,23 @@ export async function login(account: string, password: string) { return errorReponse('该账号没有访问权限'); } - const systemLoginRes = await system.login(res.data.id, res.data.phone); + const companyInfoRes = await fetchApi( + 'company/queryFrontDeskCompanyById', + { id: userData.companyId }, + { silent: true }, + ); + if (!isReqSuccess(companyInfoRes)) { + return companyInfoRes; + } + const systemLoginRes = await system.login( + res.data.id, + res.data.phone, + companyInfoRes.data?.company?.IpfsApi || '', + ); if (!isReqSuccess(systemLoginRes)) { return errorReponse('本地网管通讯失败'); } - // const companyInfoRes = await fetchApi('company/queryFrontDeskCompanyById', { id: userData.companyId }, { silent: true }); - // if (!isReqSuccess(companyInfoRes)) { - // return companyInfoRes; - // } - // const { data: { company: { SoftwareVersion } = {} } = {} } = companyInfoRes; // 角色判断