Commit 3d34dbb6 authored by 陈家荣's avatar 陈家荣

添加不能重复申请功能

parent ce1eea0d
...@@ -225,24 +225,35 @@ router.post('/forumModeratorApply/create', function(req, res, next) { ...@@ -225,24 +225,35 @@ router.post('/forumModeratorApply/create', function(req, res, next) {
var fuserId = req.session.mobileForumUser.userId; var fuserId = req.session.mobileForumUser.userId;
var applyMsg = req.body.applyMsg; var applyMsg = req.body.applyMsg;
if (fuserId && applyMsg) { if (fuserId && applyMsg) {
var conditions = { forumModeratorApplyService.getForumModeratorApplyByFUserId(fuserId,function(err, doc){
ent_code: ent_code, if(err){
forumUser: fuserId console.error(err);
}
var model = {
ent_code: ent_code,
forumUser: fuserId,
applyMsg: applyMsg
};
forumModeratorApplyService.createOrUpdateLimitOperation(conditions, model, function(err, ModeratorApply) {
if (err) {
console.error(err);
res.json(returnCode.BUSY); res.json(returnCode.BUSY);
} else { }else if(doc){ //已申请
res.json(_.assign(returnCode.SUCCESS)); res.json({
} errorcode: 0,
}); errormsg: '已申请,请勿重复申请!'
});
}else{
var conditions = {
ent_code: ent_code,
forumUser: fuserId
}
var model = {
ent_code: ent_code,
forumUser: fuserId,
applyMsg: applyMsg
};
forumModeratorApplyService.createOrUpdateLimitOperation(conditions, model, function(err, ModeratorApply) {
if (err) {
console.error(err);
res.json(returnCode.BUSY);
} else {
res.json(_.assign(returnCode.SUCCESS));
}
});
}
})
} else { } else {
res.json(returnCode.WRONG_PARAM); res.json(returnCode.WRONG_PARAM);
} }
......
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