Browse Source

通知制作

shish 9 tháng trước cách đây
mục cha
commit
fefed942ff
1 tập tin đã thay đổi với 26 bổ sung0 xóa
  1. 26 0
      app-hd/controllers/WorkController.php

+ 26 - 0
app-hd/controllers/WorkController.php

@@ -21,6 +21,32 @@ class WorkController extends BaseController
 
     public $guestAccess = [];
 
+    public function actionNeedWork()
+    {
+        $get = Yii::$app->request->get();
+        $id = $get['id'] ?? 0;
+        $order = OrderClass::getById($id, true);
+        if (empty($order)) {
+            util::fail('没有订单');
+        }
+        $mainId = $this->mainId;
+        if ($order->mainId != $mainId) {
+            util::fail('不是你的订单');
+        }
+        if ($order->hasWork == 1) {
+            util::fail('已经通知制作了');
+        }
+        $main = $this->main;
+        WorkClass::needWork($order, $main);
+        $has = WorkClass::getByCondition(['orderId' => $id], true);
+        if (!empty($has)) {
+            $order->hasWork = 1;
+            $order->save();
+            util::complete('通知成功');
+        }
+        util::fail('通知失败');
+    }
+
     //根据订单id查询制作单信息 ssh 20220625
     public function actionGetInfoByOrderId()
     {