切换导航条
此项目
正在载入...
登录
景龙
/
xingqiu
·
提交
转到一个项目
GitLab
转到仪表盘
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
景龙
6 years ago
提交
7c906dd0cc3f00472ea8980ba035fbf4e00f2817
1 个父辈
bafbe1c2
1 个管道 的构建
通过
耗费 1 秒
调式微博登录
变更
5
构建
1
隐藏空白字符变更
内嵌
并排对比
正在显示
5 个修改的文件
包含
39 行增加
和
19 行删除
app/portal/controller/LoginController.php
public/themes/simpleboot3/portal/login/third_login.html
public/themes/simpleboot3/public/assets/js/public.js
public/themes/simpleboot3/public/slide.html
public/themes/simpleboot3_mobile/public/assets/js/public.js
app/portal/controller/LoginController.php
查看文件 @
7c906dd
...
...
@@ -22,6 +22,9 @@ class LoginController extends HomeBaseController
private
$appkey
=
737607150
;
//微博appkey
private
$appsecret
=
'd80b43a1e74e8ba095590b36a3459480'
;
//微博appsecret
private
$redirect_uri
=
'http://www.xingqiu.cn/portal/login/wb_login'
;
//回调地址
private
$appkey1
=
'wx9cfa880272f186bf'
;
//微信appkey
private
$appsecret1
=
'11b643393b1e54d6ef5eaa984ba4e545'
;
//微信appsecret
//登录页面
public
function
login
(){
return
$this
->
fetch
();
...
...
@@ -348,15 +351,20 @@ class LoginController extends HomeBaseController
//第三方微信登录
public
function
wx_login
(){
$config
=
Config
::
get
(
'wx_login'
);
$app_id
=
$config
[
'app_id'
];
$redirect_uri
=
$config
[
'redirect_uri'
];
$scope
=
$config
[
'scope'
];
$state
=
md5
(
uniqid
(
rand
(),
TRUE
));
$url
=
'https://open.weixin.qq.com/connect/qrconnect?appid='
.
$app_id
.
'&redirect_uri='
.
$redirect_uri
.
'&response_type=code&scope='
.
$scope
.
'&state='
.
$state
.
'#wechat_redirect'
;
$code
=
$this
->
request
->
get
(
'code'
);
$code
=
'021HoCq91Re1wP1g5Eo91Vgnq91HoCqd'
;
$url
=
'https://api.weixin.qq.com/sns/oauth2/access_token?appid='
.
$this
->
appkey1
.
'&secret='
.
$this
->
appsecret1
.
'&code='
.
$code
.
'&grant_type=authorization_code'
;
$res
=
$this
->
http_get
(
$url
);
var_dump
(
11
);
var_dump
(
$res
);
exit
;
$json_arr
=
json_decode
(
$res
,
true
);
// $token = $json_arr['access_token'];
$token
=
'22_LFufsKgmxT1jCtIuDJ7CLLwAOI7mOPlmNYHRHECuScIwrNZ3-Bmxj8pOjr2NZs7qdzH7iBkPddFtBdyVoBd7zas_gkQhDw3YJgm5iYa6d5w'
;
// $openid = $json_arr['openid'];
$openid
=
'oYOYl5hbULoKimG5R8Uk-Paha0d8'
;
//通过access_token获取用户信息
$url1
=
'https://api.weixin.qq.com/sns/userinfo?access_token='
.
$token
.
'&openid='
.
$openid
;
$res1
=
$this
->
http_get
(
$url1
);
$json_arr1
=
json_decode
(
$res1
,
true
);
var_dump
(
$json_arr1
);
exit
;
}
//第三方微博登录
...
...
@@ -391,6 +399,9 @@ class LoginController extends HomeBaseController
$user
=
$this
->
findThird
(
$where
);
//获取微博id,昵称,头像
$userModel
=
new
UserModel
();
$ip
=
get_client_ip
();
$users
[
'last_login_time'
]
=
time
();
$users
[
'last_login_ip'
]
=
$ip
;
if
(
$user
){
$users
[
'user_nickname'
]
=
$info
[
'screen_name'
];
$users
[
'avatar'
]
=
$info
[
'profile_image_url'
];
...
...
@@ -424,8 +435,7 @@ class LoginController extends HomeBaseController
//取消授权
public
function
wb_cancel
(){
echo
'取消了'
;
// $this->redirect('/');
$this
->
redirect
(
'/'
);
}
//查询第三方用户是否存在
...
...
public/themes/simpleboot3/portal/login/third_login.html
查看文件 @
7c906dd
...
...
@@ -34,7 +34,7 @@
<!--登陆-->
<div
class=
"login_right_main clearfix"
>
<div
class=
"WeChat"
>
<a
href=
""
><img
src=
"__TMPL__/public/assets/starImg/aicon_89.png"
alt=
""
></a>
<a
href=
"
https://open.weixin.qq.com/connect/qrconnect?appid=wx9cfa880272f186bf&redirect_uri=http://www.starplanet.cn/portal/login/wx_login&response_type=code&scope=snsapi_login&state=STATE#wechat_redirect
"
><img
src=
"__TMPL__/public/assets/starImg/aicon_89.png"
alt=
""
></a>
</div>
<form
action=
"https://api.weibo.com/oauth2/authorize"
method=
"POST"
id=
"wb_form"
>
<div
class=
"Sina"
id=
"wb_login"
>
...
...
public/themes/simpleboot3/public/assets/js/public.js
查看文件 @
7c906dd
...
...
@@ -197,6 +197,10 @@ $(function() {
window
.
open
(
'http://v.t.sina.com.cn/share/share.php?'
+
temp
.
join
(
'&'
));
});
$
(
'.weibo_share'
).
click
(
function
()
{
$
(
'#wb_share'
).
submit
();
});
//微博登录
$
(
'#wb_login'
).
click
(
function
(){
$
(
'#wb_form'
).
submit
();
...
...
@@ -204,8 +208,8 @@ $(function() {
});
//点赞收藏
function
operation
(
url
,
id
=
''
)
{
if
(
id
==
''
)
{
function
operation
(
url
,
id
)
{
if
(
id
==
''
||
id
==
undefined
)
{
var
article_id
=
getUrlParam
(
'id'
);
}
else
{
var
article_id
=
$
(
'#li_id'
).
val
();
...
...
public/themes/simpleboot3/public/slide.html
查看文件 @
7c906dd
...
...
@@ -22,8 +22,14 @@
<p>
168
</p>
</div>
<!-- wb分享 -->
<div
class=
"wb_go weibo"
>
<img
src=
"__TMPL__/public/assets/starImg/bicon_05.png"
alt=
""
>
<p>
168
</p>
</div>
<form
action=
"https://api.weibo.com/oauth2/authorize"
method=
"POST"
id=
"wb_share"
>
<div
class=
"wb_go weibo_share"
>
<img
src=
"__TMPL__/public/assets/starImg/bicon_05.png"
alt=
""
>
<p>
168
</p>
</div>
<input
type=
"hidden"
name=
"client_id"
value=
"737607150"
>
<input
type=
"hidden"
name=
"redirect_uri"
value=
"http://www.xingqiu.cn/portal/login/wb_login"
>
<input
type=
"hidden"
name=
"flag"
value=
"1"
>
</form>
</div>
\ No newline at end of file
...
...
public/themes/simpleboot3_mobile/public/assets/js/public.js
查看文件 @
7c906dd
...
...
@@ -264,8 +264,8 @@ function video_mask(msg) {
},
6000
);
}
//点赞收藏
function
operation
(
url
,
id
=
''
)
{
if
(
id
==
''
)
{
function
operation
(
url
,
id
)
{
if
(
id
==
''
||
id
==
undefined
)
{
var
article_id
=
getUrlParam
(
'id'
);
}
else
{
var
article_id
=
$
(
'#li_id'
).
val
();
...
...
请
注册
或
登录
后发表评论