longyi hai 4 meses
pai
achega
e1e27ea732
Modificáronse 1 ficheiros con 70 adicións e 19 borrados
  1. 70 19
      core/CoreApp/controllers/Apipf.php

+ 70 - 19
core/CoreApp/controllers/Apipf.php

@@ -18,7 +18,7 @@ class Apipf extends Start_Controller{
     private $key = "bpng!pjgirv6amnfr"; //加密所需要到的key
     private $iv = "k4k!94m66oojtm2w";//加密所需要到的iv
     private $api = "202503121009@ly";
-    private $filter_words = ['bonus','flashsale','clearance','giftpack','gift'];
+    private $filter_words = ['bonus','flashsale','clearance','gift','payment difference','pack','freewig','zerocostitem','qqsfcw','22inchwig','asfreerobe'];
     private $shop_list = [
         1=>'h',
         2=>'as',
@@ -399,9 +399,14 @@ class Apipf extends Start_Controller{
    private function judgeCon($info){
         $tmp_q = 0; 
         $extra_price = empty($info['extra_price'])?[]:json_decode($info['extra_price'],true);
+        
+         $info['issku'] = strtolower($info['issku']);
+         if(stripos($info['issku'],'payment difference') !== false){
+             return false;
+         }
         //如果有价格 说明系统已经可以按照单价进行处理了
         if(empty($extra_price)){
-            $info['issku'] = strtolower($info['issku']);
+            //$info['issku'] = strtolower($info['issku']);
             if(stripos($info['issku'],',') !== false){
                 $issku = explode(",",$info['issku']);
             }else{
@@ -412,11 +417,39 @@ class Apipf extends Start_Controller{
             }else{
                 $quantity = [$info['quantity']];
             }
-            foreach($issku as $index=>$item){
-                if(stripos($item,'gift') !== false){
+            // foreach($issku as $index=>$item){
+            //     if(stripos($item,'gift') !== false){
                     
-                }else{
+            //     }else{
                    
+            //         if(isset($quantity[$index])){
+            //             if(is_numeric($quantity[$index])){
+            //                 $tmp_q += $quantity[$index];
+            //             }else{
+                          
+            //             }
+                        
+            //         }else{
+            //             $tmp_q += 1;
+            //         }
+            //     }
+
+            // }
+            
+            foreach($issku as $index=>$item){
+                $jishu_flag = true;
+                foreach($this->filter_words as $val){
+                    //判断sku中是否有这种东西
+                    if (strpos($item,$val ) !== false) {
+                       $jishu_flag = false;
+                        
+                        
+                    } 
+                    
+                }
+                var_dump($item);
+                var_dump($jishu_flag);
+                if($jishu_flag){
                     if(isset($quantity[$index])){
                         if(is_numeric($quantity[$index])){
                             $tmp_q += $quantity[$index];
@@ -428,11 +461,20 @@ class Apipf extends Start_Controller{
                     }else{
                         $tmp_q += 1;
                     }
+                        
                 }
-
+               
             }
             
         }else{
+            $whlabel_data = explode("|",trim($info['whlabel'],"|"));
+            $check_totla = 0;
+            foreach($whlabel_data as $v){
+                $tmp_d_arr = explode("-",$v);
+                if(isset($tmp_d_arr[1])){
+                    $check_totla += $tmp_d_arr[1]*1;
+                }
+            }
             foreach($extra_price as $k=>$v){
                 if(isset($v['row_total'])){
                     //这里不考虑礼物类是因为礼物 本身就是0 无需考虑
@@ -446,40 +488,49 @@ class Apipf extends Start_Controller{
                 }
 
             }
+            if($tmp_q > $check_totla){
+                $tmp_q = 1;
+            }
         }
-       
+        var_dump($tmp_q);
         //大于等于4
         if($tmp_q >= 4){
             return true;
         }
         return false;
    }
-
+    
+   
 
    public function _tjOrder(){
         echo "<pre>";
-        // var_dump(date("Y-m-d H:i:s"));
+        var_dump(date("Y-m-d H:i:s"));
         // $save_list = [];
-        // $list = $this->fullorder->find_all(" shop in (1,2,3,4,5,6) ","*",'id asc',1200000,300000);
+        // $list = $this->fullorder->find_all(" shop in (1,2,3,4,5,6) and source != 1 and state in (207,216) ","*",'id asc',1200000,300000);
         // foreach($list as $k=>$v){
+        //     if(empty($v['fpdata'])){
+        //         continue;
+        //     }
         //     $r = $this->judgeCon($v);
         //     if($r){
-        //         //var_dump($v['number']);
-        //         // $this->zzrecord_logs->insert([
-        //         //     'number'=>$v['number']
-        //         // ]);
-        //         $save_list[] = $v['number'];
+        //         $save_list[] = [
+        //                 'number'=>$v['number'],
+        //                 'qty'=>$v['quantity'],
+        //                 'sku'=>$v['issku']
+        //             ];
         //     }
         // }
         // var_dump(date("Y-m-d H:i:s"));
         // var_dump(count($save_list));
         // foreach($save_list as $vv){
-        //         $this->zzrecord_logs->insert([
-        //             'number'=>$vv
-        //         ]);
+        //         $this->zzrecord_logs->insert($vv);
         //         usleep(50);
         // }
-        die("over");
+        // die("over");
+        
+        $list = $this->fullorder->find_all(" number = 'YOLIS-01125-043' ","*",'id asc',0,300000);
+        $r = $this->judgeCon($list[0]);
+        var_dump($r);
    }
 
 }