Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
quxiu
Overview
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
冷斌
quxiu
Commits
89e23453
Commit
89e23453
authored
May 26, 2020
by
冷斌
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bug
parent
481257ac
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
28 deletions
+31
-28
wxshare/Application/Home/Controller/PayController.class.php
+31
-28
No files found.
wxshare/Application/Home/Controller/PayController.class.php
View file @
89e23453
...
...
@@ -5,11 +5,11 @@ class PayController extends Controller {
public
function
index
(){
return
;
}
public
function
wxLogin
(){
//$roomnum=I('roomnum');
$configpri
=
getConfigPri
();
$AppID
=
$configpri
[
'login_wx_appid'
];
$callback
=
get_upload_path
(
'/wxshare/index.php/Pay/wxLoginCallback'
);
//回调地址
//微信登录
...
...
@@ -20,16 +20,16 @@ class PayController extends Controller {
$callback
=
urlencode
(
$callback
);
//snsapi_base 静默 snsapi_userinfo 授权
$wxurl
=
"https://open.weixin.qq.com/connect/oauth2/authorize?appid=
{
$AppID
}
&redirect_uri=
{
$callback
}
&response_type=code&scope=snsapi_userinfo&state=
{
$state
}
#wechat_redirect "
;
header
(
"Location:
$wxurl
"
);
}
public
function
wxLoginCallback
(){
$code
=
I
(
'code'
);
//$roomnum=I('roomnum');
if
(
$code
){
$configpri
=
getConfigPri
();
$AppID
=
$configpri
[
'login_wx_appid'
];
$AppSecret
=
$configpri
[
'login_wx_appsecret'
];
/* 获取token */
...
...
@@ -41,12 +41,12 @@ class PayController extends Controller {
$json
=
curl_exec
(
$ch
);
curl_close
(
$ch
);
$arr
=
json_decode
(
$json
,
1
);
if
(
isset
(
$arr
[
'errcode'
])){
echo
$arr
[
'errmsg'
];
exit
;
}
/* 刷新token 有效期为30天 */
$url
=
"https://api.weixin.qq.com/sns/oauth2/refresh_token?appid=
{
$AppID
}
&grant_type=refresh_token&refresh_token=
{
$arr
[
'refresh_token'
]
}
"
;
$ch
=
curl_init
();
...
...
@@ -55,7 +55,7 @@ class PayController extends Controller {
curl_setopt
(
$ch
,
CURLOPT_URL
,
$url
);
$json
=
curl_exec
(
$ch
);
curl_close
(
$ch
);
$url
=
"https://api.weixin.qq.com/sns/userinfo?access_token=
{
$arr
[
'access_token'
]
}
&openid=
{
$arr
[
'openid'
]
}
&lang=zh_CN"
;
$ch
=
curl_init
();
curl_setopt
(
$ch
,
CURLOPT_SSL_VERIFYPEER
,
FALSE
);
...
...
@@ -74,19 +74,19 @@ class PayController extends Controller {
$authcode
=
'rCt52pF2cnnKNB3Hkp'
;
$uuid
=
md5
(
md5
(
$authcode
.
'123456'
));
session
(
'uuid'
,
$uuid
);
$href
=
'http://'
.
$_SERVER
[
'HTTP_HOST'
]
.
'/wxshare/index.php/Pay/pay'
;
header
(
"Location:
$href
"
);
}
else
{
}
}
public
function
Post
(
$curlPost
,
$url
){
$curl
=
curl_init
();
curl_setopt
(
$curl
,
CURLOPT_URL
,
$url
);
...
...
@@ -121,14 +121,14 @@ class PayController extends Controller {
$uuid
=
session
(
'uuid'
);
//$userinfo=M("users")->field("id,user_nicename,avatar_thumb,coin")->where("id='{$uid}'")->find();
$this
->
assign
(
'uuid'
,
$uuid
);
$chargelist
=
M
(
'charge_rules'
)
->
field
(
'id,coin,money,money_ios,product_id,give'
)
->
order
(
'orderno asc'
)
->
select
();
$this
->
assign
(
'chargelist'
,
$chargelist
);
$this
->
display
();
}
/* 获取用户信息 */
...
...
@@ -140,6 +140,10 @@ class PayController extends Controller {
'data'
=>
array
(),
'msg'
=>
''
,
);
$liang
=
M
(
'liang'
)
->
where
(
"name='
$uid
'"
)
->
getField
(
"uid"
);
if
(
$liang
>
0
)
{
$uid
=
$liang
;
}
$userinfo
=
M
(
"users"
)
->
field
(
"id,user_nicename,avatar_thumb,coin"
)
->
where
(
"id='
{
$uid
}
'"
)
->
find
();
if
(
$userinfo
){
$rs
[
'data'
]
=
$userinfo
;
...
...
@@ -196,17 +200,17 @@ class PayController extends Controller {
}
else
{
$rs
[
'code'
]
=
1002
;
$rs
[
'msg'
]
=
'订单信息错误'
;
}
}
}
echo
json_encode
(
$rs
);
exit
;
}
}
\ 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