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
81ed586d
Commit
81ed586d
authored
Jul 25, 2019
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
全局验证用户状态
parent
9f4a31e1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
65 additions
and
6 deletions
+65
-6
Basic.php
application/api_broker/extend/Basic.php
+23
-6
Basic.php
application/index/extend/Basic.php
+42
-0
No files found.
application/api_broker/extend/Basic.php
View file @
81ed586d
...
...
@@ -163,7 +163,7 @@ class Basic extends Controller
echo
json_encode
(
array
(
"code"
=>
"300"
,
"msg"
=>
"AuthToken不能为空!"
,
"data"
=>
[],
"type"
=>
"json"
));
exit
;
}
//
$this->verifyAgentInfo();
$this
->
verifyAgentInfo
();
$this
->
verifyTime
();
}
...
...
@@ -186,11 +186,28 @@ class Basic extends Controller
public
function
verifyAgentInfo
()
{
$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
))
{
echo
json_encode
(
array
(
"code"
=>
"300"
,
"msg"
=>
"用户验证失败,重新登录!"
,
"data"
=>
[],
"type"
=>
"json"
));
$agent_status
=
$agentModel
->
getAgentsById
(
$this
->
agentId
,
'status'
);
if
(
$agent_status
!=
0
)
{
switch
(
$agent_status
)
{
case
1
:
$msg
=
'您目前是长假状态,请联系人事进行更改'
;
break
;
case
2
:
$msg
=
'您目前是已离职状态,请联系人事进行更改。'
;
break
;
case
3
:
$msg
=
'您已转勤,请重登录。'
;
break
;
case
4
:
$msg
=
'该账号已被列入黑名单!'
;
break
;
case
5
:
$msg
=
'该账号已被冻结!'
;
break
;
default
:
$msg
=
'帐号异常'
;
}
echo
json_encode
(
array
(
"code"
=>
"300"
,
"msg"
=>
$msg
,
"data"
=>
[],
"type"
=>
"json"
));
exit
;
}
return
true
;
...
...
application/index/extend/Basic.php
View file @
81ed586d
...
...
@@ -138,6 +138,7 @@ class Basic extends Controller
if
(
!
in_array
(
$requestPath
,
$this
->
filterVerify
))
{
$this
->
userVerify
();
$this
->
userAuth
(
$requestPath
);
$this
->
verifyAgentInfo
(
$this
->
userId
);
}
//获取默认城市
...
...
@@ -463,4 +464,44 @@ class Basic extends Controller
exit
;
}
}
/**
* @return bool
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
verifyAgentInfo
()
{
$agentModel
=
new
AAgents
();
$agent_status
=
$agentModel
->
getAgentsById
(
$this
->
userId
,
'status'
);
if
(
$agent_status
!=
0
)
{
switch
(
$agent_status
)
{
case
1
:
$msg
=
'您目前是长假状态,请联系人事进行更改'
;
break
;
case
2
:
$msg
=
'您目前是已离职状态,请联系人事进行更改。'
;
break
;
case
3
:
$msg
=
'您已转勤,请重登录。'
;
break
;
case
4
:
$msg
=
'该账号已被列入黑名单!'
;
break
;
case
5
:
$msg
=
'该账号已被冻结!'
;
break
;
default
:
$msg
=
'帐号异常'
;
}
if
(
$this
->
request
->
isAjax
())
{
echo
json_encode
(
array
(
"code"
=>
"300"
,
"msg"
=>
$msg
,
"data"
=>
[],
"type"
=>
"json"
));
exit
;
}
else
{
$this
->
success
(
$msg
,
'/index/login'
);
}
}
return
true
;
}
}
\ 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