diff --git a/application/index/controller/Qrcode.php b/application/index/controller/Qrcode.php index 9883e7def..f5e46d04f 100755 --- a/application/index/controller/Qrcode.php +++ b/application/index/controller/Qrcode.php @@ -28,18 +28,41 @@ class QrCode extends Common } /** - * [Index 首页方法] + * 二维码显示 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @datetime 2019-04-16T21:52:09+0800 */ public function Index() { - require_once ROOT.'extend'.DS.'qrcode'.DS.'phpqrcode.php'; - $params = input(); - $level = isset($params['level']) && in_array($params['level'], array('L','M','Q','H')) ? $params['level'] : 'L'; - $point_size = isset($params['size']) ? min(max(intval($params['size']), 1), 10) : 6; - $mr = isset($params['mr']) ? intval($params['mr']) : 1; - $content = isset($params['content']) ? base64_decode(urldecode(trim($params['content']))) : __MY_URL__; - \QRcode::png($content, false, $level, $point_size, $mr); + if(empty($params['content'])) + { + $this->assign('msg', '内容参数为空'); + return $this->fetch('public/tips_error'); + } + + (new \base\Qrcode())->View($params); + } + + /** + * 二维码下载 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @datetime 2019-04-16T21:52:18+0800 + */ + public function Download() + { + $params = input(); + if(empty($params['url'])) + { + $this->assign('msg', 'url参数为空'); + return $this->fetch('public/tips_error'); + } + + (new \base\Qrcode())->Download($params); } } ?> \ No newline at end of file diff --git a/application/plugins/petscms/Service.php b/application/plugins/petscms/Service.php index 819c8e627..3440d6cff 100644 --- a/application/plugins/petscms/Service.php +++ b/application/plugins/petscms/Service.php @@ -111,7 +111,8 @@ class Service $v['lose_features'] = str_replace("\n", '
', $v['lose_features']); // 二维码 - $v['qrcode_url'] = MyUrl('index/qrcode/index', ['content'=>urlencode(base64_encode(MyUrl('index/goods/index', ['id'=>$v['id']], true, true)))]); + $v['qrcode_url'] = MyUrl('index/qrcode/index', ['content'=>urlencode(base64_encode(PluginsHomeUrl('petscms', 'pets', 'detail', ['id'=>$v['id']])))]); + $v['qrcode_download'] = MyUrl('index/qrcode/download', ['ssurl'=>urlencode(base64_encode($v['qrcode_url']))]); // 地址 $v['province_name'] = RegionService::RegionName($v['lose_province']); diff --git a/application/plugins/view/petscms/pets/index.html b/application/plugins/view/petscms/pets/index.html index b547a0cc0..9f5adb881 100644 --- a/application/plugins/view/petscms/pets/index.html +++ b/application/plugins/view/petscms/pets/index.html @@ -162,7 +162,7 @@ {{$v.title}} - +

下载二维码

diff --git a/config/app.php b/config/app.php index fec2e442c..f84fa55bd 100755 --- a/config/app.php +++ b/config/app.php @@ -19,7 +19,7 @@ return [ // 应用地址 'app_host' => '', // 应用调试模式 - 'app_debug' => true, + 'app_debug' => false, // 应用Trace 'app_trace' => false, // 是否支持多模块 diff --git a/extend/base/Qrcode.php b/extend/base/Qrcode.php new file mode 100644 index 000000000..0ef1481e8 --- /dev/null +++ b/extend/base/Qrcode.php @@ -0,0 +1,88 @@ + \ No newline at end of file