Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tl_estate
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hujun
tl_estate
Commits
618d214c
Commit
618d214c
authored
Jun 06, 2018
by
clone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
微信授权
parent
43d2caf1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
6 deletions
+16
-6
WxCallbackUntils.php
application/api/untils/WxCallbackUntils.php
+2
-2
WxTest.php
application/index/controller/WxTest.php
+14
-4
No files found.
application/api/untils/WxCallbackUntils.php
View file @
618d214c
...
...
@@ -66,7 +66,7 @@ class WxCallbackUntils
$access_token
=
$access_token_info
->
access_token
;
$open_id
=
$access_token_info
->
openid
;
session
(
"access_token"
,
$access_token
);
session
(
"openid"
,
$open_id
);
session
(
"openid"
,
$open_id
);
$user_info_url
=
'https://api.weixin.qq.com/sns/userinfo'
;
$params
[
'access_token'
]
=
$access_token
;
...
...
@@ -82,7 +82,7 @@ class WxCallbackUntils
'city'
=>
$user_info
->
city
,
'buyer_img'
=>
$user_info
->
headimgurl
);
session
(
"userInfo"
,
$data
);
session
(
"userInfo"
,
$data
);
return
$data
;
}
...
...
application/index/controller/WxTest.php
View file @
618d214c
...
...
@@ -3,6 +3,8 @@
namespace
app\index\controller
;
use
app\api\untils\WxCallbackUntils
;
use
app\index\extend\Basic
;
use
Think\Log
;
/**
* Created by PhpStorm.
...
...
@@ -11,24 +13,31 @@ use app\api\untils\WxCallbackUntils;
* Time : 18:06
* Intro:
*/
class
WxTest
class
WxTest
extends
Basic
{
private
$url
=
"https://pre2.tonglianjituan.com/index/test"
;
private
$_wxApi
;
public
function
__construct
()
{
$this
->
_wxApi
=
new
WxCallbackUntils
();
}
public
function
test
()
{
$code
=
empty
(
$_GET
[
'code'
])
?
null
:
$_GET
[
'code'
];
$userInfo
=
session
(
"userInfo"
);
dump
(
$userInfo
);
if
(
!
$code
)
{
$this
->
_wxApi
->
getWxCode
(
$this
->
url
);
}
else
{
$this
->
_wxApi
->
getUserInfoByAccessToken
(
$code
);
Log
::
record
(
"session wx -----------------"
.
json_encode
(
$userInfo
),
"info"
);
if
(
!
$userInfo
)
{
$this
->
_wxApi
->
getWxCode
(
$this
->
url
);
}
else
{
return
view
(
"test"
);
}
}
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment