Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
jamesyang1999
ShopXO
提交
66aa691e
ShopXO
项目概览
jamesyang1999
/
ShopXO
与 Fork 源项目一致
Fork自
纵之格 / ShopXO
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
ShopXO
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
66aa691e
编写于
4月 16, 2019
作者:
G
gongfuxiang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
1.5
上级
9e2ac699
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
123 addition
and
11 deletion
+123
-11
application/index/controller/Qrcode.php
application/index/controller/Qrcode.php
+31
-8
application/plugins/petscms/Service.php
application/plugins/petscms/Service.php
+2
-1
application/plugins/view/petscms/pets/index.html
application/plugins/view/petscms/pets/index.html
+1
-1
config/app.php
config/app.php
+1
-1
extend/base/Qrcode.php
extend/base/Qrcode.php
+88
-0
未找到文件。
application/index/controller/Qrcode.php
浏览文件 @
66aa691e
...
...
@@ -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
application/plugins/petscms/Service.php
浏览文件 @
66aa691e
...
...
@@ -111,7 +111,8 @@ class Service
$v
[
'lose_features'
]
=
str_replace
(
"
\n
"
,
'<br />'
,
$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'
]);
...
...
application/plugins/view/petscms/pets/index.html
浏览文件 @
66aa691e
...
...
@@ -162,7 +162,7 @@
</td>
<td
class=
"row-qucode"
>
<img
src=
"{{$v.qrcode_url}}"
alt=
"{{$v.title}}"
/>
<a
href=
"
#
"
>
<a
href=
"
{{$v.qrcode_download}}"
target=
"_blank"
title=
"下载二维码
"
>
<p><i
class=
"am-icon-cloud-download"
></i>
下载二维码
</p>
</a>
</td>
...
...
config/app.php
浏览文件 @
66aa691e
...
...
@@ -19,7 +19,7 @@ return [
// 应用地址
'app_host'
=>
''
,
// 应用调试模式
'app_debug'
=>
tru
e
,
'app_debug'
=>
fals
e
,
// 应用Trace
'app_trace'
=>
false
,
// 是否支持多模块
...
...
extend/base/Qrcode.php
0 → 100644
浏览文件 @
66aa691e
<?php
// +----------------------------------------------------------------------
// | ShopXO 国内领先企业级B2C免费开源电商系统
// +----------------------------------------------------------------------
// | Copyright (c) 2011~2019 http://shopxo.net All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: Devil
// +----------------------------------------------------------------------
namespace
base
;
/**
* 二维码驱动
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2016-12-01T21:51:08+0800
*/
class
Qrcode
{
/**
* 构造方法
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @datetime 2019-04-16T21:13:10+0800
*/
public
function
__construct
()
{
require_once
ROOT
.
'extend'
.
DS
.
'qrcode'
.
DS
.
'phpqrcode.php'
;
}
/**
* 二维码展示
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @datetime 2019-04-16T21:13:16+0800
* @param [array] $params [输入参数]
*/
public
function
View
(
$params
=
[])
{
// 容错率
$level
=
isset
(
$params
[
'level'
])
&&
in_array
(
$params
[
'level'
],
array
(
'L'
,
'M'
,
'Q'
,
'H'
))
?
$params
[
'level'
]
:
'L'
;
// 大小,最小1,最大10
$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
);
}
/**
* 二维码下载
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @datetime 2019-04-16T21:23:01+0800
* @param [array] $params [输入参数]
*/
public
function
Download
(
$params
=
[])
{
// 图片地址
$url
=
base64_decode
(
urldecode
(
$params
[
'url'
]));
// 随机文件名
$filename
=
time
()
.
GetNumberCode
()
.
'.png'
;
// 设置头信息
header
(
'Pragma: public'
);
header
(
'Expires: 0'
);
header
(
'Cache-Control: must-revalidate, post-check=0, pre-check=0'
);
header
(
'Cache-Control: private'
,
false
);
header
(
'Content-Type: application/force-download'
);
header
(
'Content-Disposition: attachment; filename="'
.
$filename
.
'"'
);
header
(
'Content-Transfer-Encoding: binary'
);
header
(
'Connection: close'
);
readfile
(
$url
);
}
}
?>
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录