From 6b9e40718bf1bc427f9a4185fd1d72a991ebfcad Mon Sep 17 00:00:00 2001 From: "gao.zhiyuan" Date: Wed, 30 Nov 2022 14:23:32 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=AF=E4=BD=BF=E7=94=A8=E9=A1=B9=E4=BC=81?= =?UTF-8?q?=20token=20=E7=99=BB=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/app/lib/controllers/auth/index.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/api/app/lib/controllers/auth/index.js b/api/app/lib/controllers/auth/index.js index 7b6c00f..022e665 100644 --- a/api/app/lib/controllers/auth/index.js +++ b/api/app/lib/controllers/auth/index.js @@ -10,9 +10,18 @@ async function login (ctx, next) { const models = ctx.fs.dc.models; const params = ctx.request.body; - const emisLoginRes = await ctx.app.fs.emisRequest.post('login', { - data: params - }) + let emisLoginRes = null + if (params.username && params.password) { + emisLoginRes = await ctx.app.fs.emisRequest.post('login', { + data: { ...params, code: 'HR' } + }) + } else if (params.token) { + emisLoginRes = await ctx.app.fs.emisRequest.get('user-info', { + query: { + token: params.token, code: 'HR' + } + }) + } if (!emisLoginRes) { throw "无此用户,请使用正确的登录信息"