shish 1 năm trước cách đây
mục cha
commit
254b3b061b
1 tập tin đã thay đổi với 16 bổ sung1 xóa
  1. 16 1
      app-hd/controllers/RechargeController.php

+ 16 - 1
app-hd/controllers/RechargeController.php

@@ -27,11 +27,26 @@ class RechargeController extends BaseController
     //获取商城端充值页小程序短链接和说明内容
     public function actionGetMallRechargeShortLink()
     {
+        $get = Yii::$app->request->get();
+        if (getenv('YII_ENV') == 'dev') {
+            util::success(['rechargeAccountLink' => 'www.google.com', 'orderLink' => 'www.google.com']);
+        }
+        $orderId = $get['orderId'] ?? 0;
         $account = $this->shopId;
         $page = 'pages/member/recharge?account=' . $account;
         $ret = WxMiniClass::getShortLink($page);
         $link = $ret['link'] ?? '';
-        util::success(['link' => $link]);
+        $orderLink = '';
+        if (!empty($orderId)) {
+            $order = OrderClass::getById($orderId, true);
+            if ($order->mainId != $this->mainId) {
+                util::fail('访问错误');
+            }
+            $orderPage = 'pages/member/recharge?account=' . $account . '&id=' . $orderId;
+            $res = WxMiniClass::getShortLink($orderPage);
+            $orderLink = $res['link'] ?? '';
+        }
+        util::success(['rechargeAccountLink' => $link, 'orderLink' => $orderLink]);
     }
 
     //获取扫码充值的小程序码 ssh 20250307