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

Method getInfo

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

Source from the content-addressed store, hash-verified

93 })
94 }
95 async getInfo(req, res, next){
96 const sid = req.session.user_id;
97 const qid = req.query.user_id;
98 const user_id = sid || qid;
99 if (!user_id || !Number(user_id)) {
100 // console.log('获取用户信息的参数user_id无效', user_id)
101 res.send({
102 status: 0,
103 type: 'GET_USER_INFO_FAIELD',
104 message: '通过session获取用户信息失败',
105 })
106 return
107 }
108 try{
109 const userinfo = await UserInfoModel.findOne({user_id}, '-_id');
110 res.send(userinfo)
111 }catch(err){
112 console.log('通过session获取用户信息失败', err);
113 res.send({
114 status: 0,
115 type: 'GET_USER_INFO_FAIELD',
116 message: '通过session获取用户信息失败',
117 })
118 }
119 }
120 async getInfoById(req, res, next){
121 const user_id = req.params.user_id;
122 if (!user_id || !Number(user_id)) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected