.
This commit is contained in:
@@ -7,12 +7,13 @@ import com.lxyer.model.Content;
|
||||
/**
|
||||
* Created by JUECHENG at 2018/1/7 16:49.
|
||||
*/
|
||||
public class ContentService {
|
||||
public class ContentService extends IService {
|
||||
|
||||
public static final ContentService me = new ContentService();
|
||||
|
||||
/**
|
||||
* 帖子保存
|
||||
*
|
||||
* @param content
|
||||
* @param userId
|
||||
*/
|
||||
@@ -21,13 +22,14 @@ public class ContentService {
|
||||
content.setCreateTime(System.currentTimeMillis());
|
||||
content.setUserId(userId);
|
||||
content.save();
|
||||
}else {
|
||||
} else {
|
||||
content.update();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除帖子
|
||||
*
|
||||
* @param contentId
|
||||
* @param userId
|
||||
* @throws Exception
|
||||
@@ -47,6 +49,7 @@ public class ContentService {
|
||||
|
||||
/**
|
||||
* 帖子收藏
|
||||
*
|
||||
* @param contentId
|
||||
* @param userId
|
||||
* @param status
|
||||
@@ -60,14 +63,14 @@ public class ContentService {
|
||||
Kv kv = Kv.by("tid", contentId).set("userId", userId).set("cate", 2);//cate:2收藏
|
||||
ActLog actLog = ActLog.dao.findFirst(kv);
|
||||
|
||||
if (actLog == null){
|
||||
if (actLog == null) {
|
||||
actLog = new ActLog();
|
||||
actLog.setCate(2);
|
||||
actLog.setTid(contentId);
|
||||
actLog.setUserId(userId);
|
||||
actLog.setCreateTime(System.currentTimeMillis());
|
||||
actLog.save();
|
||||
}else if (actLog.getStatus() != status){
|
||||
} else if (actLog.getStatus() != status) {
|
||||
actLog.setStatus(status == 1 ? 1 : -1);
|
||||
actLog.setCreateTime(System.currentTimeMillis());
|
||||
actLog.update();
|
||||
@@ -79,6 +82,7 @@ public class ContentService {
|
||||
|
||||
/**
|
||||
* 帖子置顶/加精
|
||||
*
|
||||
* @param contentId
|
||||
* @param field
|
||||
* @param v
|
||||
|
||||
Reference in New Issue
Block a user