gogs 1 éve
szülő
commit
0f40b46fc1

+ 1 - 1
app/Http/Controllers/Api/ConstructionController.php

@@ -126,7 +126,7 @@ class ConstructionController extends BaseController
     {
         $service = new ConstructionService();
         $userData = $request->userData->toArray();
-        list($status,$data) = $service->deliveryNoteList($request->all(),$userData);
+        list($status,$data) = $service->deliveryNoteDel($request->all(),$userData);
 
         if($status){
             return $this->json_return(200,'',$data);

+ 3 - 12
app/Model/DeliveryNote.php

@@ -16,30 +16,21 @@ class DeliveryNote extends Model
     const UPDATED_AT = 'upd_time';
     protected $dateFormat = 'U';
 
-    public function setBreakAttribute($value)
-    {
-        $this->attributes['break'] = json_encode($value);
-    }
+
 
     public function getBreakAttribute($value)
     {
         return json_decode($value, true);
     }
 
-    public function setBreakMarkAttribute($value)
-    {
-        $this->attributes['break_mark'] = json_encode($value);
-    }
+
 
     public function getBreakMarkAttribute($value)
     {
         return json_decode($value, true);
     }
 
-    public function setProjectIdAttribute($value)
-    {
-        $this->attributes['project_id'] = json_encode($value);
-    }
+
 
     public function getProjectIdAttribute($value)
     {

+ 32 - 29
app/Service/ConstructionService.php

@@ -799,7 +799,7 @@ class ConstructionService extends Service
     }
 
     public function deliveryNoteEdit($data,$user){
-        $id = $user;
+        $id = $user['id'];
         if(isset($data['id'])) {
             $model = DeliveryNote::where('id',$data['id'])->first();
             if($model->img3) return [false,'客户已签字,无法编辑!'];
@@ -810,34 +810,37 @@ class ConstructionService extends Service
             $model = new DeliveryNote();
             $model->crt_id = $id;
         }
-        $model->upd_id = $id;
-        $model->construction_order_number = $data['construction_order_number'] ?? '';
-        $model->start_time = $data['start_time'] ?? '';
-        $model->end_time = $data['end_time'] ?? '';
-        $model->vin_no = $data['vin_no'] ?? '';
-        $model->system = $data['system'] ?? '';
-        $model->mile = $data['mile'] ?? '';
-        $model->is_wait = $data['is_wait'] ?? '';
-        $model->customer_name = $data['customer_name'] ?? '';
-        $model->customer_mobile = $data['customer_mobile'] ?? '';
-        $model->sale_man = $data['sale_man'] ?? '';
-        $model->install_man = $data['install_man'] ?? '';
-        $model->is_brash = $data['is_brash'] ?? '';
-        $model->is_chong = $data['is_chong'] ?? '';
-        $model->service_mark = $data['service_mark'] ?? '';
-        $model->mark = $data['mark'] ?? '';
-        $model->break = $data['break'] ??[];
-        $model->break_mark = $data['break_mark'] ??[];
-        $model->project_id = $data['project_id'] ?? [];
-        $model->other_project_mark = $data['other_project_mark'] ?? '';
-        $model->img = $data['img'] ?? '';
-        $model->img1 = $data['img1'] ?? '';
-        $model->img2 = $data['img2'] ?? '';
-        $model->img3 = $data['img3'] ?? '';
-
-        $model->save();
-
-        return [true,'保存成功!'];
+        try {
+            $model->upd_id = $id;
+            $model->construction_order_number = $data['construction_order_number'] ?? '';
+            $model->start_time = $data['start_time'] ?? '';
+            $model->end_time = $data['end_time'] ?? '';
+            $model->vin_no = $data['vin_no'] ?? '';
+            $model->system = $data['system'] ?? '';
+            $model->mile = $data['mile'] ?? '';
+            $model->is_wait = $data['is_wait'] ?? '';
+            $model->customer_name = $data['customer_name'] ?? '';
+            $model->customer_mobile = $data['customer_mobile'] ?? '';
+            $model->sale_man = $data['sale_man'] ?? '';
+            $model->install_man = $data['install_man'] ?? '';
+            $model->is_brash = $data['is_brash'] ?? '';
+            $model->is_chong = $data['is_chong'] ?? '';
+            $model->service_mark = $data['service_mark'] ?? '';
+            $model->mark = $data['mark'] ?? '';
+            $model->break = $data['break'] ? json_encode($data['break']):json_encode([]);
+            $model->break_mark = $data['break_mark'] ? json_encode($data['break_mark']):json_encode([]);
+            $model->project_id = $data['project_id'] ? json_encode($data['project_id']):json_encode([]);
+            $model->other_project_mark = $data['other_project_mark'] ?? '';
+            $model->img = $data['img'] ?? '';
+            $model->img1 = $data['img1'] ?? '';
+            $model->img2 = $data['img2'] ?? '';
+            $model->img3 = $data['img3'] ?? '';
+            $model->save();
+            return [true,'保存成功!'];
+        }catch (\Throwable $e){
+            return [true,'保存成功!'];
+        }
+