Browse Source

修改东西

lvhao 5 months ago
parent
commit
0f1092ad98
1 changed files with 44 additions and 32 deletions
  1. 44 32
      core/CoreApp/controllers/Apipf.php

+ 44 - 32
core/CoreApp/controllers/Apipf.php

@@ -158,21 +158,21 @@ class Apipf extends Start_Controller{
         foreach($list as $k=>$v){
         foreach($list as $k=>$v){
              $orderinfo = $this->getOrderList($v['email'],$v['shop'],2);
              $orderinfo = $this->getOrderList($v['email'],$v['shop'],2);
              $send_list[] = [
              $send_list[] = [
-                 'customer_id'=>$v['id'],
-                 'name'=>$v['name'],
-                 'email'=>$v['email'],
-                 'telephone'=>$v['phone'],
-                 'ordered_mount'=>$orderinfo['order_mount'],
-                 'ordered_num'=>$orderinfo['order_num'],
-                 'ordered_qty'=>$orderinfo['order_qty'],
-                 'brand'=>isset($this->shop_list[$v['shop']])?$this->shop_list[$v['shop']]:"other",
-                 // 'country'=>$v['country'],
-                 // 'province'=>$v['province'],
-                 // 'city'=>$v['city'],
-                 // 'street'=>$v['street'],
-                 // 'address'=>$v['address'].$v['address2'],
-                 // 'zipcode'=>$v['zipcode']
-                 'orders'=>$orderinfo['orders'],
+                'customer_id'=>$v['id'],
+                'name'=>$v['name'],
+                'email'=>$v['email'],
+                'telephone'=>$v['phone'],
+                'ordered_mount'=>$orderinfo['order_mount'],
+                'ordered_num'=>$orderinfo['order_num'],
+                'ordered_qty'=>$orderinfo['order_qty'],
+                'brand'=>isset($this->shop_list[$v['shop']])?$this->shop_list[$v['shop']]:"other",
+                // 'country'=>$v['country'],
+                // 'province'=>$v['province'],
+                // 'city'=>$v['city'],
+                // 'street'=>$v['street'],
+                // 'address'=>$v['address'].$v['address2'],
+                // 'zipcode'=>$v['zipcode']
+                'orders'=>$orderinfo['orders'],
              ];
              ];
         }
         }
        
        
@@ -181,24 +181,36 @@ class Apipf extends Start_Controller{
         }
         }
         $header = [];
         $header = [];
         $url = $this->url;
         $url = $this->url;
-        
-        var_dump($send_list);
-        die;
-        foreach($send_list as $item){
-            if(empty($item['orders'])){
-                 $this->customer->save([
-                     'is_tb'=>1,
-                 ],$item['customer_id']);
-                continue;
+
+         //var_dump($send_list);
+       $data = [];
+       $customer_ids = [];
+       foreach($send_list as $item){
+           if(empty($item['orders']) || empty($item['email'])){
+               //直接同步更新了吧  都满足条件了 结果还没订单 就先不查询了 等有新的订单在判断一遍
+                $this->customer->save([
+                    'is_tb'=>1,
+                ],$item['customer_id']);
+               continue;
+           }
+           $data[] = $item; 
+           $customer_ids[] = $item['customer_id'];
+       }
+       var_dump(json_encode($customer_ids));
+       var_dump($data);
+       die;
+       if(empty($data)){
+            return ;
+       }
+       $res = $this->sendHttp($url,$header,['data'=>$data]);
+        var_dump($res);
+        if($res['status']){
+            foreach($customer_ids as $k=>$v){
+                $this->customer->save([
+                    'is_tb'=>1,
+                ],$v);
             }
             }
-             $res = $this->sendHttp($url,$header,[
-                    $item
-                 ]);
-             if($res){
-                 $this->customer->save([
-                     'is_tb'=>1,
-                 ],$item['customer_id']);
-             }
+            
         }
         }
     }
     }
     /**
     /**