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

添加不能重复申请功能

parent ce1eea0d
......@@ -225,24 +225,35 @@ router.post('/forumModeratorApply/create', function(req, res, next) {
var fuserId = req.session.mobileForumUser.userId;
var applyMsg = req.body.applyMsg;
if (fuserId && applyMsg) {
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);
forumModeratorApplyService.getForumModeratorApplyByFUserId(fuserId,function(err, doc){
if(err){
console.error(err);
res.json(returnCode.BUSY);
} else {
res.json(_.assign(returnCode.SUCCESS));
}
});
}else if(doc){ //已申请
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 {
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