Преглед на файлове

update content-api CommentUser

reghao преди 9 месеца
родител
ревизия
8fa059a262

+ 1 - 1
content/content-api/src/main/java/cn/reghao/tnb/content/api/dto/comment/CommentUser.java

@@ -10,7 +10,7 @@ import lombok.Setter;
 @Setter
 @Getter
 public class CommentUser {
-    private Long userId;
+    private String userId;
     private String name;
     private String avatar;
     private Boolean author;

+ 1 - 1
content/content-service/src/main/java/cn/reghao/tnb/content/app/vod/model/po/UserComment.java

@@ -43,7 +43,7 @@ public class UserComment extends BaseObject<String> {
         this.liked = false;
         this.location = commentData.getLocation();
         this.publishAt = commentData.getCreateAt();
-        this.publishBy = commentData.getUser().getUserId();
+        this.publishBy = Long.parseLong(commentData.getUser().getUserId());
     }
 
     public UserComment(long commentId, CommentData commentData, long parentId) {

+ 6 - 1
content/content-service/src/main/java/cn/reghao/tnb/content/app/vod/service/CommentService.java

@@ -2,6 +2,7 @@ package cn.reghao.tnb.content.app.vod.service;
 
 import cn.reghao.jutil.jdk.db.PageList;
 import cn.reghao.jutil.tool.id.SnowFlake;
+import cn.reghao.tnb.account.api.iface.AccountQuery;
 import cn.reghao.tnb.common.auth.UserContext;
 import cn.reghao.tnb.content.api.dto.comment.CommentData;
 import cn.reghao.tnb.content.app.vod.db.mapper.VideoPostMapper;
@@ -26,8 +27,10 @@ import java.util.stream.Collectors;
  */
 @Service
 public class CommentService {
-    @DubboReference(check = false)
+    @DubboReference(check = false, retries = 0, timeout = 60_000)
     private UserService userService;
+    @DubboReference(check = false, retries = 0, timeout = 60_000)
+    private AccountQuery accountQuery;
 
     private final SnowFlake idGenerator;
     private final UserCommentMongo userCommentMongo;
@@ -42,6 +45,8 @@ public class CommentService {
     public void saveComment(CommentSbtDto commentSbtDto) {
         long commentId = idGenerator.nextId();
         CommentData commentData = commentSbtDto.getNewComment();
+        String userIdStr = commentData.getUser().getUserId();
+        long userId = accountQuery.getUserIdLong(userIdStr);
         String postId = commentData.getPostId();
 
         CommentData parent = commentSbtDto.getParent();