ソースを参照

Merge branch 'master' of e.coding.net:zdap/weixiu/weixiu_api into zaxiang_m

liugc 11 ヶ月 前
コミット
2cecb0bc25
1 ファイル変更5 行追加5 行削除
  1. 5 5
      app/adminapi/logic/works/ServiceWorkLogic.php

+ 5 - 5
app/adminapi/logic/works/ServiceWorkLogic.php

@@ -308,7 +308,7 @@ class ServiceWorkLogic extends BaseLogic
                     $data = [
                         'service_work_id'=>$work['id'],
                         'spare_name' => $item['spare_name'],
-                        'spare_image' => $item['spare_image'],
+                        'spare_image' => empty($item['spare_image']) ? '' : $item['spare_image'],
                         'offering_price' => $item['offering_price'],
                         'company_price' => 0,
                         'original_price' => 0,
@@ -434,14 +434,14 @@ class ServiceWorkLogic extends BaseLogic
                 throw new Exception('工单不存在');
             }
             $audit = ServiceWorkSpareAudit::where(['service_work_id'=>$work['id']])->findOrEmpty();
-            if($audit->isEmpty()){
-                throw new Exception('当前工单不存在配件审核信息');
-            }
-            if($audit['status']!=2){
+            if(!$audit->isEmpty() && ($audit['status']!=0 && $audit['status']!=2) ){
                 throw new Exception('当前工单配件不允许修改');
             }
             
             foreach ($params['self_spare_parts'] as $item){
+                if (empty($item['spare_image'])){
+                    throw new Exception('请上传配件图片');
+                }
                 //修改
                 ServiceWorkSpare::where("id",$item['id'])->where('service_worker_id', $work['id'])->update(['spare_image' => $item['spare_image']]);
             }