Commit 8efcbaec authored by strong's avatar strong

Merge commit 'b30b1406'

# Conflicts:
#	app/models/forumThread.js
parents 2741cdb0 b30b1406
......@@ -158,4 +158,31 @@ router.post('/member/:mid/update', function(req, res, next) {
}else{
res.json(returnCode.WRONG_PARAM);
}
});
//获取用户收藏记录
router.get('/member/:uid/favors', function(req, res, next) {
var uid = req.params.uid || null;
var ent_code = req.session.user.ent_code;
if (uid) {
var condition = {
_id : uid,
ent_code : ent_code
}
forumUserService.getFavors(condition,function(err,result){
if(err){
console.log(err);
res.json(returnCode.BUSY);
}else{
var rs ={data : result};
res.json(_.assign(rs, returnCode.SUCCESS));
}
});
} else {
console.error('params error');
res.json({
result: false,
err: 'params error'
});
}
});
\ No newline at end of file
This diff is collapsed.
......@@ -50,6 +50,10 @@ var ForumInfoSchema = new Schema({
type: Object,
default:{}
},
favor_by: [{ //被收藏用户列表
type: Schema.Types.ObjectId,
ref: 'ForumUser'
}],
created: {
type: Date,
required: true,
......
......@@ -126,6 +126,10 @@ var ForumThreadSchema = new Schema({
new_recommend_time:{//推荐时间
type: Date
},
favor_by: [{ //被收藏用户列表
type: Schema.Types.ObjectId,
ref: 'ForumUser'
}],
created: {
type: Date,
required: true,
......
......@@ -56,6 +56,22 @@ var ForumUserSchema = new Schema({
type: Schema.Types.ObjectId,
ref: 'ForumHonorTitle'
}],
favor_by: [{ //被收藏用户列表
type: Schema.Types.ObjectId,
ref: 'ForumUser'
}],
favor_users: [{ //收藏用户列表
type: Schema.Types.ObjectId,
ref: 'ForumUser'
}],
favor_infos: [{ //收藏板块列表
type: Schema.Types.ObjectId,
ref: 'ForumInfo'
}],
favor_threads: [{ //收藏文章列表
type: Schema.Types.ObjectId,
ref: 'ForumThread'
}],
created: {
type: Date,
required: true,
......
......@@ -39,6 +39,18 @@ exports.updateInfoById=function(fid,entity,callback){
});
};
//根据ID更新论坛板块2
exports.updateByIdWithOptions=function(condition, entity, options, callback){
ForumInfo.findOneAndUpdate(condition, entity, options, function(err, result) {
if (err) {
console.error(err);
callback(err, null);
} else {
callback(null, null);
}
});
};
//根据ID更新论坛组
exports.deleteInfoById=function(fid,callback){
ForumInfo.remove({ _id: fid},function(err,result){
......
......@@ -1241,4 +1241,16 @@ exports.updateThread = function(condition, entity, callback) {
callback(null, doc);
}
});
};
//根据ID更新文章2
exports.updateByIdWithOptions = function(condition, entity, options, callback) {
ForumThread.findOneAndUpdate(condition, entity, options, function(err, result) {
if (err) {
console.error(err);
callback(err, null);
} else {
callback(null, null);
}
});
};
\ No newline at end of file
This diff is collapsed.
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