新增[评论点赞]

This commit is contained in:
2018-01-10 14:09:41 +08:00
parent cb3a29991e
commit 9e59872966
7 changed files with 76 additions and 6 deletions

View File

@@ -1,6 +1,7 @@
package com.lxyer.controller;
import com.jfinal.aop.Before;
import com.jfinal.aop.Clear;
import com.jfinal.kit.Kv;
import com.jfinal.plugin.activerecord.Page;
import com.lxyer.config.JBean;
@@ -11,12 +12,14 @@ import com.lxyer.service.CommentService;
/**
* Created by JUECHENG at 2018/1/8 23:07.
*/
@Before(LoginInterceptor.class)
public class CommentController extends IController {
CommentService service = CommentService.me;
/**
* 评论列表
*/
@Clear(LoginInterceptor.class)
public void list(){
Kv kv = getParams("contentId");
Page<Comment> page = Comment.dao.findPage(getPn(), getPs(), kv);
@@ -27,6 +30,7 @@ public class CommentController extends IController {
/**
* 评论详情
*/
@Clear(LoginInterceptor.class)
public void info(){
}
@@ -43,16 +47,27 @@ public class CommentController extends IController {
}
/**
* todo:更新状态
* 更新状态
*/
public void update_status(){
}
/**
* todo:评论点赞
* 评论点赞
*/
public void support(){
JBean bean = new JBean(1);
Integer commentId = getParaToInt("commentId");
Integer ok = getParaToInt("ok");
try {
service.support(commentId, ok, getUserId());
} catch (Exception e) {
e.printStackTrace();
bean.setCode(-1, e.getMessage());
}
renderJson(bean);
}
}