Model_logic_express.php 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  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. }
  108. return false;
  109. }
  110. //76 77
  111. protected function check_3pe($waybill){
  112. if(strlen($waybill) != 11){
  113. return false;
  114. }
  115. if(strpos($waybill, "WKSD") === false){
  116. return false;
  117. }
  118. return true;
  119. }
  120. //云途快递
  121. protected function check_yt($waybill){
  122. if(strlen($waybill) != 18){
  123. return false;
  124. }
  125. if(strpos($waybill, "YT") === false){
  126. return false;
  127. }
  128. return true;
  129. }
  130. //fedex
  131. protected function check_fedex($waybill){
  132. if(strlen($waybill) != 12){
  133. return false;
  134. }
  135. return true;
  136. }
  137. //dhl
  138. protected function check_dhl($waybill){
  139. if(strlen($waybill) != 10){
  140. return false;
  141. }
  142. return true;
  143. }
  144. //usps
  145. protected function check_usps($waybill){
  146. if(strlen($waybill) != 22){
  147. return false;
  148. }
  149. return true;
  150. }
  151. //uniuni
  152. protected function check_uniuni($waybill){
  153. if(strlen($waybill) != 19){
  154. return false;
  155. }
  156. if(strpos($waybill, "UUS") === false){
  157. return false;
  158. }
  159. return true;
  160. }
  161. protected function check_ges($waybill){
  162. if(strlen($waybill) != 17){
  163. return false;
  164. }
  165. if(strpos($waybill, "ZCEHC") === false){
  166. return false;
  167. }
  168. return true;
  169. }
  170. protected function check_dpd($waybill){
  171. if(strlen($waybill) != 14){
  172. return false;
  173. }
  174. return true;
  175. }
  176. protected function check_hc_ams($waybill){
  177. if(strlen($waybill) != 11){
  178. return false;
  179. }
  180. return true;
  181. }
  182. protected function check_hc_usps($waybill){
  183. if(strlen($waybill) != 14){
  184. return false;
  185. }
  186. if(strpos($waybill, "HC") === false && strpos($waybill, "RD") === false){
  187. return false;
  188. }
  189. return true;
  190. }
  191. protected function check_hc_ges($waybill){
  192. if(strlen($waybill) != 12){
  193. return false;
  194. }
  195. return true;
  196. }
  197. protected function check_yw($waybill){
  198. if(strlen($waybill) != 19 || strlen($waybill) != 13){
  199. return false;
  200. }
  201. return true;
  202. }
  203. protected function check_sf($waybill){
  204. if(strlen($waybill) != 15){
  205. return false;
  206. }
  207. if(strpos($waybill, "SF") === false){
  208. return false;
  209. }
  210. return true;
  211. }
  212. protected function check_zt($waybill){
  213. if(strlen($waybill) != 14){
  214. return false;
  215. }
  216. return true;
  217. }
  218. protected function check_ttuk($waybill){
  219. if(strlen($waybill) != 18){
  220. return false;
  221. }
  222. if(strpos($waybill, "SFWH") === false){
  223. return false;
  224. }
  225. return true;
  226. }
  227. }