Browse Source

发布文章增加地址 新增文章获取地址

fangqing 4 months ago
parent
commit
1f9413f6c8

+ 1 - 0
ruoyi-generator/src/main/java/com/ruoyi/generator/controller/CommunityArticleController.java

@@ -245,6 +245,7 @@ public class CommunityArticleController extends BaseController {
             return AjaxResult.error("文章不存在或异常!");
         }
 
+        //判断敏感词汇
         boolean isSensitive = SensitiveWordUtil.containsSensitiveWord(communityArticleComment.getContent());
         if (isSensitive) {
             return AjaxResult.error(MessageUtils.message("article.user.comment"));

+ 7 - 0
ruoyi-generator/src/main/java/com/ruoyi/generator/domain/Community/CommunityArticle.java

@@ -178,4 +178,11 @@ public class CommunityArticle implements Serializable {
     @ApiModelProperty("文章是否有合集")
     @TableField(exist = false)
     private Integer noCollection;
+
+    /**
+     * 用户地址
+     */
+    @ApiModelProperty("用户地址")
+    private String address;
+
 }

+ 11 - 0
ruoyi-generator/src/main/java/com/ruoyi/generator/service/CommunityArticleServiceImpl.java

@@ -347,6 +347,17 @@ public class CommunityArticleServiceImpl extends ServiceImpl<CommunityArticleMap
         communityArticle.setRaffle(false);*/
         communityArticle.setUpdateTime(DateUtils.parseDate(DateUtils.getTime()));
         communityArticle.setCreateTime(DateUtils.parseDate(DateUtils.getTime()));
+
+        String address = null;
+        try {
+            address = AddressUtils.getAddress();
+        } catch (ExecutionException e) {
+            throw new RuntimeException(e);
+        } catch (InterruptedException e) {
+            throw new RuntimeException(e);
+        }
+        communityArticle.setAddress(address);
+
         communityArticleMapper.insert(communityArticle);
         //插入标签日志
         List<String> tags = communityArticle.getTags();

+ 7 - 0
ruoyi-generator/src/main/java/com/ruoyi/generator/vo/CommunityArticleVo.java

@@ -149,4 +149,11 @@ public class CommunityArticleVo extends BaseEntity implements Serializable {
      */
     @ApiModelProperty("关注")
     private boolean isCare;
+
+    /**
+     * 用户地址
+     */
+    @ApiModelProperty("用户地址")
+    private String address;
+
 }

+ 1 - 0
ruoyi-generator/src/main/resources/mapper/community/ArticleMapper.xml

@@ -111,6 +111,7 @@
         a.create_time as article_create_time,
         a.update_by as article_update_by,
         a.update_time as article_update_time,
+        a.address,
         a.is_comment,
         a.is_raffle,
         a.is_download,