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
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
69 additions
and
43 deletions
+69
-43
Broker.php
application/api_broker/controller/Broker.php
+14
-14
Client.php
application/api_broker/controller/Client.php
+38
-13
Basic.php
application/api_broker/extend/Basic.php
+17
-16
No files found.
application/api_broker/controller/Broker.php
View file @
9e5a7e9e
...
...
@@ -169,9 +169,9 @@ class Broker extends Basic
$Two_days_ago
=
date
(
"Y-m-d h:i:s"
,
strtotime
(
"-2 day"
));
//dump($Two_days_ago);
$params
=
$this
->
params
;
/* $params['phone_or_name'] ='22';
$params['pagenum'] ='1';
$params['user_id'] ='10';*/
/* $params['phone_or_name'] ='22';
$params['pagenum'] ='1';
$params['user_id'] ='10';*/
if
(
!
isset
(
$params
[
'phone_or_name'
])
||
!
isset
(
$params
[
'user_id'
]))
{
return
$this
->
response
(
"300"
,
"参数不全"
,
[
'remote_groupid'
=>
''
]);
}
...
...
@@ -184,19 +184,19 @@ class Broker extends Basic
$user
=
new
Users
();
// 查询数据集
$user_res
=
$user
->
where
(
'user_nick|user_phone'
,
'like'
,
"%
$phone_or_name
%"
)
->
where
(
'create_time'
,
'< time'
,
$Two_days_ago
)
//小于两天前,即排除48小时内受保护的客户
->
whereOr
(
'agent_id'
,
$user_id
)
->
where
(
'create_time'
,
'< time'
,
$Two_days_ago
)
//小于两天前,即排除48小时内受保护的客户
->
whereOr
(
'agent_id'
,
$user_id
)
->
limit
(
$pagesize
)
->
page
(
$pagenum
)
->
field
(
'id as user_id,sex,user_nick,user_phone'
)
->
select
();
->
limit
(
$pagesize
)
->
page
(
$pagenum
)
->
field
(
'id as user_id,sex,user_nick,user_phone'
)
->
select
();
//$user_res =$user->user_search($phone_or_name,$Two_days_ago,$user_id,$pagesize,$pagenum);
$total
=
$user
->
where
(
'user_nick|user_phone'
,
'like'
,
"%
$phone_or_name
%"
)
->
where
(
'create_time'
,
'< time'
,
$Two_days_ago
)
->
whereOr
(
'agent_id'
,
$user_id
)
->
count
();
->
where
(
'create_time'
,
'< time'
,
$Two_days_ago
)
->
whereOr
(
'agent_id'
,
$user_id
)
->
count
();
$total
=
intval
(
$total
/
$pagesize
)
+
((
$total
%
$pagesize
==
0
)
?
0
:
1
);
$user_res
=
json_decode
(
json_encode
(
$user_res
),
true
);
//对象转数组
...
...
@@ -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
...
...
@@ -29,7 +29,7 @@ class Client extends Basic
}
public
function
selectUser
(){
}
/**
...
...
@@ -54,11 +54,11 @@ 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
){
$data
[
'id'
]
=
$this
->
user
->
id
;
$data
[
'id'
]
=
$this
->
user
->
id
;
$this
->
operating_records
(
$this
->
params
[
'ccr_id'
],
$type
=
3
,
$remark
=
'用户添加'
,
0
,
$data
[
'id'
]);
}
else
{
$this
->
code
=
101
;
...
...
@@ -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
...
...
@@ -145,7 +170,7 @@ class Client extends Basic
$data
[
'search'
]
=
$search
;
}
// echo $where;exit;
// echo $where;exit;
$order
=
"id desc"
;
$data
[
'list'
]
=
$table
->
getAgentUserTb
(
$pageNo
,
$pageSize
,
$order
,
$field
,
$where
);
...
...
@@ -177,14 +202,14 @@ class Client extends Basic
$pageNo
=
empty
(
$params
[
'pageNo'
])
?
1
:
$params
[
'pageNo'
];
$pageSize
=
empty
(
$params
[
'pageSize'
])
?
15
:
$params
[
'pageSize'
];
$field
=
[
'f.id'
,
'f.user_id'
,
'f.agent_id'
,
'f.content'
,
'f.create_time'
,
'a.realname'
,
'a.agentshopname'
,
'a.sub_shopname'
,
"TIMESTAMPDIFF(MINUTE,f.create_time,'
{
$time
}
')as time_minute_diff"
'f.user_id'
,
'f.agent_id'
,
'f.content'
,
'f.create_time'
,
'a.realname'
,
'a.agentshopname'
,
'a.sub_shopname'
,
"TIMESTAMPDIFF(MINUTE,f.create_time,'
{
$time
}
')as time_minute_diff"
];
$where
=
"(u.agent_id in(0,
{
$params
[
'agent_id'
]
}
) or f.user_id is null or TIMESTAMPDIFF(MINUTE,u.create_time,'
{
$time
}
') > 2880 ) "
;
if
(
!
empty
(
$search
)){
...
...
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,21 +86,21 @@ class Basic extends Controller
/*临时验证 end*/
/* 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
$this->userId = $result->data->id;
$this->phone = $result->data->phone;
$this->userNick = $result->data->userNick;
$this->timeStamp_ = $result->timeStamp_;
}
$requestPath = $this->request->routeInfo()["rule"][0] . "/" . $this->request->routeInfo()["rule"][1];
//过滤掉不需要验证token的接口
if (!in_array(trim($requestPath), $this->filterVerify)) {
$this->tokenVerify();
}*/
/* 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
$this->userId = $result->data->id;
$this->phone = $result->data->phone;
$this->userNick = $result->data->userNick;
$this->timeStamp_ = $result->timeStamp_;
}
$requestPath = $this->request->routeInfo()["rule"][0] . "/" . $this->request->routeInfo()["rule"][1];
//过滤掉不需要验证token的接口
if (!in_array(trim($requestPath), $this->filterVerify)) {
$this->tokenVerify();
}*/
}
...
...
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