Bläddra i källkod

修改为配置类的

yuhongqi 4 veckor sedan
förälder
incheckning
35afcc1b70

+ 8 - 0
fs-service/src/main/java/com/fs/config/cloud/CloudHostProper.java

@@ -31,6 +31,14 @@ public class CloudHostProper {
     @Value("${cloud_host.volcengineUrl}")
     public String volcengineUrl;
 
+    //评论内容URL替换-源地址
+    @Value("${cloud_host.commentContentReplaceFrom:}")
+    public String commentContentReplaceFrom;
+
+    //评论内容URL替换-目标地址
+    @Value("${cloud_host.commentContentReplaceTo:}")
+    public String commentContentReplaceTo;
+
 //    @Value("${cloud_host.accessKey}")
 //    public String accessKey;
 //

+ 7 - 8
fs-service/src/main/resources/mapper/course/FsUserCourseMapper.xml

@@ -407,14 +407,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         AND c.is_show = 1
         AND c.is_private = 0
 
-        <choose>
-            <when test="q.yxxTag != null and q.yxxTag == 1">
-                AND c.cate_id = (select cate_id from fs_user_course_category WHERE cate_name like '%央广原乡行%' AND cate_type = 1 limit 1)
-            </when>
-            <otherwise>
-                AND c.cate_id != (select cate_id from fs_user_course_category WHERE cate_name like '%央广原乡行%' AND cate_type = 1 limit 1)
-            </otherwise>
-        </choose>
+
+        <if test="q.yxxTag != null and q.yxxTag == 1">
+            AND c.cate_id = (select cate_id from fs_user_course_category WHERE cate_name like '%央广原乡行%' AND cate_type = 1 limit 1)
+        </if>
+        <if test="q.yxxTag == null">
+            AND c.cate_id != (select cate_id from fs_user_course_category WHERE cate_name like '%央广原乡行%' AND cate_type = 1 limit 1)
+        </if>
           AND EXISTS (
                 SELECT 1 FROM fs_user_course_category pc2
                 WHERE pc2.cate_id = c.cate_id AND pc2.cate_type = 1 AND pc2.is_del = 0

+ 3 - 1
fs-user-app/src/main/java/com/fs/app/controller/CourseCommentController.java

@@ -247,7 +247,9 @@ public class CourseCommentController extends AppBaseController
             FsUserCourseComment fsUserCourseComment = new FsUserCourseComment();
             fsUserCourseComment.setUserId(Long.parseLong(getUserId()));
             fsUserCourseComment.setCourseId(courseId);
-            content = content.replace("https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com", "http://bjzmkytcpv.ylrzcloud.com");
+            if (StringUtils.isNotEmpty(cloudHostProper.getCommentContentReplaceFrom())) {
+                content = content.replace(cloudHostProper.getCommentContentReplaceFrom(), cloudHostProper.getCommentContentReplaceTo());
+            }
             fsUserCourseComment.setContent(content);
             fsUserCourseComment.setType(type);
             if (type == 1) {

+ 3 - 1
fs-user-app/src/main/java/com/fs/app/controller/store/CourseCommentScrmController.java

@@ -226,7 +226,9 @@ public class CourseCommentScrmController extends AppBaseController
             FsUserCourseComment fsUserCourseComment = new FsUserCourseComment();
             fsUserCourseComment.setUserId(Long.parseLong(getUserId()));
             fsUserCourseComment.setCourseId(courseId);
-            content = content.replace("https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com", "http://bjzmkytcpv.ylrzcloud.com");
+            if (StringUtils.isNotEmpty(cloudHostProper.getCommentContentReplaceFrom())) {
+                content = content.replace(cloudHostProper.getCommentContentReplaceFrom(), cloudHostProper.getCommentContentReplaceTo());
+            }
             fsUserCourseComment.setContent(content);
             fsUserCourseComment.setType(type);
             if (type == 1) {