longyi 5 tháng trước cách đây
mục cha
commit
0d2e4f0002

+ 23 - 12
core/CoreApp/controllers/Apipf.php

@@ -72,7 +72,6 @@ class Apipf extends Start_Controller{
     public function _customerAllTbData(){
        echo "<pre>";
        
-       
        $api = $this->input->get('api',true);
        if($api != $this->api){
             die("No data to be executed");
@@ -112,7 +111,8 @@ class Apipf extends Start_Controller{
        $url = $this->url;
        
        //var_dump($send_list);
-       
+       $data = [];
+       $customer_ids = [];
        foreach($send_list as $item){
            if(empty($item['orders'])){
                //直接同步更新了吧  都满足条件了 结果还没订单 就先不查询了 等有新的订单在判断一遍
@@ -122,15 +122,20 @@ class Apipf extends Start_Controller{
                 ],$item['customer_id']);
                continue;
            }
-            $res = $this->sendHttp($url,$header,['data'=>[$item]]);
-            var_dump($res);
-            if($res['status']){
+           $data[] = $item; 
+           $customer_ids[] = $item['customer_id'];
+       }
+       $res = $this->sendHttp($url,$header,['data'=>[$item]]);
+    
+        if($res['status']){
+            foreach($customer_ids as $k=>$v){
                 $this->customer->save([
                     'more_three'=>3,
                     'is_tb'=>1,
-                ],$item['customer_id']);
+                ],$v);
             }
-       }
+            
+        }
     }
     //同步已经同步过的订单客户近期订单
     public function  _customerDepartTbData(){
@@ -320,7 +325,7 @@ class Apipf extends Start_Controller{
             $final_list[] = [
                 'shop'=>$v['shop'],
                 'increment_id'=>$v['orderinfo'],
-                'status'=>$v['state'],
+                'status'=>empty($v['state'])?"Complete":$v['state'],
                 'grand_total'=>$v['shouldmoney'],
                 'order_created'=>$v['dtime'],
                 //'product_name'=>array_column($sku_list,'product_name'),
@@ -448,7 +453,10 @@ class Apipf extends Start_Controller{
     }
 
     private function sendHttp($url,$header,$list){
-        var_dump($list);
+        $header = [
+             'Content-Type: application/json',
+        ];
+        //var_dump($list);
         $ch = curl_init();
         curl_setopt($ch, CURLOPT_URL, $url);
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
@@ -456,12 +464,15 @@ class Apipf extends Start_Controller{
 		curl_setopt($ch, CURLINFO_HEADER_OUT, TRUE);
 		curl_setopt($ch, CURLOPT_POST, 1);
         curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($list));
-        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
-        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
+        // curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
+        // curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
         $res = curl_exec($ch);
 		$res = json_decode($res,true);
-		var_dump($res);
+		//var_dump($res);
+	    
 		return $res;
     }
+    
+  
 
 }

+ 3 - 1
core/CoreApp/models/Model_logic_u9xgsd.php

@@ -528,7 +528,9 @@ class Model_logic_u9xgsd extends Lin_Model {
     }
     //将许昌仓的料品同步到香港仓
     public function tbXgLp($tb_info){
-       
+    //   echo "<pre>";
+    //     var_dump($tb_info);
+    //     die;
         $rr = $this->apiyyv1->tbLp($tb_info,$this->getToken(130));
         
         if($rr[0]['Success']){