ソースを参照

施工单完成一半

cqpCow 1 年間 前
コミット
df4df1bc05
2 ファイル変更35 行追加18 行削除
  1. 20 7
      app/Service/CustomerService.php
  2. 15 11
      app/Service/ProductService.php

+ 20 - 7
app/Service/CustomerService.php

@@ -103,8 +103,9 @@ class CustomerService extends Service
                 foreach ($data['img'] as $value){
                     $insert[] = [
                         'customer_id' => $model->id,
-                        'file' => $value,
+                        'file' => $value['url'],
                         'type' => CustomerInfo::type_five,
+                        'name' => $value['name'],
                         'crt_time' => $time,
                     ];
                 }
@@ -116,8 +117,9 @@ class CustomerService extends Service
                 foreach ($data['file'] as $value){
                     $insert[] = [
                         'customer_id' => $model->id,
-                        'file' => $value,
+                        'file' => $value['url'],
                         'type' => CustomerInfo::type_six,
+                        'name' => $value['name'],
                         'crt_time' => $time,
                     ];
                 }
@@ -222,8 +224,9 @@ class CustomerService extends Service
                 foreach ($data['img'] as $value){
                     $insert[] = [
                         'customer_id' => $model->id,
-                        'file' => $value,
+                        'file' => $value['url'],
                         'type' => CustomerInfo::type_five,
+                        'name' => $value['name'],
                         'crt_time' => $time,
                     ];
                 }
@@ -235,8 +238,9 @@ class CustomerService extends Service
                 foreach ($data['file'] as $value){
                     $insert[] = [
                         'customer_id' => $model->id,
-                        'file' => $value,
+                        'file' => $value['url'],
                         'type' => CustomerInfo::type_six,
+                        'name' => $value['name'],
                         'crt_time' => $time,
                     ];
                 }
@@ -285,6 +289,7 @@ class CustomerService extends Service
         $address = '';
         if(! empty($customer['address1'])) {
             $tmp = json_decode($customer['address1'],true);
+            $customer['address1'] = $tmp;
             $tmp = implode(' ',$tmp);
             $tmp .= ' ' . $customer['address2'];
             $address = $tmp;
@@ -323,7 +328,7 @@ class CustomerService extends Service
 
         $customer_info = CustomerInfo::where('del_time',0)
             ->where('customer_id',$customer['id'])
-            ->select('id','customer_id','contact_type','contact_info','employee_id','file','type')
+            ->select('id','customer_id','contact_type','contact_info','employee_id','file','type','name')
             ->get()->toArray();
         $emp_map = Employee::whereIn('id',array_unique(array_merge_recursive([$customer['crt_id']],array_column($customer_info,'employee_id'))))
             ->pluck('emp_name','id')
@@ -358,9 +363,17 @@ class CustomerService extends Service
                 ];
                 $customer['employee_three'][] = $tmp;
             }elseif ($value['type'] == CustomerInfo::type_five){
-                $customer['img'][] = $value['file'];
+                $tmp = [
+                    'url' => $value['file'],
+                    'name' => $value['name'],
+                ];
+                $customer['img'][] = $tmp;
             }elseif ($value['type'] == CustomerInfo::type_six){
-                $customer['file'][] = $value['employee_id'];
+                $tmp = [
+                    'url' => $value['file'],
+                    'name' => $value['name'],
+                ];
+                $customer['file'][] = $tmp;
             }
         }
         $customer['crt_name'] = $emp_map[$customer['crt_id']] ?? '';

+ 15 - 11
app/Service/ProductService.php

@@ -151,8 +151,9 @@ class ProductService extends Service
                 foreach ($data['img'] as $value){
                     $insert[] = [
                         'product_id' => $model->id,
-                        'file' => $value,
+                        'file' => $value['url'],
                         'type' => ProductInfo::type_one,
+                        'name' => $value['name'],
                         'crt_time' => $time,
                     ];
                 }
@@ -164,8 +165,9 @@ class ProductService extends Service
                 foreach ($data['file'] as $value){
                     $insert[] = [
                         'product_id' => $model->id,
-                        'file' => $value,
+                        'file' => $value['url'],
                         'type' => ProductInfo::type_two,
+                        'name' => $value['name'],
                         'crt_time' => $time,
                     ];
                 }
@@ -238,8 +240,9 @@ class ProductService extends Service
                 foreach ($data['img'] as $value){
                     $insert[] = [
                         'product_id' => $model->id,
-                        'file' => $value,
+                        'file' => $value['url'],
                         'type' => ProductInfo::type_one,
+                        'name' => $value['name'],
                         'crt_time' => $time,
                     ];
                 }
@@ -251,8 +254,9 @@ class ProductService extends Service
                 foreach ($data['file'] as $value){
                     $insert[] = [
                         'product_id' => $model->id,
-                        'file' => $value,
+                        'file' => $value['url'],
                         'type' => ProductInfo::type_two,
+                        'name' => $value['name'],
                         'crt_time' => $time,
                     ];
                 }
@@ -337,17 +341,17 @@ class ProductService extends Service
         $customer['img'] = $customer['file'] = $customer['depart'] = $customer['employee'] = [];
         $customer_info = ProductInfo::where('del_time',0)
             ->where('product_id',$customer['id'])
-            ->select('id','product_id','file','type')
+            ->select('id','product_id','file','type','name')
             ->get()->toArray();
         foreach ($customer_info as $value){
+            $tmp = [
+                'url' => $value['file'],
+                'name' => $value['name'],
+            ];
             if($value['type'] == ProductInfo::type_one){
-                $customer['img'][] = [
-                    $value['file']
-                ];
+                $customer['img'][] = $tmp;
             }elseif ($value['type'] == ProductInfo::type_two){
-                $customer['file'][] = [
-                    $value['file']
-                ];
+                $customer['file'][] = $tmp;
             }
         }