xieruidong 2 jaren geleden
bovenliggende
commit
8b0ecced39

+ 7 - 3
application/common/library/WxPublic.php

@@ -19,8 +19,8 @@ class WxPublic
     public function __construct()
     {
         $this->app=Factory::officialAccount([
-            'app_id'=>config('site.user_appid'),
-            'secret'=>config('site.user_appsecret'),
+            'app_id'=>config('site.wx_open_appid'),
+            'secret'=>config('site.wx_open_secret'),
             'log' => [
                 'level' => 'debug',
                 'file' => RUNTIME_PATH.'/wxp/wechat.log',
@@ -40,5 +40,9 @@ class WxPublic
         return $this->app;
     }
 
-
+    public function qr(){
+        return $this->getApp()
+            ->qrcode
+            ->temporary(session_create_id(),3600);
+    }
 }

+ 1 - 0
application/common/service/WxOpenService.php

@@ -3,6 +3,7 @@ namespace app\common\service;
 
 
 use app\common\model\User;
+use EasyWeChat\Factory;
 use GuzzleHttp\Client;
 use think\Cache;
 

+ 3 - 0
application/index/controller/Index.php

@@ -3,6 +3,7 @@
 namespace app\index\controller;
 
 use app\common\controller\Frontend;
+use app\common\library\WxPublic;
 use app\common\model\Mobile;
 use app\common\service\MobileComputer;
 use app\service\byte_dance\ByteDance;
@@ -20,6 +21,8 @@ class Index extends Frontend
 
     public function index()
     {
+        $qr=(new WxPublic)->qr();
+        dd($qr);
     }
     public function payment($a=null){
         if(!$a){