MCPcopy Create free account
hub / github.com/bailicangdu/node-elm / getInfoById

Method getInfoById

controller/v2/user.js:120–142  ·  view source on GitHub ↗
(req, res, next)

Source from the content-addressed store, hash-verified

118 }
119 }
120 async getInfoById(req, res, next){
121 const user_id = req.params.user_id;
122 if (!user_id || !Number(user_id)) {
123 console.log('通过ID获取用户信息失败')
124 res.send({
125 status: 0,
126 type: 'GET_USER_INFO_FAIELD',
127 message: '通过用户ID获取用户信息失败',
128 })
129 return
130 }
131 try{
132 const userinfo = await UserInfoModel.findOne({user_id}, '-_id');
133 res.send(userinfo)
134 }catch(err){
135 console.log('通过用户ID获取用户信息失败', err);
136 res.send({
137 status: 0,
138 type: 'GET_USER_INFO_FAIELD',
139 message: '通过用户ID获取用户信息失败',
140 })
141 }
142 }
143 async signout(req, res, next){
144 delete req.session.user_id;
145 res.send({

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected