Model_logic_express.php 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  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. if(strpos($waybill, "YS") === false){
  145. return false;
  146. }
  147. if(strlen($waybill) != 12){
  148. return false;
  149. }
  150. return true;
  151. }
  152. //云途快递
  153. protected function check_yt($waybill){
  154. if(strlen($waybill) != 18){
  155. return false;
  156. }
  157. if(strpos($waybill, "YT") === false){
  158. return false;
  159. }
  160. return true;
  161. }
  162. //fedex
  163. protected function check_fedex($waybill){
  164. if(strlen($waybill) != 12){
  165. return false;
  166. }
  167. return true;
  168. }
  169. //dhl
  170. protected function check_dhl($waybill){
  171. if(strlen($waybill) != 10){
  172. return false;
  173. }
  174. return true;
  175. }
  176. //usps
  177. protected function check_usps($waybill){
  178. if(strlen($waybill) != 22){
  179. return false;
  180. }
  181. return true;
  182. }
  183. //uniuni
  184. protected function check_uniuni($waybill){
  185. if(strlen($waybill) != 19){
  186. return false;
  187. }
  188. if(strpos($waybill, "UUS") === false){
  189. return false;
  190. }
  191. return true;
  192. }
  193. protected function check_ges($waybill){
  194. if(strlen($waybill) != 17){
  195. return false;
  196. }
  197. if(strpos($waybill, "YQ") === false){
  198. return false;
  199. }
  200. return true;
  201. }
  202. protected function check_dpd($waybill){
  203. if(strlen($waybill) != 14){
  204. return false;
  205. }
  206. return true;
  207. }
  208. protected function check_hc_ams($waybill){
  209. if(strlen($waybill) != 11){
  210. return false;
  211. }
  212. return true;
  213. }
  214. protected function check_hc_usps($waybill){
  215. if(strlen($waybill) != 14){
  216. return false;
  217. }
  218. if(strpos($waybill, "HC") === false && strpos($waybill, "RD") === false){
  219. return false;
  220. }
  221. return true;
  222. }
  223. protected function check_hc_ges($waybill){
  224. if(strlen($waybill) != 12){
  225. return false;
  226. }
  227. return true;
  228. }
  229. protected function check_yw($waybill){
  230. if(strlen($waybill) != 19 && strlen($waybill) != 13){
  231. return false;
  232. }
  233. return true;
  234. }
  235. protected function check_sf($waybill){
  236. if(strlen($waybill) != 15){
  237. return false;
  238. }
  239. if(strpos($waybill, "SF") === false){
  240. return false;
  241. }
  242. return true;
  243. }
  244. protected function check_zt($waybill){
  245. if(strlen($waybill) != 14){
  246. return false;
  247. }
  248. return true;
  249. }
  250. protected function check_ttuk($waybill){
  251. if(strlen($waybill) != 18 && strlen($waybill) != 16){
  252. return false;
  253. }
  254. if(strpos($waybill, "SFWH") === false){
  255. return false;
  256. }
  257. return true;
  258. }
  259. protected function check_ubi($waybill){
  260. if(strlen($waybill) != 16){
  261. return false;
  262. }
  263. return true;
  264. }
  265. }