fangqing 4 долоо хоног өмнө
parent
commit
bba47f9500

+ 11 - 3
ruoyi-generator/src/main/java/com/ruoyi/generator/controller/CommunitySettingsController.java

@@ -18,6 +18,8 @@ import com.ruoyi.generator.vo.CommunityUserPrivacyVo;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.MediaType;
+import org.springframework.http.ResponseEntity;
 import org.springframework.web.bind.annotation.*;
 
 import java.util.List;
@@ -132,23 +134,29 @@ public class CommunitySettingsController {
     @ApiOperation("获取用户协议")
     @GetMapping("/usrProtocol")
     @Anonymous
-    public AjaxResult usrProtocol(Long type) {
+    public ResponseEntity<String> usrProtocol(Long type) {
         if (type == null) {
             type = 1L;
         }
+        String content = "";
         List<CommunityUserProtocol> protocolList = null;
         try {
-              protocolList = communityUserProtocolMapper.selectList(new QueryWrapper<CommunityUserProtocol>()
+            protocolList = communityUserProtocolMapper.selectList(new QueryWrapper<CommunityUserProtocol>()
                     .in("type", type)
                     .and((wrapper) -> {
                         wrapper.ne("is_delete", true).or().isNull("is_delete");
                     }));
+            if (!protocolList.isEmpty()) {
+                content = protocolList.get(0).getContent();
+            }
         } catch (Exception e) {
             System.out.println(e.getMessage());
             throw new ProjectException();
         }
 
-        return AjaxResult.success(protocolList);
+        return ResponseEntity.ok()
+                .contentType(MediaType.TEXT_HTML)
+                .body(content);
     }
 
 }