Model_logic_express.php 8.9 KB

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