Bläddra i källkod

红包 余额支付只有超管才能操作

shish 4 år sedan
förälder
incheckning
beeb39e6be

+ 4 - 2
app-ghs/controllers/ShopYeChangeController.php

@@ -17,14 +17,16 @@ class ShopYeChangeController extends BaseController
         $get = Yii::$app->request->get();
         $status = $get['status'] ?? 0;
         $ptStyle = $get['ptStyle'] ?? dict::getDict('ptStyle', 'ghs');
-        $tx = $get['tx'] ?? dict::getDict('yeTx', 'canNot');
         $where = [];
         $where['shopId'] = $this->shopId;
         if (!empty($status)) {
             $where['status'] = $status;
         }
         $where['ptStyle'] = $ptStyle;
-        $where['tx'] = $tx;
+        $tx = $get['tx'] ?? 0;
+        if (!empty($tx)) {
+            $where['tx'] = $tx;
+        }
         $list = ShopYeChangeClass::getChangeList($where);
         util::success($list);
     }

+ 14 - 20
app-hd/controllers/PurchaseController.php

@@ -71,27 +71,9 @@ class PurchaseController extends BaseController
             $post['sendCost'] = isset($post['sendCost']) && is_numeric($post['sendCost']) ? $post['sendCost'] : 0;
 
             $respond = PurchaseService::createPurchase($post, $ghsInfo);
-            $orderSn = $respond->orderSn ?? '';
-            $actPrice = $respond->actPrice ?? '';
-            $realPrice = $respond->realPrice ?? '';
             $transaction->commit();
-            //可以付款的倒计时,实际少120秒,避免支付回调时订单已经自动过期
-            $count = dict::getDict('sale_purchase_order_valid');
-
-            $custom = CustomClass::getById($customId);
-            $hasDebtPay = $custom['debt'] ?? 0;
-
-            $data = [
-                'orderSn' => $orderSn,
-                'actPrice' => $actPrice,
-                'realPrice' => $realPrice,
-                'hasBalancePay' => 1,
-                'hasPayPassword' => 0,
-                'hasDebtPay' => $hasDebtPay,
-                'count' => $count,
-                'balance' => $this->shop->balance ?? 0,
-            ];
-            util::success($data);
+
+            util::success($respond);
 
         } catch (Exception $e) {
             $transaction->rollBack();
@@ -132,6 +114,11 @@ class PurchaseController extends BaseController
     //余额支付 ssh 2021.1.24
     public function actionBalancePay()
     {
+        $shopAdmin = $this->shopAdmin;
+        if (isset($shopAdmin->super) == false || $shopAdmin->super != 1) {
+            util::fail('超管才能操作');
+        }
+
         $get = Yii::$app->request->get();
         $orderSn = $get['orderSn'] ?? 0;
         $password = $get['password'] ?? '';
@@ -181,6 +168,13 @@ class PurchaseController extends BaseController
         if (isset($info['shopId']) == false || $info['shopId'] != $this->shopId) {
             util::fail('没有权限访问');
         }
+
+        $customId = $info['customId'] ?? 0;
+        $custom = CustomClass::getById($customId);
+        $hasDebtPay = $custom['debt'] ?? 0;
+        $info['hasDebtPay'] = $hasDebtPay;
+        $info['balance'] = $this->shop->balance ?? 0;
+
         util::success($info);
     }
 

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

@@ -5,7 +5,9 @@ namespace hd\controllers;
 use biz\shop\classes\ShopClass;
 use biz\sj\services\MerchantExtendService;
 use bizGhs\admin\classes\AdminClass;
+use bizGhs\custom\classes\CustomClass;
 use bizHd\merchant\services\ShopService;
+use bizHd\purchase\classes\PurchaseClass;
 use common\components\dict;
 use common\components\dirUtil;
 use common\components\util;
@@ -240,4 +242,28 @@ class ShopController extends BaseController
         util::success($res);
     }
 
+    //获取采购时的支付方式 shish 20211004
+    public function actionGetCgPayWay()
+    {
+        $get = Yii::$app->request->get();
+        $id = $get['id'] ?? 0;
+
+        $cg = PurchaseClass::getById($id, true);
+        PurchaseClass::valid($cg, $this->shopId);
+        $customId = $cg->customId ?? 0;
+        $custom = CustomClass::getById($customId);
+        $hasDebtPay = $custom['debt'] ?? 0;
+
+        $current = time();
+        $cgDeadTime = strtotime($cg->deadline);
+        $count = ($cgDeadTime - $current) > 0 ? ($cgDeadTime - $current) : 0;
+
+        $data = [];
+        $data['balance'] = $this->shop->balance ?? 0;
+        $data['count'] = $count;
+        $data['hasDebtPay'] = $hasDebtPay;
+
+        util::success($data);
+    }
+
 }