shish 5 лет назад
Родитель
Сommit
3d3ebcada1
2 измененных файлов с 9 добавлено и 6 удалено
  1. 8 5
      app-hd/controllers/PurchaseController.php
  2. 1 1
      common/components/dict.php

+ 8 - 5
app-hd/controllers/PurchaseController.php

@@ -193,10 +193,17 @@ class PurchaseController extends BaseController
             util::fail('订单号无效');
         }
         $id = $order->id;
+        $order->changePrice = 2;
+        $order->save();
+
+        $deadline = $order->deadline;
+        $current = date("Y-m-d H:i:s");
+        if ((strtotime($deadline) + 20) < strtotime($current)) {
+            util::fail('订单已经失效');
+        }
 
         $name = $orderSn;
         $totalFee = $order->realPrice;
-
         //强制使用小程序的miniOpenId
         $openId = isset($this->admin) && !empty($this->admin) ? $this->admin->miniOpenId : '';
         if (empty($openId)) {
@@ -238,14 +245,10 @@ class PurchaseController extends BaseController
 
         //强制使用小程序的miniAppId
         $merchantExtend['wxAppId'] = $merchantExtend['miniAppId'];
-
         $wxOrder = \WxPayApi::unifiedOrder($input, 6, $merchantExtend);
         $tools = new \JsApiPay();
         $jsApiParameters = $tools->GetJsApiParameters($wxOrder, $merchantExtend);
         $newParams = json_decode($jsApiParameters, true);
-        $current = date("Y-m-d H:i:s");
-        $updateData = ['deadline' => $current, 'changePrice' => 2];
-        PurchaseClass::updateById($id, $updateData);
         $newParams['id'] = $id;
         util::success($newParams);
     }

+ 1 - 1
common/components/dict.php

@@ -26,7 +26,7 @@ class dict
         ],
 
         //采购和销售单的有效期
-        'sale_purchase_order_valid' => 180,
+        'sale_purchase_order_valid' => 200,
 
         //需要显示国兰的信息 0不需要 1需要(需要提交审核小程序时请显示国兰信息)
         'showGlInfo' => 1,