Jelajahi Sumber

删除文件之后,新建一个空文件,防止图文不对应的情况

詹子聪 5 tahun lalu
induk
melakukan
d6e924808a

+ 2 - 0
src/main/java/com/miekir/shibei/controller/api/GoodsController.java

@@ -126,6 +126,7 @@ public class GoodsController {
                 if (file.exists()) {
                     try {
                         file.delete();
+                        file.createNewFile();
                     } catch (Exception imgException) {
                         imgException.printStackTrace();
                     }
@@ -147,6 +148,7 @@ public class GoodsController {
                     if (file.exists()) {
                         try {
                             file.delete();
+                            file.createNewFile();
                         } catch (Exception imgException) {
                             imgException.printStackTrace();
                         }