ExpressController.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. namespace ghs\controllers;
  3. use bizGhs\custom\classes\CustomClass;
  4. use bizGhs\express\classes\ExpressClass;
  5. use bizGhs\order\classes\OrderClass;
  6. use common\components\util;
  7. use Yii;
  8. //用于物流服务
  9. class ExpressController extends BaseController
  10. {
  11. //新建运单 ssh
  12. public function actionAddNewWayBill()
  13. {
  14. $get = Yii::$app->request->get();
  15. $id = $get['id'] ?? 0;
  16. $order = OrderClass::getById($id, true);
  17. if (empty($order)) {
  18. util::fail('没有找到订单');
  19. }
  20. if ($order->mainId != $this->mainId) {
  21. util::fail('不是你的订单');
  22. }
  23. $customId = $order->customId ?? 0;
  24. $custom = CustomClass::getById($customId, true);
  25. if (empty($custom)) {
  26. util::fail('没有找到客户');
  27. }
  28. //要先去后台绑定,这里填写才有用,mainId对应月结账号
  29. $bizIdMap = [
  30. //长春花路鲜花,
  31. '36707' => '4212960899',
  32. //龙岩花掌柜
  33. '50' => '5925274162',
  34. ];
  35. $mainId = $this->mainId;
  36. $bizId = $bizIdMap[$mainId] ?? 0;
  37. if (empty($bizId)) {
  38. util::fail('没有找到月结账号');
  39. }
  40. $params = [
  41. 'bizId' => $bizId,
  42. ];
  43. ExpressClass::addWayBill($params);
  44. }
  45. }