Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
飞鱼0526
ShopXO
提交
a66301c7
ShopXO
项目概览
飞鱼0526
/
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,发现更多精彩内容 >>
提交
a66301c7
编写于
5月 24, 2019
作者:
D
devil_gong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
微信授权
上级
692cc642
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
382 addition
and
0 deletion
+382
-0
application/plugins/view/weixinwebauthorization/admin/admin/index.html
...lugins/view/weixinwebauthorization/admin/admin/index.html
+48
-0
application/plugins/view/weixinwebauthorization/admin/admin/saveinfo.html
...ins/view/weixinwebauthorization/admin/admin/saveinfo.html
+40
-0
application/plugins/view/weixinwebauthorization/index/public/auth_button.html
...view/weixinwebauthorization/index/public/auth_button.html
+1
-0
application/plugins/view/weixinwebauthorization/index/public/auth_text.html
...s/view/weixinwebauthorization/index/public/auth_text.html
+1
-0
application/plugins/weixinwebauthorization/Hook.php
application/plugins/weixinwebauthorization/Hook.php
+85
-0
application/plugins/weixinwebauthorization/admin/Admin.php
application/plugins/weixinwebauthorization/admin/Admin.php
+85
-0
application/plugins/weixinwebauthorization/config.json
application/plugins/weixinwebauthorization/config.json
+30
-0
application/plugins/weixinwebauthorization/index/Auth.php
application/plugins/weixinwebauthorization/index/Auth.php
+75
-0
application/tags.php
application/tags.php
+6
-0
public/static/plugins/css/weixinwebauthorization/admin/admin.css
...static/plugins/css/weixinwebauthorization/admin/admin.css
+11
-0
public/static/upload/images/plugins_weixinwebauthorization/2019/05/24/1558681549248354.jpg
...ns_weixinwebauthorization/2019/05/24/1558681549248354.jpg
+0
-0
未找到文件。
application/plugins/view/weixinwebauthorization/admin/admin/index.html
0 → 100755
浏览文件 @
a66301c7
{{include file="public/header" /}}
<!-- right content start -->
<div
class=
"content-right"
>
<div
class=
"content"
>
<legend>
<span
class=
"fs-16"
>
微信登录
</span>
<a
href=
"{{:MyUrl('admin/pluginsadmin/index')}}"
class=
"fr fs-14 m-t-5 am-icon-mail-reply"
>
返回
</a>
</legend>
<div
class=
"weixinwebauthorization-content"
>
<div
class=
"items"
>
<label>
AppID
</label>
<div>
{{if !empty($data['appid'])}}
{{$data.appid}}
{{else /}}
未填写
{{/if}}
</div>
</div>
<div
class=
"items"
>
<label>
授权方式
</label>
<div>
{{if isset($data['auth_type']) and $data['auth_type'] eq 1}}
弹出授权
{{else /}}
静默授权
{{/if}}
</div>
</div>
<div
class=
"items"
>
<label>
登录授权地址
</label>
<div>
<a
href=
"{{:PluginsHomeUrl('weixinwebauthorization', 'auth', 'index')}}"
target=
"_blank"
>
{{:PluginsHomeUrl('weixinwebauthorization', 'auth', 'index')}}
</a>
</div>
</div>
<a
href=
"{{:PluginsAdminUrl('weixinwebauthorization', 'admin', 'saveinfo')}}"
class=
"am-btn am-btn-secondary am-radius btn-loading-example am-btn-sm am-btn-block edit-submit"
>
编辑
</a>
</div>
</div>
</div>
<!-- right content end -->
<!-- footer start -->
{{include file="public/footer" /}}
<!-- footer end -->
\ No newline at end of file
application/plugins/view/weixinwebauthorization/admin/admin/saveinfo.html
0 → 100755
浏览文件 @
a66301c7
{{include file="public/header" /}}
<!-- right content start -->
<div
class=
"content-right"
>
<div
class=
"content"
>
<!-- form start -->
<form
class=
"am-form form-validation view-save"
action=
"{{:PluginsAdminUrl('weixinwebauthorization', 'admin', 'save')}}"
method=
"POST"
request-type=
"ajax-url"
request-value=
"{{:PluginsAdminUrl('weixinwebauthorization', 'admin', 'index')}}"
enctype=
"multipart/form-data"
>
<legend>
<span
class=
"fs-16"
>
微信登录
</span>
<a
href=
"{{:PluginsAdminUrl('weixinwebauthorization', 'admin', 'index')}}"
class=
"fr fs-14 m-t-5 am-icon-mail-reply"
>
返回
</a>
</legend>
<div
class=
"am-form-group"
>
<label>
appid
<span
class=
"am-form-group-label-tips"
>
公众号/服务号AppID
</span></label>
<input
type=
"text"
name=
"appid"
placeholder=
"appid"
maxlength=
"30"
data-validation-message=
"appid格式最多 30 个字符"
class=
"am-radius"
{{
if
!
empty
($
data
['
appid
'])}}
value=
"{{$data.appid}}"
{{/
if
}}
/>
</div>
<div
class=
"am-form-group"
>
<label>
授权方式
<span
class=
"am-form-group-label-tips"
>
默认 静默授权方式
</span></label>
<div>
{{foreach $is_auth_type_list as $v}}
<label
class=
"am-radio-inline m-r-10"
>
<input
type=
"radio"
name=
"auth_type"
value=
"{{$v.id}}"
{{
if
isset
($
data
['
auth_type
'])
and
$
data
['
auth_type
']
eq
$
v
['
id
']}}
checked=
"checked"
{{
else
/}}{{
if
!
isset
($
data
['
auth_type
'])
and
isset
($
v
['
checked
'])
and
$
v
['
checked
']
eq
true
}}
checked=
"checked"
{{/
if
}}{{/
if
}}
data-am-ucheck
/>
{{$v.name}}
</label>
{{/foreach}}
</div>
</div>
<div
class=
"am-form-group am-form-group-refreshing"
>
<button
type=
"submit"
class=
"am-btn am-btn-primary am-radius btn-loading-example am-btn-sm am-btn-block"
data-am-loading=
"{loadingText:'处理中...'}"
>
保存
</button>
</div>
</form>
<!-- form end -->
</div>
</div>
<!-- right content end -->
<!-- footer start -->
{{include file="public/footer" /}}
<!-- footer end -->
\ No newline at end of file
application/plugins/view/weixinwebauthorization/index/public/auth_button.html
0 → 100755
浏览文件 @
a66301c7
<a
href=
"{{:PluginsHomeUrl('weixinwebauthorization', 'auth', 'index')}}"
class=
"am-btn am-btn-warning am-btn-xs am-radius plugins-touristbuy-login-info-btn"
>
微信登录
</a>
\ No newline at end of file
application/plugins/view/weixinwebauthorization/index/public/auth_text.html
0 → 100644
浏览文件 @
a66301c7
<a
href=
"{{:PluginsHomeUrl('weixinwebauthorization', 'auth', 'index')}}"
>
微信登录
</a>
\ No newline at end of file
application/plugins/weixinwebauthorization/Hook.php
0 → 100644
浏览文件 @
a66301c7
<?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
app\plugins\weixinwebauthorization
;
use
think\Controller
;
/**
* 微信登录 - 钩子入口
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2016-12-01T21:51:08+0800
*/
class
Hook
extends
Controller
{
/**
* 应用响应入口
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @datetime 2019-02-09T14:25:44+0800
* @param [array] $params [输入参数]
*/
public
function
run
(
$params
=
[])
{
if
(
!
empty
(
$params
[
'hook_name'
]))
{
switch
(
$params
[
'hook_name'
])
{
// 用户登录页面顶部钩子
// 用户注册页面钩子
case
'plugins_view_user_login_info_top'
:
case
'plugins_view_user_reg_info_top'
:
$ret
=
$this
->
ButtonHtml
(
$params
);
break
;
// 公共顶部小导航钩子-左侧
case
'plugins_view_header_navigation_top_left'
:
$ret
=
$this
->
NavTextHtml
(
$params
);
break
;
default
:
$ret
=
''
;
}
return
$ret
;
}
}
/**
* 登录登录html
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2019-05-24
* @desc description
* @param array $params [description]
*/
private
function
ButtonHtml
(
$params
=
[])
{
return
$this
->
fetch
(
'../../../plugins/view/weixinwebauthorization/index/public/auth_button'
);
}
/**
* 文字登录html
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2019-05-24
* @desc description
* @param array $params [description]
*/
private
function
NavTextHtml
(
$params
=
[])
{
return
$this
->
fetch
(
'../../../plugins/view/weixinwebauthorization/index/public/auth_text'
);
}
}
?>
\ No newline at end of file
application/plugins/weixinwebauthorization/admin/Admin.php
0 → 100644
浏览文件 @
a66301c7
<?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
app\plugins\weixinwebauthorization\admin
;
use
think\Controller
;
use
app\service\PluginsService
;
/**
* 微信登录 - 后台管理
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2016-12-01T21:51:08+0800
*/
class
Admin
extends
Controller
{
/**
* 首页
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @datetime 2019-02-07T08:21:54+0800
* @param [array] $params [输入参数]
*/
public
function
index
(
$params
=
[])
{
$ret
=
PluginsService
::
PluginsData
(
'weixinwebauthorization'
);
if
(
$ret
[
'code'
]
==
0
)
{
$this
->
assign
(
'data'
,
$ret
[
'data'
]);
return
$this
->
fetch
(
'../../../plugins/view/weixinwebauthorization/admin/admin/index'
);
}
else
{
return
$ret
[
'msg'
];
}
}
/**
* 编辑页面
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @datetime 2019-02-07T08:21:54+0800
* @param [array] $params [输入参数]
*/
public
function
saveinfo
(
$params
=
[])
{
$ret
=
PluginsService
::
PluginsData
(
'weixinwebauthorization'
);
if
(
$ret
[
'code'
]
==
0
)
{
// 授权方式
$is_auth_type_list
=
[
0
=>
array
(
'id'
=>
0
,
'name'
=>
'静默授权'
,
'checked'
=>
true
),
1
=>
array
(
'id'
=>
1
,
'name'
=>
'弹出授权'
),
];
$this
->
assign
(
'is_auth_type_list'
,
$is_auth_type_list
);
$this
->
assign
(
'data'
,
$ret
[
'data'
]);
return
$this
->
fetch
(
'../../../plugins/view/weixinwebauthorization/admin/admin/saveinfo'
);
}
else
{
return
$ret
[
'msg'
];
}
}
/**
* 数据保存
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @datetime 2019-02-07T08:21:54+0800
* @param [array] $params [输入参数]
*/
public
function
save
(
$params
=
[])
{
return
PluginsService
::
PluginsDataSave
([
'plugins'
=>
'weixinwebauthorization'
,
'data'
=>
$params
]);
}
}
?>
\ No newline at end of file
application/plugins/weixinwebauthorization/config.json
0 → 100644
浏览文件 @
a66301c7
{
"base"
:{
"plugins"
:
"weixinwebauthorization"
,
"name"
:
"微信登录"
,
"logo"
:
"
\/
static
\/
upload
\/
images
\/
plugins_weixinwebauthorization
\/
2019
\/
05
\/
24
\/
1558681549248354.jpg"
,
"author"
:
"Devil"
,
"author_url"
:
"https:
\/\/
shopxo.net
\/
"
,
"version"
:
"1.0.0"
,
"desc"
:
"微信授权登录、注册"
,
"apply_terminal"
:[
"pc"
,
"h5"
],
"apply_version"
:[
"1.5.0"
],
"is_home"
:
false
},
"hook"
:{
"plugins_view_user_login_info_top"
:[
"app
\\
plugins
\\
weixinwebauthorization
\\
Hook"
],
"plugins_view_user_reg_info_top"
:[
"app
\\
plugins
\\
weixinwebauthorization
\\
Hook"
],
"plugins_view_header_navigation_top_left"
:[
"app
\\
plugins
\\
weixinwebauthorization
\\
Hook"
]
}
}
\ No newline at end of file
application/plugins/weixinwebauthorization/index/Auth.php
0 → 100644
浏览文件 @
a66301c7
<?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
app\plugins\weixinwebauthorization\index
;
use
think\Controller
;
use
app\service\PluginsService
;
/**
* 微信登录 - 登录授权
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2016-12-01T21:51:08+0800
*/
class
Auth
extends
Controller
{
/**
* 授权
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @datetime 2019-02-07T08:21:54+0800
* @param [array] $params [输入参数]
*/
public
function
index
(
$params
=
[])
{
$ret
=
PluginsService
::
PluginsData
(
'weixinwebauthorization'
);
if
(
$ret
[
'code'
]
==
0
)
{
// 参数校验
if
(
empty
(
$ret
[
'data'
][
'appid'
]))
{
$this
->
assign
(
'msg'
,
'appid未配置'
);
return
$this
->
fetch
(
'public/tips_error'
);
}
// 回调地址
$redirect_uri
=
urlencode
(
PluginsHomeUrl
(
'weixinwebauthorization'
,
'auth'
,
'callback'
));
// 授权方式
$auth_type
=
(
isset
(
$ret
[
'data'
][
'auth_type'
])
&&
$ret
[
'data'
][
'auth_type'
]
==
1
)
?
'snsapi_userinfo'
:
'snsapi_base'
;
// 授权code
$url
=
'https://open.weixin.qq.com/connect/oauth2/authorize?appid='
.
$ret
[
'data'
][
'appid'
]
.
'&redirect_uri='
.
$redirect_uri
.
'&response_type=code&scope='
.
$auth_type
.
'&state=login#wechat_redirect'
;
return
redirect
(
$url
);
}
else
{
$this
->
assign
(
'msg'
,
$ret
[
'msg'
]);
return
$this
->
fetch
(
'public/tips_error'
);
}
}
/**
* 回调
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @datetime 2019-02-07T08:21:54+0800
* @param [array] $params [输入参数]
*/
public
function
callback
(
$params
=
[])
{
echo
'<pre>'
;
print_r
(
$params
);
}
}
?>
\ No newline at end of file
application/tags.php
浏览文件 @
a66301c7
...
...
@@ -103,10 +103,12 @@ return array (
'plugins_view_header_navigation_top_left'
=>
array
(
0
=>
'app\\plugins\\touristbuy\\Hook'
,
1
=>
'app\\plugins\\weixinwebauthorization\\Hook'
,
),
'plugins_view_user_login_info_top'
=>
array
(
0
=>
'app\\plugins\\touristbuy\\Hook'
,
1
=>
'app\\plugins\\weixinwebauthorization\\Hook'
,
),
'plugins_view_user_reg_info'
=>
array
(
...
...
@@ -154,5 +156,9 @@ return array (
array
(
0
=>
'app\\plugins\\wallet\\Hook'
,
),
'plugins_view_user_reg_info_top'
=>
array
(
0
=>
'app\\plugins\\weixinwebauthorization\\Hook'
,
),
);
?>
\ No newline at end of file
public/static/plugins/css/weixinwebauthorization/admin/admin.css
0 → 100755
浏览文件 @
a66301c7
/**
* 首页
*/
.weixinwebauthorization-content
.items
{
margin
:
10px
0
20px
0
;
border-bottom
:
1px
dashed
#f1f1f1
;
padding-bottom
:
20px
;
}
.weixinwebauthorization-content
.edit-submit
{
margin-bottom
:
20px
;
}
\ No newline at end of file
public/static/upload/images/plugins_weixinwebauthorization/2019/05/24/1558681549248354.jpg
0 → 100644
浏览文件 @
a66301c7
8.7 KB
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录