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
32771c62
Commit
32771c62
authored
Aug 07, 2018
by
clone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug
parent
28e15be6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
19 deletions
+23
-19
Basic.php
application/api_broker/extend/Basic.php
+23
-19
No files found.
application/api_broker/extend/Basic.php
View file @
32771c62
...
...
@@ -78,14 +78,14 @@ class Basic extends Controller
}
if
(
isset
(
$this
->
params
[
'AuthToken'
])
&&
$this
->
params
[
'AuthToken'
]
!=
'null'
&&
!
empty
(
$this
->
params
[
'AuthToken'
]))
{
$jwt
=
new
\Firebase\JWT\JWT
();
$jwt
=
new
\Firebase\JWT\JWT
();
try
{
$result
=
$jwt
->
decode
(
$this
->
params
[
'AuthToken'
],
config
(
'jwt_key'
),
array
(
'HS256'
));
//解码token
}
catch
(
UnexpectedValueException
$e
)
{
$result
=
$jwt
->
decode
(
$this
->
params
[
'AuthToken'
],
config
(
'jwt_key'
),
array
(
'HS256'
));
//解码token
}
catch
(
UnexpectedValueException
$e
)
{
echo
json_encode
(
array
(
"code"
=>
"300"
,
"msg"
=>
"AuthToken参数错误!"
,
"data"
=>
[],
"type"
=>
"json"
));
exit
;
}
catch
(
InvalidArgumentException
$e
)
{
}
catch
(
InvalidArgumentException
$e
)
{
echo
json_encode
(
array
(
"code"
=>
"300"
,
"msg"
=>
"AuthToken参数错误!"
,
"data"
=>
[],
"type"
=>
"json"
));
exit
;
}
...
...
@@ -102,7 +102,7 @@ class Basic extends Controller
$requestPath
=
$this
->
request
->
routeInfo
()[
"rule"
][
0
]
.
"/"
.
$this
->
request
->
routeInfo
()[
"rule"
][
1
];
//过滤掉不需要验证token的接口
if
(
!
in_array
(
trim
(
$requestPath
),
$this
->
filterVerify
))
{
$this
->
tokenVerify
();
$this
->
tokenVerify
();
// $this->userAuth(trim($requestPath));
}
unset
(
$this
->
params
[
"AuthToken"
]);
...
...
@@ -112,11 +112,13 @@ class Basic extends Controller
* 默认城市选择
* @param $agentId
*/
public
function
getCity
(
$agentId
){
public
function
getCity
(
$agentId
)
{
$redis_
=
RedisExt
::
getRedis
();
if
(
$redis_
){
$this
->
city
=
$redis_
->
get
(
"agent_city_"
.
$agentId
);
}
else
{
if
(
$redis_
)
{
$city
=
$redis_
->
get
(
"agent_city_"
.
$agentId
);
$this
->
city
=
empty
(
$city
)
?
"上海"
:
$city
;
}
else
{
$this
->
city
=
"上海"
;
}
...
...
@@ -153,11 +155,11 @@ class Basic extends Controller
*/
public
function
verifyAgentInfo
()
{
$agentModel
=
new
AAgents
();
$agentModel
=
new
AAgents
();
$params
[
"status"
]
=
0
;
$params
[
"id"
]
=
$this
->
agentId
;
$agentArr
=
$agentModel
->
getAgentById
(
"id,store_id,name,phone"
,
$params
);
if
(
count
(
$agentArr
)
>
0
&&
(
$agentArr
[
"id"
]
!=
$this
->
agentId
))
{
$params
[
"id"
]
=
$this
->
agentId
;
$agentArr
=
$agentModel
->
getAgentById
(
"id,store_id,name,phone"
,
$params
);
if
(
count
(
$agentArr
)
>
0
&&
(
$agentArr
[
"id"
]
!=
$this
->
agentId
))
{
echo
json_encode
(
array
(
"code"
=>
"300"
,
"msg"
=>
"用户验证失败,重新登录!"
,
"data"
=>
[],
"type"
=>
"json"
));
exit
;
}
...
...
@@ -275,11 +277,11 @@ class Basic extends Controller
public
static
function
corsRequestHander
()
{
return
[
'Access-Control-Allow-Origin'
=>
'*'
,
'Access-Control-Allow-Origin'
=>
'*'
,
'Access-Control-Allow-Credentials'
=>
true
,
'Access-Control-Allow-Methods'
=>
'GET,POST,OPTIONS'
,
'Access-Defined-X-Support'
=>
'service@cuci.cc'
,
'Access-Defined-X-Servers'
=>
'Guangzhou Cuci Technology Co. Ltd'
,
'Access-Control-Allow-Methods'
=>
'GET,POST,OPTIONS'
,
'Access-Defined-X-Support'
=>
'service@cuci.cc'
,
'Access-Defined-X-Servers'
=>
'Guangzhou Cuci Technology Co. Ltd'
,
];
}
...
...
@@ -307,7 +309,8 @@ class Basic extends Controller
* @param $requestPath
* @return bool
*/
public
function
userAuth
(
$requestPath
){
public
function
userAuth
(
$requestPath
)
{
$agents
=
new
AAgents
();
$is_auth
=
$agents
->
agentsAuthId
(
$this
->
agentId
,
$requestPath
);
...
...
@@ -323,7 +326,8 @@ class Basic extends Controller
];
if
(
in_array
(
$requestPath
,
$auth_arr
)
&&
empty
(
$is_auth
)
&&
$this
->
agentId
!=
1
)
{
echo
json_encode
(
array
(
"code"
=>
"300"
,
"msg"
=>
"没有权限!"
,
"data"
=>
[],
"type"
=>
"json"
));
exit
;
echo
json_encode
(
array
(
"code"
=>
"300"
,
"msg"
=>
"没有权限!"
,
"data"
=>
[],
"type"
=>
"json"
));
exit
;
}
return
true
;
...
...
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