Model_logic_express.php 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  1. <?php
  2. /**
  3. * 封装一些常规的订单操作
  4. */
  5. class Model_logic_express extends Lin_Model {
  6. function __construct(){
  7. parent::__construct();
  8. }
  9. public function ydCheckById($waybill,$express_code){
  10. if(in_array($express_code,[76,77])){
  11. //3pe盒子和非盒子
  12. return $this->check_3pe($waybill);
  13. }else if(in_array($express_code,[82,66,67])){
  14. //云途(美国) 云途欧盟 云途欧盟-带保险
  15. return $this->check_yt($waybill);
  16. }else if(in_array($express_code,[71,75,31,63,50])){
  17. //云尚快递快线和普货 fedex fedex(杭州)-不报关 FedEx-US2 惠城联邦
  18. return $this->check_fedex($waybill);
  19. }else if(in_array($express_code,[1,69,90])){
  20. //dhl
  21. return $this->check_dhl($waybill);
  22. }else if(in_array($express_code,[2,64])){
  23. //usps USPS-US2
  24. return $this->check_usps($waybill);
  25. }else if(in_array($express_code,[81])){
  26. //uniuni
  27. return $this->check_uniuni($waybill);
  28. }
  29. // else if(in_array($express_code,[7])){
  30. // //ges
  31. // return $this->check_ges($waybill);
  32. // }
  33. else if(in_array($express_code,[78,79,84])){
  34. //正鑫dpd 英国|欧洲 维库dpd
  35. return $this->check_dpd($waybill);
  36. }else if(in_array($express_code,[52])){
  37. //惠程安迈世
  38. return $this->check_hc_ams($waybill);
  39. }else if(in_array($express_code,[73])){
  40. //惠城usps
  41. return $this->check_hc_usps($waybill);
  42. }else if(in_array($express_code,[51,88])){
  43. //惠城ges
  44. return $this->check_ges($waybill);
  45. }else if(in_array($express_code,[91])){
  46. //惠程的加拿大小包
  47. return $this->check_ubi($waybill);
  48. }
  49. // else if(in_array($express_code,[35])){
  50. // //燕文
  51. // return $this->check_yw($waybill);
  52. // }else if(in_array($express_code,[14])){
  53. // //顺丰
  54. // return $this->check_sf($waybill);
  55. // }else if(in_array($express_code,[59])){
  56. // //中通
  57. // return $this->check_zt($waybill);
  58. // }
  59. else if(in_array($express_code,[80])){
  60. //TT-UK
  61. return $this->check_ttuk($waybill);
  62. }
  63. else if(in_array($express_code,[7,14,35,59,83,85,87])){
  64. //ges 顺丰 燕文 中通 tt-cbt tt-shipping-usps tt-shipping-fedex
  65. return true;
  66. }
  67. return false;
  68. }
  69. public function ydCheckByPrintcode($waybill,$print_code){
  70. if(in_array($print_code,['3PE_XB','3PE_NONBOX'])){
  71. //3pe盒子和非盒子
  72. return $this->check_3pe($waybill);
  73. }else if(in_array($print_code,['YunExpress_JFPHTKR','YunExpress','YunExpress_BaoXian'])){
  74. //云途(美国) 云途欧盟 云途欧盟-带保险
  75. return $this->check_yt($waybill);
  76. }else if(in_array($print_code,['FedEx_GD','FEDEX_G','FEDEXGF','FedEx_2day','HUALEI-FEDEX'])){
  77. //云尚快递快线和普货 fedex fedex(杭州)-不报关 FedEx-US2 惠城联邦
  78. return $this->check_fedex($waybill);
  79. }else if(in_array($print_code,['DHL','HUALEI-DHL','DHL-9'])){
  80. //dhl
  81. return $this->check_dhl($waybill);
  82. }else if(in_array($print_code,['USPS','usps_priority'])){
  83. //usps USPS-US2
  84. return $this->check_usps($waybill);
  85. }else if(in_array($print_code,['HUALEI-UNI'])){
  86. //uniuni
  87. return $this->check_uniuni($waybill);
  88. }
  89. // else if(in_array($print_code,['GES'])){
  90. // //ges
  91. // return $this->check_ges($waybill);
  92. // }
  93. else if(in_array($print_code,['ZXDPD_UK','ZXDPD_BTC','3PE_EU_DPD'])){
  94. //正鑫dpd 英国|欧洲 维库dpd
  95. return $this->check_dpd($waybill);
  96. }else if(in_array($print_code,['HUALEI-ARAMEX-G'])){
  97. //惠程安迈世
  98. return $this->check_hc_ams($waybill);
  99. }else if(in_array($print_code,['HUALEI-MGLB'])){
  100. //惠城usps
  101. return $this->check_hc_usps($waybill);
  102. }else if(in_array($print_code,['HUALEI-GES-EU','HUALEI-GES-UK'])){
  103. //惠城ges
  104. return $this->check_ges($waybill);
  105. }else if(in_array($print_code,['HUALEI-XB-CA'])){
  106. //惠城ges
  107. return $this->check_ubi($waybill);
  108. }
  109. // else if(in_array($print_code,['YANWEN'])){
  110. // //燕文
  111. // return $this->check_yw($waybill);
  112. // }else if(in_array($print_code,["SF"])){
  113. // //顺丰
  114. // return $this->check_sf($waybill);
  115. // }else if(in_array($print_code,["ZhongTong"])){
  116. // //中通
  117. // return $this->check_zt($waybill);
  118. // }
  119. else if(in_array($print_code,["TTUK"])){
  120. //TT-UK
  121. return $this->check_ttuk($waybill);
  122. }else if(in_array($print_code,['GES','YANWEN',"TTUS","TTSP",'TTSP-Fedex',"SF","ZhongTong"])){
  123. //ges 顺丰 燕文 中通 tt-cbt tt-shipping
  124. return true;
  125. }
  126. return false;
  127. }
  128. //76 77
  129. protected function check_3pe($waybill){
  130. if(strpos($waybill, "WKSD") === false && strpos($waybill, "GEX") === false){
  131. return false;
  132. }
  133. return true;
  134. }
  135. //云途快递
  136. protected function check_yt($waybill){
  137. if(strlen($waybill) != 18){
  138. return false;
  139. }
  140. if(strpos($waybill, "YT") === false){
  141. return false;
  142. }
  143. return true;
  144. }
  145. //fedex
  146. protected function check_fedex($waybill){
  147. if(strlen($waybill) != 12){
  148. return false;
  149. }
  150. return true;
  151. }
  152. //dhl
  153. protected function check_dhl($waybill){
  154. if(strlen($waybill) != 10){
  155. return false;
  156. }
  157. return true;
  158. }
  159. //usps
  160. protected function check_usps($waybill){
  161. if(strlen($waybill) != 22){
  162. return false;
  163. }
  164. return true;
  165. }
  166. //uniuni
  167. protected function check_uniuni($waybill){
  168. if(strlen($waybill) != 19){
  169. return false;
  170. }
  171. if(strpos($waybill, "UUS") === false){
  172. return false;
  173. }
  174. return true;
  175. }
  176. protected function check_ges($waybill){
  177. if(strlen($waybill) != 17){
  178. return false;
  179. }
  180. if(strpos($waybill, "YQ") === false){
  181. return false;
  182. }
  183. return true;
  184. }
  185. protected function check_dpd($waybill){
  186. if(strlen($waybill) != 14){
  187. return false;
  188. }
  189. return true;
  190. }
  191. protected function check_hc_ams($waybill){
  192. if(strlen($waybill) != 11){
  193. return false;
  194. }
  195. return true;
  196. }
  197. protected function check_hc_usps($waybill){
  198. if(strlen($waybill) != 14){
  199. return false;
  200. }
  201. if(strpos($waybill, "HC") === false && strpos($waybill, "RD") === false){
  202. return false;
  203. }
  204. return true;
  205. }
  206. protected function check_hc_ges($waybill){
  207. if(strlen($waybill) != 12){
  208. return false;
  209. }
  210. return true;
  211. }
  212. protected function check_yw($waybill){
  213. if(strlen($waybill) != 19 && strlen($waybill) != 13){
  214. return false;
  215. }
  216. return true;
  217. }
  218. protected function check_sf($waybill){
  219. if(strlen($waybill) != 15){
  220. return false;
  221. }
  222. if(strpos($waybill, "SF") === false){
  223. return false;
  224. }
  225. return true;
  226. }
  227. protected function check_zt($waybill){
  228. if(strlen($waybill) != 14){
  229. return false;
  230. }
  231. return true;
  232. }
  233. protected function check_ttuk($waybill){
  234. if(strlen($waybill) != 18 && strlen($waybill) != 16){
  235. return false;
  236. }
  237. if(strpos($waybill, "SFWH") === false){
  238. return false;
  239. }
  240. return true;
  241. }
  242. protected function check_ubi($waybill){
  243. if(strlen($waybill) != 16){
  244. return false;
  245. }
  246. return true;
  247. }
  248. }