|
@ -104,21 +104,20 @@ router.get(APIv2.Sessions.Session,function(req,res){
|
|
})
|
|
})
|
|
|
|
|
|
/**
|
|
/**
|
|
* 最近会话列表。
|
|
|
|
|
|
* 判断会话是否存在。
|
|
*
|
|
*
|
|
* URL:
|
|
* URL:
|
|
* /sessions/recent?user_id=abc&date_span=7
|
|
|
|
|
|
* /sessions/isExist?session_id=abc
|
|
*/
|
|
*/
|
|
router.get(APIv2.Sessions.RecentSessions, function (req, res) {
|
|
|
|
ControllerUtil.checkRequestQueryParams(req, ['user_id', 'date_span']);
|
|
|
|
|
|
|
|
let userId = req.query.user_id;
|
|
|
|
let dateSpan = req.query.date_span;
|
|
|
|
|
|
|
|
|
|
router.get(APIv2.Sessions.IsExist, function (req, res) {
|
|
|
|
let sessionId = req.query.session_id;
|
|
|
|
if (!sessionId) {
|
|
|
|
throw {httpStatus: 406, message: 'Missing sessionId.'}
|
|
|
|
}
|
|
let sessions = new Sessions();
|
|
let sessions = new Sessions();
|
|
ControllerUtil.regModelEventHandler(sessions, res);
|
|
ControllerUtil.regModelEventHandler(sessions, res);
|
|
|
|
|
|
sessions.getRecentSessions(userId, dateSpan);
|
|
|
|
|
|
sessions.isExist(sessionId);
|
|
});
|
|
});
|
|
|
|
|
|
/**
|
|
/**
|