Browse Source

fix: 数据为空返回null

super-yimizi 2 months ago
parent
commit
fbb1033014

+ 4 - 6
application/api/controller/inspection/Application.php

@@ -57,13 +57,11 @@ class Application extends Base
             $this->error($validate->getError());
         }
         $application = InspectionService::getApplicationDetail($applicationId, $this->auth->id);
-        if (empty($application)) {
-            $this->error('申请记录不存在');
-        }
 
-        $application->append(['audit_status_text', 'apply_time_text', 'audit_time_text', 'province_name', 'city_name', 'district_name']);
-        $application->hidden(['createtime', 'updatetime', 'deletetime']);
-        
+        if($application){
+            $application->append(['audit_status_text', 'apply_time_text', 'audit_time_text', 'province_name', 'city_name', 'district_name']);
+            $application->hidden(['createtime', 'updatetime', 'deletetime']);            
+        }       
         $this->success('获取成功', $application);
    
     }

+ 3 - 3
application/common/Service/InspectionService.php

@@ -72,9 +72,9 @@ class InspectionService
         })
             ->find();
 
-        if (!$application) {
-            throw new BusinessException('申请记录不存在或无权访问');
-        }
+        // if (!$application) {
+        //     throw new BusinessException('申请记录不存在或无权访问');
+        // }
 
         return $application;
     }