reghao 3 mēneši atpakaļ
vecāks
revīzija
6494cece84

+ 1 - 2
account/account-service/src/main/java/cn/reghao/tnb/account/app/controller/AccountRecordController.java

@@ -8,7 +8,6 @@ import cn.reghao.tnb.account.app.service.LoginAttemptService;
 import io.swagger.v3.oas.annotations.tags.Tag;
 import io.swagger.v3.oas.annotations.Operation;
 import org.springframework.http.MediaType;
-import org.springframework.ui.ModelMap;
 import org.springframework.web.bind.annotation.*;
 
 import java.util.List;
@@ -34,7 +33,7 @@ public class AccountRecordController {
 
 	@Operation(summary = "获取登入日志列表", description = "N")
 	@GetMapping("/record/list")
-	public String list(ModelMap model) {
+	public String list() {
 		List<LoginRecordVo> list = loginAttemptService.getActiveLogin();
 		return WebResult.success(list);
 	}

+ 4 - 3
file/file-service/src/main/java/cn/reghao/tnb/file/app/service/FileService.java

@@ -13,6 +13,7 @@ import cn.reghao.tnb.file.app.model.po.LocalFile;
 import cn.reghao.tnb.file.app.model.vo.FileQuery;
 import cn.reghao.tnb.file.app.model.vo.LocalFileInfo;
 import cn.reghao.tnb.file.app.model.vo.LocalFileUrl;
+import cn.reghao.tnb.oss.api.constant.ObjectType;
 import jakarta.annotation.PostConstruct;
 import jakarta.servlet.http.HttpServletResponse;
 import lombok.extern.slf4j.Slf4j;
@@ -40,7 +41,7 @@ public class FileService {
     private final int bufSize = 1024*1024*8;
     private final ByteConverter byteConverter;
     private final LocalFileMapper localFileMapper;
-    private final int pageSize = 10;
+    private final int pageSize = 12;
     private final String baseDir;
 
     public FileService(ByteConverter byteConverter, LocalFileMapper localFileMapper, AppProperties appProperties) {
@@ -157,7 +158,7 @@ public class FileService {
         String destPath = String.format("%s/%s", baseDir, contentId);
         File savedFile = saveFile(file.getInputStream(), destPath);
         String contentType = "image/jpeg";
-        int fileType = 1001;
+        int fileType = ObjectType.Image.getValue();
         String sha256sum = DigestUtil.sha256sum(savedFile.getAbsolutePath());
         FileQuery fileQuery = new FileQuery.Builder()
                 .sha256sum(sha256sum)
@@ -216,7 +217,7 @@ public class FileService {
 
     public PageList<LocalFileUrl> getImageFiles(int pageNumber) {
         long owner = UserContext.getUserId();
-        int fileType = 1001;
+        int fileType = ObjectType.Image.getValue();
         FileQuery fileQuery = new FileQuery.Builder()
                 .fileType(fileType)
                 .owner(owner)

+ 6 - 15
message/message-service/src/main/java/cn/reghao/tnb/message/app/soa/controller/TnbLogController.java

@@ -6,9 +6,7 @@ import cn.reghao.tnb.message.app.soa.service.LoggingService;
 import cn.reghao.tnb.message.app.soa.service.RuntimeLogService;
 import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.tags.Tag;
-import org.springframework.data.domain.Page;
 import org.springframework.http.MediaType;
-import org.springframework.ui.Model;
 import org.springframework.web.bind.annotation.*;
 
 import java.text.ParseException;
@@ -42,21 +40,14 @@ public class TnbLogController {
 
     @Operation(summary = "访问日志页面")
     @GetMapping("/accesslog")
-    public String accessLogPage(Model model) {
-        try {
-            model.addAttribute("page", Page.empty());
-            return "/admin/tnb/sys/accesslog";
-        } catch (Exception e) {
-            model.addAttribute("message", e.getMessage());
-        }
-        return "/admin/errmsg";
+    public String accessLogPage() {
+        return WebResult.success();
     }
 
     @Operation(summary = "运行日志页面", description = "N")
     @GetMapping("/runtimelog")
     public String rtLogPage(@RequestParam(value = "app", required = false) String app,
-                            @RequestParam(value = "host", required = false) String host,
-                            Model model) {
+                            @RequestParam(value = "host", required = false) String host) {
         List<SelectOption> appList;
         List<SelectOption> hostList;
         Map<String, List<String>> map = runtimeLogService.getAppHostMap();
@@ -80,11 +71,11 @@ public class TnbLogController {
         }
 
         runtimeLogService.getAppLogs(app, host);
-        model.addAttribute("app", app);
+        /*model.addAttribute("app", app);
         model.addAttribute("host", host);
         model.addAttribute("appList", appList);
-        model.addAttribute("hostList", hostList);
-        return "/admin/tnb/sys/rtlog";
+        model.addAttribute("hostList", hostList);*/
+        return WebResult.success();
     }
 
     @Operation(summary = "前一页运行日志", description = "N")

+ 4 - 20
search/search-service/src/main/java/cn/reghao/tnb/search/app/blog/controller/ForegroundController.java

@@ -14,7 +14,6 @@ import io.swagger.v3.oas.annotations.tags.Tag;
 import org.springframework.data.domain.Page;
 import org.springframework.data.domain.PageRequest;
 import org.springframework.data.domain.Sort;
-import org.springframework.ui.ModelMap;
 import org.springframework.web.bind.annotation.*;
 
 import java.util.List;
@@ -69,23 +68,8 @@ public class ForegroundController /*extends BaseController */{
         return PageList.pageList(pageNumber, pageSize, (int) total, list);
     }
 
-    @Operation(summary = "文章分类列表页面", description = "N")
+    @Operation(summary = "文章分类/标签列表页面", description = "N")
     @GetMapping("/category")
-    public String category() {
-        List<CategoryCount> list = categoryService.findCategoryCountByPage(CategoryType.Category.getValue(), false);
-        return WebResult.success(list);
-    }
-
-    @Operation(summary = "某个分类下的文章列表页面", description = "N")
-    @GetMapping("/category/post")
-    public String category1(@RequestParam("category") String category, @RequestParam("pn") int pageNumber) {
-        Page<UserArticle> page = articleQuery.findByCategory(pageSize, pageNumber, category, CategoryType.Category.getValue());
-        PageList<UserArticle> pageList = getPageList(page);
-        return WebResult.success(pageList);
-    }
-
-    @Operation(summary = "文章标签列表页面", description = "N")
-    @GetMapping("/tag")
     public String tag(@RequestParam("type") String type) {
         int typeInt = 0;
         if (type.equals("tag")) {
@@ -100,8 +84,8 @@ public class ForegroundController /*extends BaseController */{
         return WebResult.success(list);
     }
 
-    @Operation(summary = "某个标签下的文章列表页面", description = "N")
-    @GetMapping("/tag/post")
+    @Operation(summary = "某个分类/标签下的文章列表页面", description = "N")
+    @GetMapping("/category/post")
     public String tagPost(@RequestParam("type") String type,
                           @RequestParam("name") String name,
                           @RequestParam("pn") int pageNumber) {
@@ -138,7 +122,7 @@ public class ForegroundController /*extends BaseController */{
 
     @Operation(summary = "关于页面", description = "N")
     @GetMapping("/about")
-    public String about(ModelMap model) {
+    public String about() {
         AboutView aboutView = articleQuery.getAboutView();
         return WebResult.success(aboutView);
     }

+ 6 - 1
search/search-service/src/main/java/cn/reghao/tnb/search/app/blog/service/ArticleQuery.java

@@ -135,7 +135,12 @@ public class ArticleQuery {
     }
 
     public List<ArticleLink> getArticleLinks() {
-        return articleRepository.findAll().stream().map(this::getLink).collect(Collectors.toList());
+        int pageNumber = 1;
+        int pageSize = 1000;
+        Sort sort = Sort.by(Sort.Direction.DESC, "createTime");
+        Pageable pageable = PageRequest.of(pageNumber-1, pageSize, sort);
+        Page<Article> page = articleRepository.findByPublishedIsTrueAndPostType(ArticleType.Article.getValue(), pageable);
+        return page.getContent().stream().map(this::getLink).collect(Collectors.toList());
     }
 
     public List<ArticleLink> getLatest(int size) {