From 2cdae0f5f7d7d2db4ff07be0c3e97a10eb3722d3 Mon Sep 17 00:00:00 2001
From: 13693261870 <252740454@qq.com>
Date: 星期六, 18 三月 2023 14:57:00 +0800
Subject: [PATCH] 1

---
 src/main/java/com/lf/server/controller/data/PublishController.java |   26 ++++++++++++++++++--------
 1 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/src/main/java/com/lf/server/controller/data/PublishController.java b/src/main/java/com/lf/server/controller/data/PublishController.java
index c012f21..46c4406 100644
--- a/src/main/java/com/lf/server/controller/data/PublishController.java
+++ b/src/main/java/com/lf/server/controller/data/PublishController.java
@@ -3,10 +3,12 @@
 import com.lf.server.annotation.SysLog;
 import com.lf.server.controller.all.BaseController;
 import com.lf.server.entity.all.ResponseMsg;
+import com.lf.server.entity.ctrl.PubEntity;
 import com.lf.server.entity.data.MetaEntity;
 import com.lf.server.entity.data.PublishEntity;
 import com.lf.server.entity.sys.UserEntity;
 import com.lf.server.helper.StringHelper;
+import com.lf.server.helper.WebHelper;
 import com.lf.server.service.data.PublishService;
 import com.lf.server.service.sys.TokenService;
 import io.swagger.annotations.Api;
@@ -51,7 +53,7 @@
                 return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null);
             }
             if (StringHelper.isEmpty(type)) {
-                return fail("璇疯緭鍏ユ暟鎹被鍒�");
+                return fail("鏁版嵁绫诲埆涓虹┖", null);
             }
 
             String types = getType(type);
@@ -130,19 +132,27 @@
     }
 
     @SysLog()
-    @ApiOperation(value = "鎻掑叆涓�鏉�")
+    @ApiOperation(value = "鎻掑叆鍙戝竷鏁版嵁")
     @ApiImplicitParams({
-            @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "PublishEntity", paramType = "body")
+            @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "PubEntity", paramType = "body")
     })
     @PostMapping(value = "/insert", produces = "application/json; charset=UTF-8")
-    public ResponseMsg<Integer> insert(@RequestBody PublishEntity entity, HttpServletRequest req) {
+    public ResponseMsg<Integer> insertForPub(@RequestBody PubEntity entity, HttpServletRequest req) {
         try {
-            UserEntity ue = tokenService.getCurrentUser(req);
-            if (ue != null) {
-                entity.setCreateUser(ue.getId());
+            if (null == entity || null == entity.getIds() || entity.getIds().isEmpty()) {
+                return fail("瀹炰綋绫讳负绌烘垨鎵句笉鍒板厓鏁版嵁ID", 0);
+            }
+            if (StringHelper.isEmpty(entity.getType())) {
+                return fail("鏁版嵁绫诲埆涓虹┖", null);
             }
 
-            int count = publishService.insert(entity);
+            UserEntity ue = tokenService.getCurrentUser(req);
+            if (ue != null) {
+                entity.setUserId(ue.getId());
+                entity.setToken(WebHelper.getToken(req));
+            }
+
+            int count = publishService.insertForPub(entity);
 
             return success(count);
         } catch (Exception ex) {

--
Gitblit v1.9.3