OrderTreeController.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. namespace ghs\controllers;
  3. use bizGhs\order\classes\OrderClass;
  4. use bizGhs\order\classes\OrderTreeClass;
  5. use bizGhs\product\classes\ProductClass;
  6. use common\components\imgUtil;
  7. use common\components\util;
  8. use Yii;
  9. class OrderTreeController extends BaseController
  10. {
  11. public function actionGetTree()
  12. {
  13. $get = Yii::$app->request->get();
  14. $orderSn = $get['orderSn'] ?? '';
  15. $productId = $get['productId'] ?? '';
  16. $order = OrderClass::getByCondition(['orderSn' => $orderSn], true);
  17. if (empty($order)) {
  18. util::fail('没有找到订单');
  19. }
  20. if ($order->mainId != $this->mainId) {
  21. util::fail('不是你的订单');
  22. }
  23. $product = ProductClass::getByCondition(['id' => $productId], true);
  24. if (empty($product)) {
  25. util::fail('没有找到花材');
  26. }
  27. if ($product->mainId != $this->mainId) {
  28. util::fail('不是你的花材');
  29. }
  30. $list = OrderTreeClass::getAllByCondition(['orderSn' => $orderSn, 'productId' => $productId], 'id asc', '*');
  31. util::success(['list' => $list]);
  32. }
  33. }