|
@@ -205,8 +205,14 @@ public class NewsController {
|
|
|
Wrappers.<NewsRelation>query().lambda()
|
|
|
.eq(NewsRelation::getNewsId,newsReplyDto.getId())
|
|
|
.eq(NewsRelation::getUserId,StpUtil.getLoginIdAsLong()));
|
|
|
- if (newsReplyDto.getReplyContent() == null || newsRelation == null) {
|
|
|
- throw new Exception("参数异常");
|
|
|
+ if (newsRelation == null) {
|
|
|
+ newsRelation = new NewsRelation();
|
|
|
+ newsRelation.setNewsId(newsReplyDto.getId());
|
|
|
+ newsRelation.setUserId(StpUtil.getLoginIdAsLong());
|
|
|
+ newsRelation.setReadMark(1);
|
|
|
+ newsRelation.setReadDate(LocalDateTime.now());
|
|
|
+ newsRelation.setReplyContent(newsReplyDto.getReplyContent());
|
|
|
+ return R.ok(newsRelationService.save(newsRelation));
|
|
|
}
|
|
|
|
|
|
if (newsRelation.getReadMark()==null || newsRelation.getReadMark() == 0) {
|