cqp 1 miesiąc temu
rodzic
commit
1375fb176d

+ 4 - 4
app/Console/Commands/CustomerFromThreePlatForm.php

@@ -67,10 +67,10 @@ class CustomerFromThreePlatForm extends Command
                             ->pluck('id','c_third_platform_id')
                             ->toArray();
                         $insert_detail = [];
-                        foreach ($main_detail as $c_third_platform_id => $value){
-                            if(isset($map[$c_third_platform_id])){
+                        foreach ($main_detail as $id => $value){
+                            if(isset($map[$id])){
                                 foreach ($value as $v){
-                                    $v['customer_id'] = $map[$c_third_platform_id];
+                                    $v['customer_id'] = $map[$id] ?? 0;
                                     $insert_detail[] = $v;
                                 }
                             }
@@ -81,7 +81,7 @@ class CustomerFromThreePlatForm extends Command
 
                     if(! empty($fail)) {
                         foreach ($fail as $update){
-                            $customer_id = $map[$c_third_platform_id] ?? 0;
+                            $customer_id = $map[$update['id']] ?? 0;
                             \App\Model\CustomerFromThreePlatForm::where('id', $update['id'])
                                 ->update(['del_time' => $update['result'] , 'customer_id' => $customer_id]);
                         }