Jelajahi Sumber

退款申请

shish 2 tahun lalu
induk
melakukan
823b871e00
1 mengubah file dengan 22 tambahan dan 0 penghapusan
  1. 22 0
      app-ghs/controllers/RefundController.php

+ 22 - 0
app-ghs/controllers/RefundController.php

@@ -96,9 +96,31 @@ class RefundController extends BaseController
 
         $get = Yii::$app->request->get();
         $id = $get['id'] ?? 0;
+        $version = $get['version'] ?? 0;
+        $confirm = $get['confirm'] ?? 0;
         $refund = RefundOrderClass::getById($id, true);
         RefundOrderClass::valid($refund, $this->mainId);
 
+        $relateOrderSn = $refund->relateOrderSn ?? '';
+        if (empty($relateOrderSn)) {
+            util::fail('没有订单信息');
+        }
+        $refundList = RefundOrderClass::getAllByCondition(['relateOrderSn' => $relateOrderSn], null, '*', null, true);
+        $has = false;
+        if (!empty($refundList)) {
+            foreach ($refundList as $single) {
+                if ($single->status == 1) {
+                    $has = true;
+                }
+            }
+        }
+        if ($version == 0 && $has == true) {
+            util::fail('请先升级系统');
+        }
+        if ($has == true && $confirm == 0) {
+            util::success(['notFirstApply' => 1]);
+        }
+
         $connection = Yii::$app->db;//事务处理
         $transaction = $connection->beginTransaction();
         try {