Model_logic_express.php 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  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. }
  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,87])){
  61. //ges 顺丰 燕文 中通 tt-cbt tt-shipping-usps tt-shipping-fedex
  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','DHL-9'])){
  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','HUALEI-GES-UK'])){
  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",'TTSP-Fedex',"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(strpos($waybill, "WKSD") === false && strpos($waybill, "GEX") === false){
  125. return false;
  126. }
  127. return true;
  128. }
  129. //云途快递
  130. protected function check_yt($waybill){
  131. if(strlen($waybill) != 18){
  132. return false;
  133. }
  134. if(strpos($waybill, "YT") === false){
  135. return false;
  136. }
  137. return true;
  138. }
  139. //fedex
  140. protected function check_fedex($waybill){
  141. if(strlen($waybill) != 12){
  142. return false;
  143. }
  144. return true;
  145. }
  146. //dhl
  147. protected function check_dhl($waybill){
  148. if(strlen($waybill) != 10){
  149. return false;
  150. }
  151. return true;
  152. }
  153. //usps
  154. protected function check_usps($waybill){
  155. if(strlen($waybill) != 22){
  156. return false;
  157. }
  158. return true;
  159. }
  160. //uniuni
  161. protected function check_uniuni($waybill){
  162. if(strlen($waybill) != 19){
  163. return false;
  164. }
  165. if(strpos($waybill, "UUS") === false){
  166. return false;
  167. }
  168. return true;
  169. }
  170. protected function check_ges($waybill){
  171. if(strlen($waybill) != 17){
  172. return false;
  173. }
  174. if(strpos($waybill, "YQ") === false){
  175. return false;
  176. }
  177. return true;
  178. }
  179. protected function check_dpd($waybill){
  180. if(strlen($waybill) != 14){
  181. return false;
  182. }
  183. return true;
  184. }
  185. protected function check_hc_ams($waybill){
  186. if(strlen($waybill) != 11){
  187. return false;
  188. }
  189. return true;
  190. }
  191. protected function check_hc_usps($waybill){
  192. if(strlen($waybill) != 14){
  193. return false;
  194. }
  195. if(strpos($waybill, "HC") === false && strpos($waybill, "RD") === false){
  196. return false;
  197. }
  198. return true;
  199. }
  200. protected function check_hc_ges($waybill){
  201. if(strlen($waybill) != 12){
  202. return false;
  203. }
  204. return true;
  205. }
  206. protected function check_yw($waybill){
  207. if(strlen($waybill) != 19 && strlen($waybill) != 13){
  208. return false;
  209. }
  210. return true;
  211. }
  212. protected function check_sf($waybill){
  213. if(strlen($waybill) != 15){
  214. return false;
  215. }
  216. if(strpos($waybill, "SF") === false){
  217. return false;
  218. }
  219. return true;
  220. }
  221. protected function check_zt($waybill){
  222. if(strlen($waybill) != 14){
  223. return false;
  224. }
  225. return true;
  226. }
  227. protected function check_ttuk($waybill){
  228. if(strlen($waybill) != 18 && strlen($waybill) != 16){
  229. return false;
  230. }
  231. if(strpos($waybill, "SFWH") === false){
  232. return false;
  233. }
  234. return true;
  235. }
  236. }