优化收藏

This commit is contained in:
flower 2019-01-28 23:16:21 +08:00
parent 89479763d5
commit cd5c601a36
3 changed files with 11 additions and 2 deletions

View File

@ -168,8 +168,11 @@ public class CmsUserController {
@ResponseBody
public AjaxResult addCollectionquestion(String questionId) {
SysUser sysUser = ShiroUtils.getSysUser();
examUserCollectionQuestionService.insertSelectiveBySelf(Integer.parseInt(questionId),sysUser);
AjaxResult success = AjaxResult.success("插入成功");
int i = examUserCollectionQuestionService.insertSelectiveBySelf(Integer.parseInt(questionId), sysUser);
AjaxResult success = AjaxResult.success("收藏成功");
if(i==0){
success = AjaxResult.success("已收藏,无法重复收藏");
}
return success;
}

View File

@ -105,6 +105,8 @@ document.write(unescape("%3Cspan id='cnzz_stat_icon_30088308'%3E%3C/span%3E%3Csc
success: function (result) {
if (result.code != web_status.SUCCESS) {
layer.msg(result.msg, {icon: 2});
}else{
layer.msg(result.msg, {icon: 1});
}
}
});

View File

@ -52,6 +52,10 @@ public class ExamUserCollectionQuestionServiceImpl extends AbstractBaseServiceIm
ExamUserCollectionQuestion examUserCollectionQuestion = new ExamUserCollectionQuestion();
examUserCollectionQuestion.setExamQuestionId( questionId );
examUserCollectionQuestion.setVipUserId( sysUser.getUserId().intValue() );
List<ExamUserCollectionQuestion> db = examUserCollectionQuestionMapper.select(examUserCollectionQuestion);
if(db.size()>0){
return 0;
}
examUserCollectionQuestion.setCreateBy( sysUser.getLoginName() );
examUserCollectionQuestion.setCreateDate( new Date() );
examUserCollectionQuestion.setDelFlag( "0" );