Ver Fonte

信息中心V1.3.9

kaick há 1 ano atrás
pai
commit
fb8c8f3f40

+ 2 - 3
src/main/java/com/caimei/www/controller/unlimited/ArticleController.java

@@ -8,7 +8,6 @@ import com.caimei.www.service.page.ArticleService;
 import com.caimei.www.service.page.CmBrandLandingService;
 import com.caimei.www.service.page.ProductService;
 import com.caimei.www.utils.PaginationVo;
-import com.caimei.www.utils.ResponseJson;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import lombok.extern.slf4j.Slf4j;
@@ -131,7 +130,7 @@ public class ArticleController extends BaseController {
      */
     @ResponseBody
     @GetMapping("/info/articlerecommendation/{id}/{pageNum}")
-    public ResponseJson<PaginationVo> toPagination(@PathVariable("id") Integer id,@PathVariable("pageNum") Integer pageNum) {
+    public JsonModel<PaginationVo> toPagination(@PathVariable("id") Integer id,@PathVariable("pageNum") Integer pageNum) {
         PageHelper.startPage(pageNum, 10);
         PaginationVo pageData = null;
         if (id == 1) {//精选文章
@@ -141,7 +140,7 @@ public class ArticleController extends BaseController {
             List<CmProductArchiveFile> archiveFiles = articleService.findArchiveFileAddTime(null, null);
             pageData = new PaginationVo<CmProductArchiveFile>(archiveFiles);
         }
-        return ResponseJson.success(pageData);
+        return JsonModel.success(pageData);
     }
 
     @GetMapping("/info/search-{pageNum}.html")

+ 0 - 81
src/main/java/com/caimei/www/utils/ResponseJson.java

@@ -1,81 +0,0 @@
-package com.caimei.www.utils;
-
-import lombok.Data;
-
-import java.io.Serializable;
-
-/**
- * 全局API返回值
- *
- * @author : Charles
- * @date : 2021/3/4
- */
-@Data
-public class ResponseJson<T> implements Serializable {
-    /** 状态码 */
-    private int code;
-    /** 提示信息 */
-    private String msg;
-    /** 返回的数据 */
-    private T data;
-
-    private ResponseJson() {}
-
-    private ResponseJson(int code, String msg) {
-        this.code = code;
-        this.msg = msg;
-    }
-
-    private ResponseJson(int code, String msg, T data) {
-        this.code = code;
-        this.msg = msg;
-        this.data = data;
-    }
-
-    public static ResponseJson success() {
-        return new ResponseJson<>(0, "操作成功");
-    }
-
-    public static<T> ResponseJson<T> success(T data) {
-        return new ResponseJson<>(0, "操作成功", data);
-    }
-
-    public static<T> ResponseJson<T> success(String msg, T data) {
-        return new ResponseJson<>(0, msg, data);
-    }
-
-    public static<T> ResponseJson<T> success(int code, String msg, T data) {
-        return new ResponseJson<>(code, msg, data);
-    }
-
-    public static ResponseJson error() {
-        return new ResponseJson<>(-1, "操作失败");
-    }
-
-    public static ResponseJson error(String msg) {
-        return new ResponseJson<>(-1, msg);
-    }
-
-    public static ResponseJson error(int code, String msg) {
-        return new ResponseJson<>(code, msg);
-    }
-
-    public static<T> ResponseJson<T> error(T data) {
-        return new ResponseJson<>(-1, "操作失败", data);
-    }
-
-    public static<T> ResponseJson<T> error(String msg, T data) {
-        return new ResponseJson<>(-1, msg, data);
-    }
-
-    public static<T> ResponseJson<T> error(int code, String msg, T data) {
-        return new ResponseJson<>(code, msg, data);
-    }
-
-    @Override
-    public String toString() {
-        return "ResponseJson{" + "code=" + code + ", msg='" + msg + '\'' + ", data=" + data + '}';
-    }
-
-    private static final long serialVersionUID = 1L;
-}