AddSiteExpressCompany.php 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. <?php
  2. /**
  3. * Niushop商城系统 - 团队十年电商经验汇集巨献!
  4. * =========================================================
  5. * Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
  6. * ----------------------------------------------
  7. * 官方网址: https://www.niushop.com
  8. * =========================================================
  9. */
  10. namespace app\event;
  11. use app\model\express\ExpressCompany;
  12. use app\model\express\ExpressCompanyTemplate;
  13. /**
  14. * 增加默认物流公司数据:
  15. */
  16. class AddSiteExpressCompany
  17. {
  18. public function handle($param)
  19. {
  20. if (!empty($param[ 'site_id' ])) {
  21. $template_model = new ExpressCompanyTemplate();
  22. $express_company_model = new ExpressCompany();
  23. $template_data = [
  24. [
  25. 'company_name' => '顺丰速运',
  26. 'sort' => 1,
  27. 'logo' => 'public/static/img/express/shunfeng.png',
  28. 'url' => 'http://www.sf-express.com',
  29. 'express_no' => 'SF',
  30. 'express_no_kd100' => 'shunfeng',
  31. 'express_no_cainiao' => 'SF',
  32. 'content_json' => '[]',
  33. 'background_image' => '',
  34. 'font_size' => 14,
  35. 'width' => 766,
  36. 'height' => 510,
  37. 'scale' => 1.00,
  38. 'create_time' => time(),
  39. 'is_electronicsheet' => 1,
  40. 'print_style' => '[{"template_name":"二联 150 新","template_size":"15001"},{"template_name":"二联 180 新","template_size":"180"},{"template_name":"三联 210 新","template_size":"21001"}]'
  41. ],
  42. [
  43. 'company_name' => '韵达快递',
  44. 'sort' => 2,
  45. 'logo' => 'public/static/img/express/yunda.png',
  46. 'url' => 'http://www.yundaex.com',
  47. 'express_no' => 'YD',
  48. 'express_no_kd100' => '',
  49. 'express_no_cainiao' => '',
  50. 'content_json' => '[]',
  51. 'background_image' => '',
  52. 'font_size' => 14,
  53. 'width' => 766,
  54. 'height' => 510,
  55. 'scale' => 1.00,
  56. 'create_time' => time(),
  57. 'is_electronicsheet' => 0,
  58. 'print_style' => ''
  59. ],
  60. [
  61. 'company_name' => '百世快递',
  62. 'sort' => 3,
  63. 'logo' => 'public/static/img/express/huitongkuaidi.png',
  64. 'url' => 'http://www.800bestex.com/',
  65. 'express_no' => 'HTKY',
  66. 'express_no_kd100' => '',
  67. 'express_no_cainiao' => '',
  68. 'content_json' => '',
  69. 'background_image' => '',
  70. 'font_size' => 14,
  71. 'width' => 766,
  72. 'height' => 510,
  73. 'scale' => 1.00,
  74. 'create_time' => time(),
  75. 'is_electronicsheet' => 0,
  76. 'print_style' => ''
  77. ],
  78. [
  79. 'company_name' => '圆通速递',
  80. 'sort' => 4,
  81. 'logo' => 'public/static/img/express/yuantong.png',
  82. 'url' => 'http://www.yto.net.cn/',
  83. 'express_no' => '',
  84. 'express_no_kd100' => '',
  85. 'express_no_cainiao' => '',
  86. 'content_json' => '',
  87. 'background_image' => '',
  88. 'font_size' => 14,
  89. 'width' => 766,
  90. 'height' => 510,
  91. 'scale' => 1.00,
  92. 'create_time' => time(),
  93. 'is_electronicsheet' => 0,
  94. 'print_style' => ''
  95. ],
  96. [
  97. 'company_name' => '中通快递',
  98. 'sort' => 5,
  99. 'logo' => 'public/static/img/express/zhongtong.png',
  100. 'url' => 'https://www.zto.com/',
  101. 'express_no' => '',
  102. 'express_no_kd100' => '',
  103. 'express_no_cainiao' => '',
  104. 'content_json' => '',
  105. 'background_image' => '',
  106. 'font_size' => 14,
  107. 'width' => 766,
  108. 'height' => 510,
  109. 'scale' => 1.00,
  110. 'create_time' => time(),
  111. 'is_electronicsheet' => 0,
  112. 'print_style' => ''
  113. ],
  114. [
  115. 'company_name' => '申通快递',
  116. 'sort' => 6,
  117. 'logo' => 'public/static/img/express/shentong.png',
  118. 'url' => 'http://www.sto.cn/',
  119. 'express_no' => '',
  120. 'express_no_kd100' => '',
  121. 'express_no_cainiao' => '',
  122. 'content_json' => '',
  123. 'background_image' => '',
  124. 'font_size' => 14,
  125. 'width' => 766,
  126. 'height' => 510,
  127. 'scale' => 1.00,
  128. 'create_time' => time(),
  129. 'is_electronicsheet' => 0,
  130. 'print_style' => ''
  131. ],
  132. [
  133. 'company_name' => '邮政国内标快',
  134. 'sort' => 7,
  135. 'logo' => 'public/static/img/express/youzhengguonei.png',
  136. 'url' => 'http://yjcx.chinapost.com.cn/qps/yjcx',
  137. 'express_no' => '',
  138. 'express_no_kd100' => '',
  139. 'express_no_cainiao' => '',
  140. 'content_json' => '',
  141. 'background_image' => '',
  142. 'font_size' => 14,
  143. 'width' => 766,
  144. 'height' => 510,
  145. 'scale' => 1.00,
  146. 'create_time' => time(),
  147. 'is_electronicsheet' => 1,
  148. 'print_style' => '[{"template_name":"二联 150","template_size":""}]'
  149. ],
  150. [
  151. 'company_name' => '邮政快递包裹',
  152. 'sort' => 8,
  153. 'logo' => 'public/static/img/express/youzhengkd.png',
  154. 'url' => 'http://yjcx.chinapost.com.cn/qps/yjcx',
  155. 'express_no' => '',
  156. 'express_no_kd100' => '',
  157. 'express_no_cainiao' => '',
  158. 'content_json' => '',
  159. 'background_image' => '',
  160. 'font_size' => 14,
  161. 'width' => 766,
  162. 'height' => 510,
  163. 'scale' => 1.00,
  164. 'create_time' => time(),
  165. 'is_electronicsheet' => 1,
  166. 'print_style' => '[{"template_name":"二联 180","template_size":""},{"template_name":"二联 180 新","template_size":"180"}]'
  167. ],
  168. [
  169. 'company_name' => '天天快递',
  170. 'sort' => 9,
  171. 'logo' => 'public/static/img/express/tiantian.png',
  172. 'url' => 'https://www.ttkdex.com/',
  173. 'express_no' => '',
  174. 'express_no_kd100' => '',
  175. 'express_no_cainiao' => '',
  176. 'content_json' => '',
  177. 'background_image' => '',
  178. 'font_size' => 14,
  179. 'width' => 766,
  180. 'height' => 510,
  181. 'scale' => 1.00,
  182. 'create_time' => time(),
  183. 'is_electronicsheet' => 0,
  184. 'print_style' => ''
  185. ]
  186. ];
  187. foreach ($template_data as $item) {
  188. $item[ 'site_id' ] = $param[ 'site_id' ];
  189. $res = $template_model->addExpressCompanyTemplate($item);
  190. if ($res[ 'code' ] >= 0) {
  191. $express_company_model->addExpressCompany([ 'site_id' => $param[ 'site_id' ], 'company_id' => $res[ 'data' ] ]);
  192. }
  193. }
  194. }
  195. }
  196. }