|
@@ -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;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
|
|
|
}
|