123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- <?php
- namespace app\index\controller;
- use think\Controller;
- class Appdown extends Controller
- {
-
- public function index() {
- $layout = 'index';
- if(request()->isMobile())
- {
- $layout = 'h5';
- }
- $this->view->assign('android_apkUrl', config("site.android_apkUrl"));
- $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);
-
- $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;
- }
- }
|