Model_logic_express.php 7.4 KB

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