Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
Compass
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zong
Compass
Commits
a364501c
Commit
a364501c
authored
Feb 19, 2020
by
biao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
66844815
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
16 additions
and
10 deletions
+16
-10
compass_db_schema.xlsx
doc/DB/compass_db_schema.xlsx
+0
-0
小程序文件命名以及接口调用说明.xlsx
doc/小程序文件命名以及接口调用说明.xlsx
+0
-0
接口文档 V1.0.xls
doc/接口文档 V1.0.xls
+0
-0
settings.inc
src/settings/settings.inc
+2
-2
ajax_check_user_registed.php
src/user/if/ajax_check_user_registed.php
+14
-8
No files found.
doc/DB/compass_db_schema.xlsx
View file @
a364501c
No preview for this file type
doc/小程序文件命名以及接口调用说明.xlsx
View file @
a364501c
No preview for this file type
doc/接口文档 V1.0.xls
View file @
a364501c
No preview for this file type
src/settings/settings.inc
View file @
a364501c
...
...
@@ -49,8 +49,8 @@ define("SMS_APP_KEY", "3c6208374d1940652303ae08396ce5f8"); //密码
// 微信认证相关【公众号】
define
(
"WECHAT_APP_ID"
,
"wxe
16f5f4f71862e9f
"
);
define
(
"WECHAT_APP_SECRET"
,
"
138738e444eab87a39cf2ed33886da5d
"
);
define
(
"WECHAT_APP_ID"
,
"wxe
ef50c5d0ef117d1
"
);
define
(
"WECHAT_APP_SECRET"
,
"
48dd0dfd509d1438aa4950d7dcdbee9e
"
);
define
(
"WECHAT_AUTH_TOKEN"
,
"COMPASS"
);
define
(
"WECHAT_PAY_MCHID"
,
"1371137902"
);
define
(
"WECHAT_PAY_KEY"
,
"a1b2c3defghijKlmnopqrstuvwx4y5z6"
);
...
...
src/user/if/ajax_check_user_registed.php
View file @
a364501c
...
...
@@ -6,21 +6,23 @@ require_once ("../user_include.inc");
ErrorLogger
::
doOutput
(
"Compass...ajax_check_user_registed.php....Start."
,
0
);
//根据常量获取定义的值
$jsCode
=
ParamUtil
::
getRequestString
(
"code"
,
""
);
$openId
=
ParamUtil
::
getRequestString
(
"openId"
,
""
);
$jsCode
=
ParamUtil
::
getRequestString
(
"code"
);
$openId
=
ParamUtil
::
getRequestString
(
"openId"
);
ErrorLogger
::
doOutput
(
"Compass...ajax_check_user_registed.php....
c
ode="
.
$jsCode
,
0
);
ErrorLogger
::
doOutput
(
"Compass...ajax_check_user_registed.php....
jsC
ode="
.
$jsCode
,
0
);
ErrorLogger
::
doOutput
(
"Compass...ajax_check_user_registed.php....openId="
.
$openId
,
0
);
$result
=
array
();
//如果都为空说明调用错误
if
(
empty
(
$code
)
&&
empty
(
$openId
))
{
if
(
empty
(
$jsCode
)
&&
empty
(
$openId
))
{
ErrorLogger
::
doOutput
(
"Compass...ajax_check_user_registed.php....1"
,
0
);
$result
[
"message"
]
=
"参数错误!"
;
responseNG
(
$result
);
}
//有openId的情况下
if
(
!
empty
(
$openId
))
{
ErrorLogger
::
doOutput
(
"Compass...ajax_check_user_registed.php....2"
,
0
);
//检索数据库
$param
[
'openid'
]
=
$openId
;
$param
[
'delete_flg'
]
=
false
;
...
...
@@ -35,18 +37,22 @@ if(!empty($openId)) {
}
//有code的情况下
if
(
!
empty
(
$js_code
))
{
if
(
!
empty
(
$jsCode
))
{
ErrorLogger
::
doOutput
(
"Compass...ajax_check_user_registed.php....3"
,
0
);
$appId
=
WECHAT_APP_ID
;
$appSecret
=
WECHAT_APP_SECRET
;
//调用微信接口获取用户的openId和unionId
//调用服务器查询并插入数据
$ch
=
curl_init
();
$url
=
"https://api.weixin.qq.com/sns/jscode2session?appid="
.
$appId
.
"&secret="
.
$appSecret
.
"&js_code="
.
$jsCode
.
"&grant_type=authorization_code"
;
ErrorLogger
::
doOutput
(
"Compass...ajax_check_user_registed.php....url="
.
$url
,
0
);
//通过code换取网页授权access_token
$weixin
=
file_get_contents
(
$url
);
$weixinJson
=
json_decode
(
$weixin
);
//对JSON格式的字符串进行编码
$weixinArray
=
get_object_vars
(
$weixinJson
);
//转换成数组
$openId
=
$weixinArray
[
"openid"
];
$json
=
json_decode
(
$weixin
);
//对JSON格式的字符串进行编码
$wxArray
=
get_object_vars
(
$json
);
//转换成数组
$openId
=
$wxArray
[
"openid"
];
$unionId
=
$wxArray
[
"unionid"
];
ErrorLogger
::
doOutput
(
"Compass...ajax_check_user_registed.php....wxArray="
.
print_r
(
$wxArray
,
1
),
0
);
if
(
!
empty
(
$openId
))
{
//检索数据库
$param
[
'openid'
]
=
$openId
;
...
...
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