lizhen_gitee пре 1 година
родитељ
комит
829ba873fa

+ 1 - 1
application/api/controller/Upload.php

@@ -31,7 +31,7 @@ class Upload extends Api
         // $host的格式为 bucketname.endpoint,请替换为您的真实信息。(在阿里云中可配置)
         $host =  $config["bucket"].".".$config["endPoint"];
         // $callbackUrl为上传回调服务器的URL,请将下面的IP和Port配置为您自己的真实URL信息。下面有callBack方法
-        $callbackUrl = config('notify_cdnurl').'/api/upload/callBack';
+        $callbackUrl = config('website_url').'/api/upload/callBack';
         $dir = 'images/';          // 用户上传文件时指定的前缀。
         $dir = 'uploads/'.date('Ymd').'/';          // 用户上传文件时指定的前缀。
 

+ 3 - 0
application/config.php

@@ -326,6 +326,9 @@ return [
     //支付回调地址,测试
     'notify_cdnurl' => 'http://yueke.huxiukeji.cn/api/notify/recharge_notify_base',
 
+    //域名
+    'website_url' => 'http://yueke.huxiukeji.cn',
+
     //hitpay支付,正式
     'hitpay' => [
         'apikey' => '096a06e94fb1e0a8b015485bb76ef5dd63c167679297e07331a687327bd8b12e',

+ 26 - 3
application/index/controller/Appdown.php

@@ -3,8 +3,7 @@
 namespace app\index\controller;
 
 use think\Controller;
-use think\Db;
-use think\Request;
+
 
 class Appdown extends Controller
 {
@@ -26,12 +25,36 @@ class Appdown extends Controller
         $this->view->assign('ios_downurl', config('site.ios_downurl'));
 
         //手机端二维码
-        
+        $url = config('website_url').'/index/appdown';
+        $qrcode = $this->inviteimage($url);
+        $this->view->assign('qrcode',$qrcode);
 
 
         return $this->view->fetch($layout);
     }
 
+    private function inviteimage($text) {
+        $params['text'] = $text;
+        $qrcode_service = \addons\qrcode\library\Service::qrcode($params);
+//        $mimetype = 'image/png';
+//        $response = Response::create()->header("Content-Type", $mimetype);
+
+        // 直接显示二维码
+//        header('Content-Type: ' . $qrcode_service->getContentType());
+//        $response->content($qrcode_service->writeString());
+        $qrcodePath = ROOT_PATH . 'public/uploads/qrcode/';
+        if (!is_dir($qrcodePath)) {
+            @mkdir($qrcodePath);
+        }
+        if (is_really_writable($qrcodePath)) {
+            $filename = md5(implode('', $params)) . '.png';
+            $filePath = $qrcodePath . $filename;
+            $qrcode_service->writeFile($filePath);
+        }
+
+        return '/uploads/qrcode/' . $filename;
+    }
+
 
 
 }

+ 1 - 1
application/index/view/appdown/index.html

@@ -158,7 +158,7 @@
 								</a>
 							</div>
 							<div class="c-r align-center justify-center">
-								<img src="/assets/appdown/images/pc_ma.png" alt="" class="ic">
+								<img src="{$qrcode}" alt="" class="ic">
 							</div>
 						</div>
 					</div>