ソースを参照

更新物理删除为逻辑删除

zmw 6 ヶ月 前
コミット
114248a5f5

+ 1 - 1
app/admin/controller/CommonFile.php

@@ -63,7 +63,7 @@ class CommonFile extends AdminController {
         $file = CommonFileApi::getOne($id);
         if ($file && CommonFileApi::delete($id)) {
             $url = "storage/" . $file["url"];
-            @unlink($url);
+            //@unlink($url);
             return json(["code" => 200, "msg" => "删除成功"]);
         }
         return json(["msg" => "找不到对应附件"]);

+ 2 - 2
app/common/api/FileTypeApi.php

@@ -84,8 +84,8 @@ class FileTypeApi {
             $info = self::getOne($params["id"]);
             if ($request->file() && $info["templateUrl"]) {
                 $path = "storage/" . $info["templateUrl"];
-                if (file_exists($path))
-                    @unlink($path);
+                //if (file_exists($path))
+                    //@unlink($path);
             }
             return FileType::update($data);
         } else {

+ 4 - 4
app/common/controller/Api.php

@@ -653,8 +653,8 @@ class Api extends BaseController {
             }
             $old = Db::table("new_talent_file")->findOrEmpty($fileId);
             $old_filepath = "storage/" . $old["url"];
-            if (file_exists($old_filepath))
-                unlink($old_filepath);
+            //if (file_exists($old_filepath))
+                //unlink($old_filepath);
             $data["id"] = $fileId;
             $change = true;
         }
@@ -690,7 +690,7 @@ class Api extends BaseController {
             if (!empty($file["url"])) {
                 $filepath = "storage/" . $file["url"];
                 if (file_exists($filepath)) {
-                    unlink($filepath);
+                    //unlink($filepath);
                 }
             }
 
@@ -721,7 +721,7 @@ class Api extends BaseController {
         $file = Db::table("new_non_predefined_file")->where($where)->findOrEmpty();
         $filepath = "storage/" . $file["url"];
         if (file_exists($filepath) && $file["url"]) {
-            @unlink($filepath);
+            //@unlink($filepath);
         }
         Db::table("new_non_predefined_file")->delete($file["id"]);
         return json(["code" => 200, "msg" => "删除成功"]);

+ 2 - 2
app/enterprise/controller/Api.php

@@ -1070,8 +1070,8 @@ class Api extends EnterpriseController {
             if ($userInfo["headPortrait"]) {
 //如果新照片符合像素要求,则删除旧照片
                 $old_head_url = "storage/" . $userInfo ["headPortrait"];
-                if (file_exists($old_head_url))
-                    @unlink($old_head_url);
+                //if (file_exists($old_head_url))
+                    //@unlink($old_head_url);
             }
             $data["id"] = $uid;
             $data["headPortrait"] = $result->filepath;

+ 4 - 4
app/enterprise/controller/Base.php

@@ -202,14 +202,14 @@ class Base extends EnterpriseController {
                 $height = imagesy($file);
                 //免冠二寸照长宽413:579
                 if ($width * 579 != $height * 413) {
-                    @unlink("storage/" . $result->filepath); //像素不符合,删除上传文件                    
+                    //@unlink("storage/" . $result->filepath); //像素不符合,删除上传文件
                     throw new ValidateException("近期免冠半身彩照(二寸)不符合二寸像素标准。*<span style='color:#ff0000;'>二寸像素标准[413*579]</span>");
                 }
                 if ($info && $info["headimgurl"]) {
                     //如果新照片符合像素要求,则删除旧照片
                     $old_head_url = "storage/" . $info["headimgurl"];
-                    if (file_exists($old_head_url))
-                        @unlink($old_head_url);
+                    //if (file_exists($old_head_url))
+                        //@unlink($old_head_url);
                 }
                 $data["headimgurl"] = $result->filepath;
             }
@@ -336,7 +336,7 @@ class Base extends EnterpriseController {
                     $_logfileIds[] = [];
                     foreach ($_wait_del_files as $_del_file) {
                         $_logfileIds[] = $_del_file["id"];
-                        @unlink("storage/" . $_del_file["url"]);
+                        //@unlink("storage/" . $_del_file["url"]);
                     }
                     Db::table("new_talent_file")->where($whr)->delete();
                     if ($_logfileIds) {

+ 1 - 1
app/enterprise/controller/Integral.php

@@ -340,7 +340,7 @@ class Integral extends EnterpriseController {
                 $_logfileIds[] = [];
                 foreach ($_wait_del_files as $_del_file) {
                     $_logfileIds[] = $_del_file["id"];
-                    @unlink("storage/" . $_del_file ["url"]);
+                    //@unlink("storage/" . $_del_file ["url"]);
                 }
                 Db::table("new_talent_file")->where($whr)->delete();
                 if ($_logfileIds) {

+ 2 - 2
app/enterprise/controller/LivingAllowance.php

@@ -283,7 +283,7 @@ class LivingAllowance extends EnterpriseController {
                 $height = imagesy($file);
                 //免冠二寸照长宽413:579
                 if ($width * 579 != $height * 413) {
-                    @unlink("storage/" . $result->filepath); //像素不符合,删除上传文件
+                    //@unlink("storage/" . $result->filepath); //像素不符合,删除上传文件
                     throw new ValidateException("近期免冠半身彩照(二寸)不符合二寸像素标准。*<span style='color:#ff0000;'>二寸像素标准[413*579]</span>");
                 }
                 if ($info && $info["photo"]) {
@@ -355,7 +355,7 @@ class LivingAllowance extends EnterpriseController {
             if (!empty($file["url"])) {
                 $filepath = "storage/" . $file["url"];
                 if (file_exists($filepath)) {
-                    @unlink($filepath);
+                    //@unlink($filepath);
                 }
             }
 

+ 13 - 13
app/enterprise/controller/Talent.php

@@ -1017,14 +1017,14 @@ class Talent extends EnterpriseController {
                 $height = imagesy($file);
                 //免冠二寸照长宽413:579
                 if ($width * 579 != $height * 413) {
-                    @unlink("storage/" . $result->filepath); //像素不符合,删除上传文件                    
+                    //@unlink("storage/" . $result->filepath); //像素不符合,删除上传文件
                     throw new ValidateException("近期免冠半身彩照(二寸)不符合二寸像素标准。*<span style='color:#ff0000;'>二寸像素标准[413*579]</span>");
                 }
                 if ($info && $info["headimgurl"]) {
                     //如果新照片符合像素要求,则删除旧照片
                     $old_head_url = "storage/" . $info["headimgurl"];
-                    if (file_exists($old_head_url))
-                        @unlink($old_head_url);
+                    //if (file_exists($old_head_url))
+                        //@unlink($old_head_url);
                 }
                 $data["headimgurl"] = $result->filepath;
             }
@@ -1210,7 +1210,7 @@ class Talent extends EnterpriseController {
                     $_logfileIds[] = [];
                     foreach ($_wait_del_files as $_del_file) {
                         $_logfileIds[] = $_del_file["id"];
-                        @unlink("storage/" . $_del_file["url"]);
+                        //@unlink("storage/" . $_del_file["url"]);
                     }
                     Db::table("new_talent_file")->where($whr)->delete();
                     if ($_logfileIds) {
@@ -1283,14 +1283,14 @@ class Talent extends EnterpriseController {
                 $height = imagesy($file);
                 //免冠二寸照长宽413:579
                 if ($width * 579 != $height * 413) {
-                    @unlink("storage/" . $result->filepath); //像素不符合,删除上传文件                    
+                    //@unlink("storage/" . $result->filepath); //像素不符合,删除上传文件
                     throw new ValidateException("近期免冠半身彩照(二寸)不符合二寸像素标准。*<span style='color:#ff0000;'>二寸像素标准[413*579]</span>");
                 }
                 if ($info && $info["headimgurl"]) {
                     //如果新照片符合像素要求,则删除旧照片
                     $old_head_url = "storage/" . $info["headimgurl"];
-                    if (file_exists($old_head_url))
-                        @unlink($old_head_url);
+                    //if (file_exists($old_head_url))
+                        //@unlink($old_head_url);
                 }
                 $data["headimgurl"] = $result->filepath;
             }
@@ -1436,14 +1436,14 @@ class Talent extends EnterpriseController {
                 $height = imagesy($file);
                 //免冠二寸照长宽413:579
                 if ($width * 579 != $height * 413) {
-                    @unlink("storage/" . $result->filepath); //像素不符合,删除上传文件                    
+                    //@unlink("storage/" . $result->filepath); //像素不符合,删除上传文件
                     throw new ValidateException("近期免冠半身彩照(二寸)不符合二寸像素标准。*<span style='color:#ff0000;'>二寸像素标准[413*579]</span>");
                 }
                 if ($info && $info["headimgurl"]) {
                     //如果新照片符合像素要求,则删除旧照片
                     $old_head_url = "storage/" . $info["headimgurl"];
-                    if (file_exists($old_head_url))
-                        @unlink($old_head_url);
+                    //if (file_exists($old_head_url))
+                        //@unlink($old_head_url);
                 }
                 $data["headimgurl"] = $result->filepath;
             }
@@ -1580,14 +1580,14 @@ class Talent extends EnterpriseController {
                 $height = imagesy($file);
                 //免冠二寸照长宽413:579
                 if ($width * 579 != $height * 413) {
-                    @unlink("storage/" . $result->filepath); //像素不符合,删除上传文件                    
+                    //@unlink("storage/" . $result->filepath); //像素不符合,删除上传文件
                     throw new ValidateException("近期免冠半身彩照(二寸)不符合二寸像素标准。*<span style='color:#ff0000;'>二寸像素标准[413*579]</span>");
                 }
                 if ($info && $info["headimgurl"]) {
                     //如果新照片符合像素要求,则删除旧照片
                     $old_head_url = "storage/" . $info["headimgurl"];
-                    if (file_exists($old_head_url))
-                        @unlink($old_head_url);
+                    //if (file_exists($old_head_url))
+                        //@unlink($old_head_url);
                 }
                 $data["headimgurl"] = $result->filepath;
             }

+ 1 - 1
app/enterprise/controller/TalentAllowance.php

@@ -1127,7 +1127,7 @@ class TalentAllowance extends EnterpriseController {
             if (!empty($file["url"])) {
                 $filepath = "storage/" . $file["url"];
                 if (file_exists($filepath)) {
-                    unlink($filepath);
+                    //unlink($filepath);
                 }
             }
             return json(new Response(Response::SUCCESS, "删除成功"));

+ 1 - 1
app/person/controller/Education.php

@@ -353,7 +353,7 @@ class Education extends PersonController {
             if (!empty($file["url"])) {
                 $filepath = "storage/" . $file["url"];
                 if (file_exists($filepath)) {
-                    @unlink($filepath);
+                    //@unlink($filepath);
                 }
             }
 

+ 2 - 3
app/person/controller/UserInfo.php

@@ -199,9 +199,8 @@ class UserInfo extends PersonController {
             if ($userInfo["headPortrait"]) {
 //如果新照片符合像素要求,则删除旧照片
                 $old_head_url = "storage/" . $userInfo ["headPortrait"];
-                if (file_exists($old_head_url))
-                    @unlink(
-                                    $old_head_url);
+                //if (file_exists($old_head_url))
+                    //@unlink($old_head_url);
             }
             $data["id"] = $uid;
             $data["headPortrait"] = $result->filepath;