shish 2 meses atrás
pai
commit
bddccddd2b
1 arquivos alterados com 38 adições e 0 exclusões
  1. 38 0
      app-ghs/controllers/OrderTreeController.php

+ 38 - 0
app-ghs/controllers/OrderTreeController.php

@@ -0,0 +1,38 @@
+<?php
+
+namespace ghs\controllers;
+
+use bizGhs\order\classes\OrderClass;
+use bizGhs\order\classes\OrderTreeClass;
+use bizGhs\product\classes\ProductClass;
+use common\components\imgUtil;
+use common\components\util;
+use Yii;
+
+class OrderTreeController extends BaseController
+{
+
+    public function actionGetTree()
+    {
+        $get = Yii::$app->request->get();
+        $orderSn = $get['orderSn'] ?? '';
+        $productId = $get['productId'] ?? '';
+        $order = OrderClass::getByCondition(['orderSn' => $orderSn], true);
+        if (empty($order)) {
+            util::fail('没有找到订单');
+        }
+        if ($order->mainId != $this->mainId) {
+            util::fail('不是你的订单');
+        }
+        $product = ProductClass::getByCondition(['id' => $productId], true);
+        if (empty($product)) {
+            util::fail('没有找到花材');
+        }
+        if ($product->mainId != $this->mainId) {
+            util::fail('不是你的花材');
+        }
+        $list = OrderTreeClass::getAllByCondition(['orderSn' => $orderSn, 'productId' => $productId], 'id asc', '*');
+        util::success(['list' => $list]);
+    }
+
+}