|
@ -70,7 +70,7 @@ async function login (ctx, next) { |
|
|
|
|
|
|
|
|
await ctx.redis.hmset(emisLoginRes.token, { |
|
|
await ctx.redis.hmset(emisLoginRes.token, { |
|
|
expired: moment().add(1, 'day'), |
|
|
expired: moment().add(1, 'day'), |
|
|
userInfo:JSON.stringify(emisLoginRes) |
|
|
userInfo: JSON.stringify(emisLoginRes) |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
ctx.status = 200; |
|
|
ctx.status = 200; |
|
@ -93,13 +93,19 @@ async function login (ctx, next) { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
async function complement (ctx) { |
|
|
async function loginWithToken (ctx) { |
|
|
try { |
|
|
try { |
|
|
const { models } = ctx.fs.dc; |
|
|
const { models } = ctx.fs.dc; |
|
|
|
|
|
const { token } = ctx.request.body |
|
|
ctx.status = 20; |
|
|
|
|
|
|
|
|
const emisLoginRes = await ctx.app.fs.emisRequest.get('user-info', { |
|
|
|
|
|
query: { token, code: 'POMS' } |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
ctx.status = 200; |
|
|
|
|
|
ctx.body = {} |
|
|
} catch (error) { |
|
|
} catch (error) { |
|
|
ctx.fs.logger.error(`path: ${ctx.path}, error: error`); |
|
|
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); |
|
|
ctx.status = 400; |
|
|
ctx.status = 400; |
|
|
ctx.body = { |
|
|
ctx.body = { |
|
|
message: typeof error == 'string' ? error : undefined |
|
|
message: typeof error == 'string' ? error : undefined |
|
@ -130,4 +136,5 @@ async function logout (ctx) { |
|
|
module.exports = { |
|
|
module.exports = { |
|
|
login, |
|
|
login, |
|
|
logout, |
|
|
logout, |
|
|
|
|
|
loginWithToken, |
|
|
}; |
|
|
}; |