shish 2 лет назад
Родитель
Сommit
2194496dc8
1 измененных файлов с 39 добавлено и 0 удалено
  1. 39 0
      app-ghs/controllers/OrderController.php

+ 39 - 0
app-ghs/controllers/OrderController.php

@@ -34,6 +34,45 @@ class OrderController extends BaseController
 
 
     public $guestAccess = ['create-order', 'order-relate', 'fast-pay', 'info'];
     public $guestAccess = ['create-order', 'order-relate', 'fast-pay', 'info'];
 
 
+    //修改平账标识状态 ssh 20240405
+    public function actionModifyClearSign()
+    {
+        $get = Yii::$app->request->get();
+        $id = $get['id'] ?? '';
+        $order = OrderClass::getById($id, true);
+        if (empty($order)) {
+            util::fail('没有找到订单');
+        }
+        if ($order->mainId != $this->mainId) {
+            util::fail('不是你的订单');
+        }
+        if (!in_array($order->status, [3, 4])) {
+            util::fail('订单没有发货');
+        }
+        if ($order->clearSign == 1) {
+            util::fail('不需要重复操作');
+        }
+
+        $connection = Yii::$app->db;
+        $transaction = $connection->beginTransaction();
+        try {
+            $order->clearSign = 1;
+            $cgId = $order->purchaseId;
+            $cg = PurchaseClass::getById($cgId, true);
+            if (empty($cg)) {
+                util::fail('没有找到采购信息');
+            }
+            $cg->clearSign = 1;
+            $cg->save();
+            $transaction->commit();
+            util::complete();
+        } catch (\Exception $e) {
+            $transaction->rollBack();
+            Yii::error("操作失败原因:" . $e->getMessage());
+            util::fail('操作失败');
+        }
+    }
+
     //下载图片版订单 ssh 20240321
     //下载图片版订单 ssh 20240321
     public function actionDown()
     public function actionDown()
     {
     {