cqpCow hai 1 ano
pai
achega
d8a4f85fa5
Modificáronse 1 ficheiros con 3 adicións e 5 borrados
  1. 3 5
      app/Service/ConstructionService.php

+ 3 - 5
app/Service/ConstructionService.php

@@ -877,11 +877,9 @@ class ConstructionService extends Service
         if(isset($data['construction_order_number'])) $model = DeliveryNote::where('id',$data['construction_order_number'])->where('del_time',0)->first();
         if(empty($model)) return [false,'数据不存在!'];
         $employee_key_list = Employee::pluck('emp_name','id')->toArray();
-        $detail = $model;
-        foreach ($detail as &$v){
-            $v['install_man_title'] = $employee_key_list[$v['install_man']];
-            $v['sale_man_title'] = $employee_key_list[$v['sale_man']];
-        }
+        $detail = $model->toArray();
+        $detail['install_man_title'] = $employee_key_list[$detail['install_man']] ?? "";
+        $detail['sale_man_title'] = $employee_key_list[$detail['sale_man']] ?? "";
 
         return [true,$detail];
     }