yuan_yi
2 years ago
2 changed files with 34 additions and 0 deletions
@ -0,0 +1,26 @@ |
|||
'use strict'; |
|||
|
|||
async function message (ctx) { |
|||
try { |
|||
const { models } = ctx.fs.dc; |
|||
const { userId } = ctx.params |
|||
|
|||
let userRes = await models.User.findAll({ |
|||
attributes: { exclude: ['password'] }, |
|||
where: { |
|||
id: { $in: userId.split(',') }, |
|||
} |
|||
}) |
|||
|
|||
ctx.status = 200; |
|||
ctx.body = userRes |
|||
} catch (error) { |
|||
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); |
|||
ctx.status = 400; |
|||
ctx.body = {} |
|||
} |
|||
} |
|||
|
|||
module.exports = { |
|||
message |
|||
}; |
@ -0,0 +1,8 @@ |
|||
'use strict'; |
|||
|
|||
const user = require('../../controllers/user'); |
|||
|
|||
module.exports = function (app, router, opts) { |
|||
app.fs.api.logAttr['GET/user/:userId/message'] = { content: '用户信息', visible: true }; |
|||
router.get('/user/:userId/message', user.message); |
|||
}; |
Loading…
Reference in new issue