Model_logic_express.php 7.7 KB

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