소스 검색

添加express的校验规则

lvhao 3 일 전
부모
커밋
8b5194f74a
2개의 변경된 파일266개의 추가작업 그리고 2개의 파일을 삭제
  1. 19 2
      core/CoreApp/controllers/Aatest.php
  2. 247 0
      core/CoreApp/models/Model_logic_express.php

+ 19 - 2
core/CoreApp/controllers/Aatest.php

@@ -85,15 +85,32 @@ class Aatest extends Start_Controller {
 		$this->load->_model("Model_apittv1","apittv1");
 		$this->load->_model("Model_express_tt","express_tt");
 		$this->load->_model("Model_check","check");
+		$this->load->_model("Model_logic_express","logic_express");
     }
 	
 
     //定义方法的调用规则 获取URI第二段值
     public function _remap($arg,$arg_array)
     {  
-		$res = $this->itsxb->getDetail("WKSD0580506");
+		//测试 erp现在还在用的数据
+		//
+		$list = $this->fullorder->find_all("print = 3","*","id desc",0,300);
 		echo "<pre>";
-        print_r($res);
+		foreach($list as $k=>$v){
+			if(empty($v['express'])){
+				continue;
+			}
+			if(empty($v['waybill'])){
+				continue;
+			}
+			$express_info = $this->express->read($v['express']);
+			$r = $this->logic_express->ydCheckById($v['waybill'],$v['express']);
+			$y = $this->logic_express->ydCheckByPrintcode($v['waybill'],$express_info['printcode']);
+			echo "<hr>";
+			var_dump("----R:".$r."----Y:".$y);
+			var_dump($v['number']."----".$v['waybill']."-----".$express_info['servicename']."----".$v['express']."----".$express_info['printcode']);
+		}
+
 		die;
 		$info = $this->logic_order->getInfo("orderinfo = '577193171472388208'");
 		

+ 247 - 0
core/CoreApp/models/Model_logic_express.php

@@ -0,0 +1,247 @@
+<?php
+/**
+ * 封装一些常规的订单操作
+ */
+class Model_logic_express extends Lin_Model {
+   
+    
+    function __construct(){
+        parent::__construct();
+       
+    }
+    
+    public function ydCheckById($waybill,$express_code){
+        if(in_array($express_code,[76,77])){
+            //3pe盒子和非盒子
+            return $this->check_3pe($waybill);
+        }else if(in_array($express_code,[82,66,67])){
+            //云途(美国) 云途欧盟  云途欧盟-带保险
+            return $this->check_yt($waybill);
+        }else if(in_array($express_code,[71,75,31,63,50])){
+            //云尚快递快线和普货 fedex   fedex(杭州)-不报关 FedEx-US2
+            return $this->check_fedex($waybill);
+        }else if(in_array($express_code,[1,69])){
+            //dhl
+            return $this->check_dhl($waybill);
+        }else if(in_array($express_code,[2,64])){
+            //usps USPS-US2
+            return $this->check_usps($waybill);
+        }else if(in_array($express_code,[81])){
+            //uniuni
+            return $this->check_uniuni($waybill);
+        }else if(in_array($express_code,[7])){
+            //ges
+            return $this->check_ges($waybill);
+        }else if(in_array($express_code,[78,79,84])){
+            //正鑫dpd 英国|欧洲  维库dpd
+            return $this->check_dpd($waybill);
+        }else if(in_array($express_code,[52])){
+            //惠程安迈世
+            return $this->check_hc_ams($waybill);
+        }else if(in_array($express_code,[73])){
+            //惠城usps
+            return $this->check_hc_usps($waybill);
+        }else if(in_array($express_code,[51])){
+            //惠城ges
+            return $this->check_hc_ges($waybill);
+        }else if(in_array($express_code,[35])){
+            //燕文
+            return $this->check_yw($waybill);
+        }else if(in_array($express_code,[14])){
+            //顺丰
+            return $this->check_sf($waybill);
+        }else if(in_array($express_code,[59])){
+            //中通
+            return $this->check_zt($waybill);
+        }else if(in_array($express_code,[80])){
+            //TT-UK
+            return $this->check_ttuk($waybill);
+        }else if(in_array($express_code,[83,85])){
+            //
+            return true;
+        }
+        return false;
+    }
+    public function ydCheckByPrintcode($waybill,$print_code){
+        if(in_array($print_code,['3PE_XB','3PE_NONBOX'])){
+            //3pe盒子和非盒子
+            return $this->check_3pe($waybill);
+        }else if(in_array($print_code,['YunExpress_JFPHTKR','YunExpress','YunExpress_BaoXian'])){
+            //云途(美国) 云途欧盟  云途欧盟-带保险
+            return $this->check_yt($waybill);
+        }else if(in_array($print_code,['FedEx_GD','FedEx_G','FEDEXGF','FedEx_2day','HUALEI-FEDEX'])){
+            //云尚快递快线和普货 fedex   fedex(杭州)-不报关 FedEx-US2
+            return $this->check_fedex($waybill);
+        }else if(in_array($print_code,['DHL','HUALEI-DHL'])){
+            //dhl
+            return $this->check_dhl($waybill);
+        }else if(in_array($print_code,['USPS','usps_priority'])){
+            //usps USPS-US2
+            return $this->check_usps($waybill);
+        }else if(in_array($print_code,['HUALEI-UNI'])){
+            //uniuni
+            return $this->check_uniuni($waybill);
+        }else if(in_array($print_code,['GES'])){
+            //ges
+            return $this->check_ges($waybill);
+        }else if(in_array($print_code,['ZXDPD_UK','ZXDPD_BTC','3PE_EU_DPD'])){
+            //正鑫dpd 英国|欧洲  维库dpd
+            return $this->check_dpd($waybill);
+        }else if(in_array($print_code,['HUALEI-ARAMEX-G'])){
+            //惠程安迈世
+            return $this->check_hc_ams($waybill);
+        }else if(in_array($print_code,['HUALEI-MGLB'])){
+            //惠城usps
+            return $this->check_hc_usps($waybill);
+        }else if(in_array($print_code,['HUALEI-GES-EU'])){
+            //惠城ges
+            return $this->check_hc_ges($waybill);
+        }else if(in_array($print_code,['YANWEN'])){
+            //燕文
+            return $this->check_yw($waybill);
+        }else if(in_array($print_code,["SF"])){
+            //顺丰
+            return $this->check_sf($waybill);
+        }else if(in_array($print_code,["ZhongTong"])){
+            //中通
+            return $this->check_zt($waybill);
+        }else if(in_array($print_code,["TTUK"])){
+            //TT-UK
+            return $this->check_ttuk($waybill);
+        }
+        return false;
+    }
+    //76 77
+    protected function check_3pe($waybill){
+        if(strlen($waybill) != 11){
+           return false;
+        }
+        if(strpos($waybill, "WKSD") === false){
+            return false;
+        }
+        return true;
+    }
+
+    //云途快递
+    protected function check_yt($waybill){
+        if(strlen($waybill) != 18){
+            return false;
+         }
+         if(strpos($waybill, "YT") === false){
+             return false;
+         }
+         return true;
+    }
+    //fedex
+    protected function check_fedex($waybill){
+        if(strlen($waybill) != 12){
+            return false;
+         }
+         return true;
+    }
+    //dhl
+    protected function check_dhl($waybill){
+        if(strlen($waybill) != 10){
+            return false;
+         }
+         return true;
+    }
+    //usps
+    protected function check_usps($waybill){
+        if(strlen($waybill) != 22){
+            return false;
+         }
+         return true;
+    }
+
+    //uniuni
+    protected function check_uniuni($waybill){
+        if(strlen($waybill) != 19){
+            return false;
+         }
+         if(strpos($waybill, "UUS") === false){
+            return false;
+        }
+         return true;
+    }
+
+    protected function check_ges($waybill){
+        if(strlen($waybill) != 17){
+            return false;
+        }
+        if(strpos($waybill, "ZCEHC") === false){
+            return false;
+        }
+        return true;
+    }
+
+    protected function check_dpd($waybill){
+        if(strlen($waybill) != 14){
+            return false;
+        }
+        return true;
+    }
+
+    protected function check_hc_ams($waybill){
+        if(strlen($waybill) != 11){
+            return false;
+        }
+        return true;
+    }
+    
+    protected function check_hc_usps($waybill){
+        if(strlen($waybill) != 14){
+            return false;
+        }
+        if(strpos($waybill, "HC") === false && strpos($waybill, "RD") === false){
+            return false;
+        }
+        return true;
+    }
+
+    protected function check_hc_ges($waybill){
+        if(strlen($waybill) != 12){
+            return false;
+        }
+        return true;
+    }
+
+    protected function check_yw($waybill){
+        if(strlen($waybill) != 19 || strlen($waybill) != 13){
+            return false;
+        }
+        return true;
+    }
+
+    protected function check_sf($waybill){
+        if(strlen($waybill) != 15){
+            return false;
+        }
+        if(strpos($waybill, "SF") === false){
+            return false;
+        }
+        return true;
+    }
+
+    protected function check_zt($waybill){
+        if(strlen($waybill) != 14){
+            return false;
+        }
+        return true;
+    }
+
+    protected function check_ttuk($waybill){
+        if(strlen($waybill) != 18){
+            return false;
+        }
+        if(strpos($waybill, "SFWH") === false){
+            return false;
+        }
+        return true;
+    }
+
+
+
+
+
+}