Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
starsw001
ShopXO
提交
d9918167
ShopXO
项目概览
starsw001
/
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,发现更多精彩内容 >>
提交
d9918167
编写于
5月 26, 2019
作者:
G
gongfuxiang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
微信绑定
上级
b5a41ff5
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
90 addition
and
21 deletion
+90
-21
application/index/view/default/personal/index.html
application/index/view/default/personal/index.html
+3
-1
application/plugins/view/weixinwebauthorization/index/public/auth_text.html
...s/view/weixinwebauthorization/index/public/auth_text.html
+1
-1
application/plugins/weixinwebauthorization/Hook.php
application/plugins/weixinwebauthorization/Hook.php
+33
-16
application/plugins/weixinwebauthorization/config.json
application/plugins/weixinwebauthorization/config.json
+1
-1
application/plugins/weixinwebauthorization/index/Auth.php
application/plugins/weixinwebauthorization/index/Auth.php
+12
-0
application/plugins/weixinwebauthorization/service/Service.php
...cation/plugins/weixinwebauthorization/service/Service.php
+29
-0
application/plugins/weixinwebauthorization/uninstall.sql
application/plugins/weixinwebauthorization/uninstall.sql
+2
-0
application/service/NavigationService.php
application/service/NavigationService.php
+5
-1
application/tags.php
application/tags.php
+4
-1
未找到文件。
application/index/view/default/personal/index.html
浏览文件 @
d9918167
...
...
@@ -32,7 +32,9 @@
<dt>
{{$v.name}}
</dt>
<dd>
{{if isset($v['is_ext']) and $v['is_ext'] eq 1}}
{{$v.value}}
{{if isset($v['value'])}}
{{$v.value}}
{{/if}}
{{else /}}
{{if empty($user[$k])}}
<span
class=
"items-value-empty"
>
未填写
</span>
...
...
application/plugins/view/weixinwebauthorization/index/public/auth_text.html
浏览文件 @
d9918167
<a
href=
"{{:PluginsHomeUrl('weixinwebauthorization', 'auth', 'index')}}"
class=
"am-icon-weixin am-margin-left-xs plugins-weixinwebauthorization-nav-top-text"
>
{{if empty($plugins_data['login_name'])}}微信{{else /}}{{$plugins_data.login_name}}{{/if}}
</a>
\ No newline at end of file
<a
href=
"{{:PluginsHomeUrl('weixinwebauthorization', 'auth', 'index')}}"
class=
"am-icon-weixin am-margin-left-xs am-text-success"
>
{{if empty($plugins_data['login_name'])}}微信{{else /}}{{$plugins_data.login_name}}{{/if}}
</a>
\ No newline at end of file
application/plugins/weixinwebauthorization/Hook.php
浏览文件 @
d9918167
...
...
@@ -11,6 +11,7 @@
namespace
app\plugins\weixinwebauthorization
;
use
think\Controller
;
use
app\service\UserService
;
use
app\service\PluginsService
;
/**
...
...
@@ -32,48 +33,64 @@ class Hook extends Controller
*/
public
function
run
(
$params
=
[])
{
// 目前微信登录只针对手机端
if
(
!
empty
(
$params
[
'hook_name'
])
&&
IsMobile
()
)
$ret
=
''
;
if
(
!
empty
(
$params
[
'hook_name'
]))
{
// 获取登录用户
$user
=
UserService
::
LoginUserInfo
();
switch
(
$params
[
'hook_name'
])
{
// 用户登录页面顶部钩子
// 用户注册页面钩子
case
'plugins_view_user_login_info_top'
:
case
'plugins_view_user_reg_info'
:
$ret
=
$this
->
ButtonHtml
(
$params
);
if
(
empty
(
$user
)
&&
IsMobile
())
{
$ret
=
$this
->
ButtonHtml
(
$params
);
}
break
;
// 公共顶部小导航钩子-左侧
case
'plugins_view_header_navigation_top_left'
:
$ret
=
$this
->
NavTextHtml
(
$params
);
if
(
empty
(
$user
)
&&
IsMobile
())
{
$ret
=
$this
->
NavTextHtml
(
$params
);
}
break
;
//
header代码
case
'plugins_
common_header
'
:
$ret
=
$this
->
Style
(
$params
);
//
用户中心-个人资料
case
'plugins_
service_users_personal_show_field_list_handle
'
:
$ret
=
$this
->
UserPersonalHtml
(
$params
,
$user
);
break
;
default
:
$ret
=
''
;
}
return
$ret
;
}
return
$ret
;
}
/**
*
css
*
用户中心-个人资料
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @datetime 2019-02-06T16:16:34+0800
* @param [array] $params [输入参数]
* @param [array] $user [用户登录信息]
*/
public
function
Style
(
$params
=
[])
public
function
UserPersonalHtml
(
$params
=
[],
$user
=
[])
{
return
'<style type="text/css">
.plugins-weixinwebauthorization-nav-top-text { color: #3db53d; }
</style>'
;
if
(
empty
(
$user
[
'weixin_web_openid'
]))
{
$tips
=
'<a href="'
.
PluginsHomeUrl
(
'weixinwebauthorization'
,
'auth'
,
'index'
)
.
'" class="am-text-success am-icon-weixin"> 绑定</a>'
;
}
else
{
$tips
=
'<a href="javascript:;" class="submit-ajax" data-url="'
.
PluginsHomeUrl
(
'weixinwebauthorization'
,
'auth'
,
'unbind'
)
.
'" data-id="1" data-view="reload" data-msg="解绑后不可恢复、确认操作吗?"> 解绑</a>'
;
}
$params
[
'data'
][
'weixin_web_openid'
]
=
[
'is_ext'
=>
1
,
'name'
=>
'微信绑定'
,
'value'
=>
empty
(
$user
[
'weixin_web_openid'
])
?
'未绑定'
:
$user
[
'weixin_web_openid'
],
'tips'
=>
$tips
,
];
}
/**
...
...
application/plugins/weixinwebauthorization/config.json
浏览文件 @
d9918167
...
...
@@ -26,7 +26,7 @@
"plugins_view_header_navigation_top_left"
:[
"app
\\
plugins
\\
weixinwebauthorization
\\
Hook"
],
"plugins_
common_header
"
:[
"plugins_
service_users_personal_show_field_list_handle
"
:[
"app
\\
plugins
\\
weixinwebauthorization
\\
Hook"
]
}
...
...
application/plugins/weixinwebauthorization/index/Auth.php
浏览文件 @
d9918167
...
...
@@ -23,6 +23,18 @@ use app\plugins\weixinwebauthorization\service\Service;
*/
class
Auth
extends
Controller
{
/**
* 用户解绑
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @datetime 2019-05-26T00:55:08+0800
* @param array $params [description]
*/
public
function
Unbind
(
$params
=
[])
{
return
Service
::
WeixinUnbind
(
$params
);
}
/**
* 支付提示
* @author Devil
...
...
application/plugins/weixinwebauthorization/service/Service.php
浏览文件 @
d9918167
...
...
@@ -23,6 +23,35 @@ use app\service\PluginsService;
*/
class
Service
{
/**
* 微信解绑
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @datetime 2019-05-26T00:56:04+0800
* @param [array] $params [输入参数]
*/
public
static
function
WeixinUnbind
(
$params
=
[])
{
$user
=
UserService
::
LoginUserInfo
();
if
(
!
empty
(
$user
))
{
$data
=
[
'weixin_web_openid'
=>
''
,
'upd_time'
=>
time
(),
];
if
(
Db
::
name
(
'User'
)
->
where
([
'id'
=>
$user
[
'id'
]])
->
update
(
$data
))
{
if
(
UserService
::
UserLoginRecord
(
$user
[
'id'
]))
{
return
DataReturn
(
'解绑成功'
,
0
);
}
}
return
DataReturn
(
'解绑失败'
,
-
100
);
}
return
DataReturn
(
'未登录,不能操作'
,
-
1
);
}
/**
* 微信绑定
* @author Devil
...
...
application/plugins/weixinwebauthorization/uninstall.sql
0 → 100644
浏览文件 @
d9918167
#
用户
-
微信
web
用户
openid
ALTER
TABLE
`s_user`
drop
`weixin_web_openid`
;
\ No newline at end of file
application/service/NavigationService.php
浏览文件 @
d9918167
...
...
@@ -581,6 +581,10 @@ class NavigationService
*/
public
static
function
UsersPersonalShowFieldList
(
$params
=
[])
{
// is_ext 扩展数据 1, key不存在用户字段中可使用该扩展
// name 显示名称
// value 扩展自定义值
// tips html提示操作内容
$data
=
[
'avatar'
=>
[
'name'
=>
'头像'
,
...
...
@@ -607,7 +611,7 @@ class NavigationService
'name'
=>
'注册时间'
],
'upd_time_text'
=>
[
'name'
=>
'
最后
更新时间'
'name'
=>
'更新时间'
],
];
...
...
application/tags.php
浏览文件 @
d9918167
...
...
@@ -86,7 +86,6 @@ return array (
0
=>
'app\\plugins\\expressforkdn\\Hook'
,
1
=>
'app\\plugins\\touristbuy\\Hook'
,
2
=>
'app\\plugins\\homemiddleadv\\Hook'
,
3
=>
'app\\plugins\\weixinwebauthorization\\Hook'
,
),
'plugins_admin_common_header'
=>
array
(
...
...
@@ -151,5 +150,9 @@ return array (
array
(
0
=>
'app\\plugins\\wallet\\Hook'
,
),
'plugins_service_users_personal_show_field_list_handle'
=>
array
(
0
=>
'app\\plugins\\weixinwebauthorization\\Hook'
,
),
);
?>
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录