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
9e5a7e9e
Commit
9e5a7e9e
authored
Mar 05, 2018
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
token 修改
parent
c66a313c
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
6 deletions
+32
-6
Broker.php
application/api_broker/controller/Broker.php
+2
-2
Client.php
application/api_broker/controller/Client.php
+27
-2
Basic.php
application/api_broker/extend/Basic.php
+3
-2
No files found.
application/api_broker/controller/Broker.php
View file @
9e5a7e9e
...
...
@@ -363,8 +363,8 @@ class Broker extends Basic
*/
public
function
token
(){
$jwt
=
new
JwtUntils
();
$
phone
=
$this
->
params
[
'phone'
];
$token
=
$jwt
->
createToken
(
$
phone
);
$
data
[
'phone'
]
=
$this
->
params
[
'phone'
];
$token
=
$jwt
->
createToken
(
$
data
);
return
$this
->
response
(
200
,
""
,
[
'AuthToken'
=>
$token
]);
}
...
...
application/api_broker/controller/Client.php
View file @
9e5a7e9e
...
...
@@ -54,7 +54,7 @@ class Client extends Basic
$data
[
'start'
]
=
$this
->
user
->
edit
(
$this
->
params
);
if
(
$data
[
'start'
]
==
-
1
)
{
$this
->
code
=
101
;
$this
->
msg
=
'该
客户手机号已存在于系统内!
'
;
$this
->
msg
=
'该
用户已存在
'
;
}
if
(
$data
[
'start'
]
==
1
){
...
...
@@ -78,7 +78,32 @@ class Client extends Basic
}
/**经纪人搜索
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
agentSearch
(){
header
(
'Access-Control-Allow-Origin:*'
);
$table
=
new
Agents
;
$data
[
'msg'
]
=
''
;
$params
=
$this
->
request
->
param
();
$pageNo
=
empty
(
$params
[
'pageNo'
])
?
1
:
$params
[
'pageNo'
];
$pageSize
=
empty
(
$params
[
'pageSize'
])
?
15
:
$params
[
'pageSize'
];
$field
=
[
'id'
,
'realname'
,
'phone'
];
$where
=
'level in(2,5) '
;
if
(
!
empty
(
$params
[
'search'
])){
$where
.=
" and realname like '%
{
$params
[
'search'
]
}
%' or phone like '%
{
$params
[
'search'
]
}
%' "
;
$data
[
'search'
]
=
$params
[
'search'
];
}
$order
=
"id desc"
;
$data
[
'list'
]
=
$table
->
searchList
(
$pageNo
,
$pageSize
,
$order
,
$field
,
$where
);
$total
=
$table
->
searchTotal
(
$where
);
$data
[
'total'
]
=
ceil
(
$total
/
$pageSize
);
$data
[
'page'
]
=
$pageNo
;
return
$this
->
response
(
200
,
'成功'
,
$data
);
}
/**经纪人搜索
* @return \think\Response
...
...
application/api_broker/extend/Basic.php
View file @
9e5a7e9e
...
...
@@ -70,7 +70,8 @@ class Basic extends Controller
$this
->
authToken
=
$this
->
params
[
'AuthToken'
];
$result
=
$jwt
->
decode
(
$this
->
authToken
,
config
(
'jwt_key'
),
array
(
'HS256'
));
//解码token
$this
->
timeStamp_
=
$result
->
timeStamp_
;
$is
=
Db
::
table
(
'agents'
)
->
where
(
'phone'
,
$result
->
data
)
->
count
();
$this
->
agentPhone
=
$result
->
data
->
phone
;
$is
=
Db
::
table
(
'agents'
)
->
where
(
'phone'
,
$result
->
data
->
phone
)
->
count
();
if
(
$is
==
0
)
{
echo
json_encode
(
array
(
"code"
=>
"300"
,
"msg"
=>
"用户验证失败,重新登录!"
,
"data"
=>
[],
"type"
=>
"json"
));
...
...
@@ -85,7 +86,7 @@ class Basic extends Controller
/*临时验证 end*/
/* if (isset($this->params['AuthToken']) && $this->params['AuthToken'] != 'null' && !empty($this->params['AuthToken'])) {
/* if (isset($this->params['AuthToken']) && $this->params['AuthToken'] != 'null' && !empty($this->params['AuthToken'])) {
$jwt = new \Firebase\JWT\JWT();
$this->authToken = $this->params['AuthToken'];
$result = $jwt->decode($this->authToken, config('jwt_key'), array( 'HS256' )); //解码token
...
...
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