Commit d3891854 authored by 陈家荣's avatar 陈家荣

系统消息接口获取用户头像返回

parent c1ec3b80
......@@ -21,7 +21,7 @@ module.exports = function(app) {
//分页用户查询消息
router.get('/message/searchMesage', function(req, res, next) {
//参数
var pageNo = req.query.pageNo || 1,
var pageNo = req.query.pageNo || 0,
pageSize = req.query.pageSize || 10,
from = user.getMobileUser(req),
ent_code = req.session.user.ent_code;
......
......@@ -196,7 +196,6 @@ exports.getMessages= function(conditions, status, pageNo, pageSize, callback) {
var skip = pageNo * pageSize;
var limit = total - skip > pageSize ? pageSize : (total - skip);
limit = parseInt(limit) + parseInt(skip);
//获取分页后的数组
messages = messages.slice(skip,limit);
callback(null,total,messages);
......@@ -249,7 +248,10 @@ exports.updateUserMessageStatus= function(condition,msgID, status,callback) {
//前端根据ID获取
exports.getByIdWithSelect=function(mid,callback){
ForumMessage.findOne({_id:mid}).select('_id fromNickName from title content created status').exec(function(err, doc) {
ForumMessage.findOne({_id:mid}).select('_id fromNickName from title content created status').populate({
path: 'from',
select: 'nickName icon'
}).exec(function(err, doc) {
if (err) {
console.error(err);
callback(err,null);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment