shish há 8 meses atrás
pai
commit
5676c5daf6
1 ficheiros alterados com 15 adições e 6 exclusões
  1. 15 6
      app-ghs/controllers/RenewController.php

+ 15 - 6
app-ghs/controllers/RenewController.php

@@ -89,6 +89,7 @@ class RenewController extends BaseController
         ini_set('date.timezone', 'Asia/Shanghai');
         $get = Yii::$app->request->get();
         $year = $get['year'] ?? 1;
+        $type = $get['type'] ?? 0;
         $orderSn = orderSn::getRenewSn();
         $staff = $this->shopAdmin;
         $staffId = $staff->id ?? 0;
@@ -103,15 +104,23 @@ class RenewController extends BaseController
         $pfLevel = $shop->pfLevel ?? 0;
         $deadline = $shop->deadline ?? '';
         $beforeDeadline = $shop->beforeDeadline ?? '';
-        if (getenv('YII_ENV') == 'production') {
-            $unitPrice = $pfLevel == 0 ? 1580 : 2580;
-            if ($mainId == 50) {
-                $unitPrice = $pfLevel == 0 ? 0.5 : 1;
+
+        if ($type == 0) {
+            if (getenv('YII_ENV') == 'production') {
+                $unitPrice = $pfLevel == 0 ? 1580 : 2580;
+                if ($mainId == 50) {
+                    $unitPrice = $pfLevel == 0 ? 0.5 : 1;
+                }
+            } else {
+                $unitPrice = $pfLevel == 0 ? 0.1 : 0.2;
             }
+            $price = bcmul($unitPrice, $year, 2);
         } else {
-            $unitPrice = $pfLevel == 0 ? 0.1 : 0.2;
+            $price = $get['price'] ?? 0;
+            if ($price <= 0) {
+                util::fail('请输入金额');
+            }
         }
-        $price = bcmul($unitPrice, $year, 2);
         $data = [
             'orderSn' => $orderSn,
             'prePrice' => $price,