xieruidong 2 years ago
parent
commit
455b51881e

+ 6 - 0
application/common.php

@@ -2,6 +2,7 @@
 
 // 公共助手函数
 
+use addons\qrcode\library\Service;
 use app\admin\model\Admin;
 use app\common\model\User;
 use app\common\service\SubService;
@@ -654,4 +655,9 @@ function moneyFormat($amount,$unit='y'){
         default:
             return $amount*100;
     }
+}
+
+function makeQrcode($text){
+    $qrCode = Service::qrcode(['text' => $text]);
+    return sprintf('data:image/png;base64,%s',base64_encode($qrCode->writeString()));
 }

+ 3 - 1
application/common/service/OrderPayService.php

@@ -63,8 +63,10 @@ class OrderPayService{
             $this->returnUrl(),
             'scan',
         );
+
+        $str=$payData['code_url'];
         return [
-            'url'=>$payData->getTargetUrl(),
+            'qr'=>$str,
         ];
    }
    public function notifyUrl(){

+ 5 - 1
application/extra/addons.php

@@ -14,6 +14,7 @@ return [
         ],
         'app_init' => [
             'epay',
+            'qrcode',
         ],
         'ems_send' => [
             'faems',
@@ -28,7 +29,10 @@ return [
             'simditor',
         ],
     ],
-    'route' => [],
+    'route' => [
+        '/qrcode$' => 'qrcode/index/index',
+        '/qrcode/build$' => 'qrcode/index/build',
+    ],
     'priority' => [],
     'domain' => '',
 ];