admin hai 1 mes
pai
achega
90a4d1bcb2

+ 6 - 0
client-app/src/main/java/com/sapit/client/app/third/controller/goods/ThirdStoreGoodsManageCtltest.java

@@ -116,6 +116,12 @@ public class ThirdStoreGoodsManageCtltest {
         return thirdStoreGoodsManageCtltestService.updateGoodsPicForThird(goodsId, file);
     }
 
+    @PostMapping("/uploadGoodsPicForThird")
+    @AuthToken(type = "third")
+    public ResultBean uploadGoodsPicForThird(@RequestParam(value = "file", required = false) MultipartFile file) {
+        return thirdStoreGoodsManageCtltestService.uploadGoodsPicForThird(file);
+    }
+
     /**
      * 修改店铺商品名称
      * @param goodsId

+ 16 - 0
client-app/src/main/java/com/sapit/client/app/third/controller/goods/ThirdStoreGoodsManageCtltestService.java

@@ -164,6 +164,22 @@ public class ThirdStoreGoodsManageCtltestService extends BaseDao {
      * @param goodsName
      * @return
      */
+    public ResultBean uploadGoodsPicForThird(MultipartFile file) {
+        ResultBean result = newResult();
+        if (file == null || file.getOriginalFilename() == null) {
+            return fail(result, ReturnCode.PARAM_WRONG, "Operation failed");
+        }
+
+        String imageUrl = tryUploadImage(file, result);
+        if (imageUrl == null) {
+            return result;
+        }
+
+        result.setObj(imageUrl);
+        result.getRtnBean().setRtnCode(ReturnCode.SUCCESS);
+        return result;
+    }
+
     public ResultBean updateGoodsNameForThird(Long goodsId, String goodsName) {
         ResultBean result = newResult();
         if (goodsId == null || goodsName == null) {