Bläddra i källkod

获取支付宝付款码

shish 2 år sedan
förälder
incheckning
7a34744b67
2 ändrade filer med 25 tillägg och 1 borttagningar
  1. 1 1
      app-ghs/controllers/CustomController.php
  2. 24 0
      app-hd/controllers/PurchaseController.php

+ 1 - 1
app-ghs/controllers/CustomController.php

@@ -40,7 +40,7 @@ class CustomController extends BaseController
         }
         $ghsId = $custom->ghsId ?? 0;
         $salt = $custom->salt ?? '';
-        //有个地方要同步修改,关键词 custom_go_ghs_gathering_code
+        //有个地方要同步修改,关键词 custom_go_ghs_gathering_code
         if (getenv('YII_ENV') == 'production') {
             $url = "https://mall.huahb.cn/#/admin/ghs/pay?id={$ghsId}&salt={$salt}";
         } else {

+ 24 - 0
app-hd/controllers/PurchaseController.php

@@ -29,12 +29,36 @@ use common\components\util;
 use biz\wx\classes\WxMessageClass;
 use bizGhs\order\services\OrderService;
 use common\components\lakala\Lakala;
+use common\components\qrCodeUtil;
 
 class PurchaseController extends BaseController
 {
 
     public $guestAccess = ['detail', 'ali-pay'];
 
+    //获取支付宝付款码 ssh 20240713
+    public function actionGetAliPayCode()
+    {
+        $get = Yii::$app->request->get();
+        $orderSn = $get['orderSn'] ?? '';
+        $info = PurchaseClass::getByCondition(['orderSn' => $orderSn], true);
+        if (empty($info)) {
+            util::fail('没有找到采购单');
+        }
+        if (isset($info->mainId) == false || $info->mainId != $this->mainId) {
+            util::fail('无法访问');
+        }
+        if (getenv('YII_ENV') == 'production') {
+            $url = "https://mall.huahb.cn/#/admin/cg/alipay?orderSn={$orderSn}";
+        } else {
+            $url = "https://mall.huaml.com/#/admin/cg/alipay?orderSn={$orderSn}";
+        }
+        $unique = "order_ali_pay_" . $orderSn;
+        $imgUrl = qrCodeUtil::generateRechargeQrCode($url, $unique);
+        $imageUrl = imgUtil::groupImg($imgUrl);
+        util::success(['imgUrl' => $imageUrl]);
+    }
+
     //确认收货 ssh 20231119
     public function actionConfirmTake()
     {