|
|
@@ -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;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+}
|