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
6b998ff0
Commit
6b998ff0
authored
Mar 19, 2018
by
zhuwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
全部客户(all_user)
parent
01b9a2ad
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
189 additions
and
0 deletions
+189
-0
Client.php
application/api_broker/controller/Client.php
+97
-0
UPhoneFollowPp.php
application/model/UPhoneFollowPp.php
+32
-0
Users.php
application/model/Users.php
+59
-0
route.php
application/route.php
+1
-0
No files found.
application/api_broker/controller/Client.php
View file @
6b998ff0
...
...
@@ -215,4 +215,101 @@ class Client extends Basic
}
public
function
all_user
()
{
header
(
'Access-Control-Allow-Origin:*'
);
$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
[
'type'
]
=
0
;
$params
[
'search_type'
]
=
''
;
#测试数据 end
if
(
!
isset
(
$params
[
'phone_or_name'
])
||
!
isset
(
$params
[
'user_id'
]))
{
return
$this
->
response
(
"300"
,
"参数不全"
,
[
'remote_groupid'
=>
''
]);
}
$phone_or_name
=
trim
(
$params
[
'phone_or_name'
]);
$pagenum
=
isset
(
$params
[
'pagenum'
])
?
$params
[
'pagenum'
]
:
1
;
$pagesize
=
15
;
$user_id
=
$params
[
'user_id'
];
$type
=
$params
[
'type'
];
$search_type
=
$params
[
'search_type'
];
#无:'';客户电话:0;客户姓名:1;跟进:2;
if
(
$search_type
==
'0'
){
//客户电话
$user
=
new
Users
();
// 查询数据集
$user_res
=
$user
->
all_user_search_phone
(
$phone_or_name
,
$pagesize
,
$pagenum
);
//$user_res =$user->user_search($phone_or_name,$Two_days_ago,$user_id,$pagesize,$pagenum);
$total
=
$user
->
all_user_search_count_phone
(
$phone_or_name
);
foreach
(
$user_res
as
$k
=>
$v
){
//dump($v);exit;
$user_res
[
$k
][
'user_nick'
]
=
$v
[
'user_nick'
]
?
$v
[
'user_nick'
]
:
'未知'
;
$user_res
[
$k
][
'label'
]
=
'我的,保护期内'
;
}
}
elseif
(
$search_type
==
'1'
){
//客户电话
$user
=
new
Users
();
// 查询数据集
$user_res
=
$user
->
all_user_search_name
(
$phone_or_name
,
$pagesize
,
$pagenum
);
//$user_res =$user->user_search($phone_or_name,$Two_days_ago,$user_id,$pagesize,$pagenum);
$total
=
$user
->
all_user_search_count_name
(
$phone_or_name
);
foreach
(
$user_res
as
$k
=>
$v
){
//dump($v);exit;
$user_res
[
$k
][
'user_nick'
]
=
$v
[
'user_nick'
]
?
$v
[
'user_nick'
]
:
'未知'
;
$user_res
[
$k
][
'label'
]
=
'我的,保护期内'
;
}
}
elseif
(
$search_type
==
'2'
){
//跟进
$UPhoneFollowPp
=
new
UPhoneFollowPp
();
// 查询电话跟进数据
$user_res
=
$UPhoneFollowPp
->
all_user_search
(
$phone_or_name
,
$pagesize
,
$pagenum
);
$total
=
$UPhoneFollowPp
->
all_user_search_count
(
$phone_or_name
);
}
else
{
//全部客户
$user
=
new
Users
();
// 查询数据集
$user_res
=
$user
->
all_user
(
$pagesize
,
$pagenum
);
//$user_res =$user->user_search($phone_or_name,$Two_days_ago,$user_id,$pagesize,$pagenum);
$total
=
$user
->
all_user_count
();
}
$total
=
intval
(
$total
/
$pagesize
)
+
((
$total
%
$pagesize
==
0
)
?
0
:
1
);
if
(
$search_type
!=
'2'
){
foreach
(
$user_res
as
$k
=>
$v
){
$label
=
array
();
//dump($v);exit;
$user_res
[
$k
][
'user_nick'
]
=
$v
[
'user_nick'
]
?
$v
[
'user_nick'
]
:
'未知'
;
if
(
$user_id
==
$v
[
'agent_id'
]){
$label
[]
=
'我的'
;
}
// dump($v['create_time']);
// $time=strtotime(date("Y-m-d h:i:s"))-strtotime($v['create_time']);
// dump(strtotime(date("Y-m-d h:i:s"))-strtotime($v['create_time']));//48时(h)=172800秒(s)
// exit;
if
((
strtotime
(
date
(
"Y-m-d h:i:s"
))
-
strtotime
(
$v
[
'create_time'
]))
<
172800
){
$label
[]
=
'保护期内'
;
}
$user_res
[
$k
][
'label'
]
=
implode
(
','
,
$label
);
}
}
/*dump($total);
var_dump($user_res);
exit;*/
if
(
$user_res
)
{
return
$this
->
response
(
"200"
,
"success!"
,
[
'user_date'
=>
$user_res
,
'pagenum'
=>
$pagenum
,
'total'
=>
$total
]);
}
else
{
return
$this
->
response
(
"101"
,
"失败!"
);
}
return
$this
->
response
(
200
,
'all_user'
,
[
'all_user'
]);
}
}
application/model/UPhoneFollowPp.php
View file @
6b998ff0
...
...
@@ -123,4 +123,36 @@ class UPhoneFollowPp extends BaseModel
return
$UPhoneFollowPp_res
;
}
public
function
all_user_search
(
$searchdate
,
$pagesize
,
$pagenum
)
{
$UPhoneFollowPp_res
=
db
(
'u_phone_follow_up'
)
//->where('user_id',$user_id)
->
where
(
'content'
,
$searchdate
)
->
order
(
'create_time'
,
'desc'
)
->
limit
(
$pagesize
)
->
page
(
$pagenum
)
->
select
();
/*$total =$UPhoneFollowPp
->where('user_id',$user_id)
->where('content',$searchdate)
->count();*/
return
$UPhoneFollowPp_res
;
}
public
function
all_user_search_count
(
$searchdate
)
{
$UPhoneFollowPp_res
=
db
(
'u_phone_follow_up'
)
//->where('user_id',$user_id)
->
where
(
'content'
,
$searchdate
)
->
order
(
'create_time'
,
'desc'
)
//->limit($pagesize)
//->page($pagenum)
->
select
();
/*$total =$UPhoneFollowPp
->where('user_id',$user_id)
->where('content',$searchdate)
->count();*/
return
$UPhoneFollowPp_res
;
}
}
application/model/Users.php
View file @
6b998ff0
...
...
@@ -283,4 +283,63 @@ class Users extends Model
->select();
return $data;
}*/
public
function
all_user
(
$pagesize
,
$pagenum
)
{
return
db
(
'u_users'
)
//->where('user_nick|user_phone','like',"%$phone_or_name%")
//->where('create_time','< time',$Two_days_ago)//小于两天前,即排除48小时内受保护的客户
->
limit
(
$pagesize
)
->
page
(
$pagenum
)
->
field
(
'id as user_id,sex,user_nick,user_phone,agent_id,create_time'
)
->
select
();
}
public
function
all_user_count
()
{
return
db
(
'u_users'
)
//->where('user_nick|user_phone','like',"%$phone_or_name%")
//->where('create_time','< time',$Two_days_ago)//小于两天前,即排除48小时内受保护的客户
//->field('id as user_id,sex,user_nick,user_phone,create_time')
->
count
();
}
public
function
all_user_search_phone
(
$phone
,
$pagesize
,
$pagenum
)
{
return
db
(
'u_users'
)
->
where
(
'user_phone'
,
'like'
,
"%
$phone
%"
)
//->where('create_time','< time',$Two_days_ago)//小于两天前,即排除48小时内受保护的客户
->
limit
(
$pagesize
)
->
page
(
$pagenum
)
->
field
(
'id as user_id,sex,user_nick,user_phone,agent_id,create_time'
)
->
select
();
}
public
function
all_user_search_count_phone
(
$phone
)
{
return
db
(
'u_users'
)
->
where
(
'user_nick|user_phone'
,
'like'
,
"%
$phone
%"
)
//->where('create_time','< time',$Two_days_ago)//小于两天前,即排除48小时内受保护的客户
//->field('id as user_id,sex,user_nick,user_phone,create_time')
->
count
();
}
public
function
all_user_search_name
(
$name
,
$pagesize
,
$pagenum
)
{
return
db
(
'u_users'
)
->
where
(
'user_nick|user_phone'
,
'like'
,
"%
$name
%"
)
//->where('create_time','< time',$Two_days_ago)//小于两天前,即排除48小时内受保护的客户
->
limit
(
$pagesize
)
->
page
(
$pagenum
)
->
field
(
'id as user_id,sex,user_nick,user_phone,agent_id,create_time'
)
->
select
();
}
public
function
all_user_search_count_name
(
$name
)
{
return
db
(
'u_users'
)
->
where
(
'user_nick|user_phone'
,
'like'
,
"%
$name
%"
)
//->where('create_time','< time',$Two_days_ago)//小于两天前,即排除48小时内受保护的客户
//->field('id as user_id,sex,user_nick,user_phone,create_time')
->
count
();
}
}
application/route.php
View file @
6b998ff0
...
...
@@ -231,6 +231,7 @@ Route::group('api', [
'agentUserFollow'
=>
[
'api_broker/Client/agentUserFollow'
,
[
'method'
=>
'get'
]
],
//客户列表
'agentSearch'
=>
[
'api_broker/Client/agentSearch'
,
[
'method'
=>
'get'
]
],
//经纪人搜索
'getULabelsListApp'
=>
[
'api_broker/Client/getULabelsListApp'
,
[
'method'
=>
'get'
]
],
//客户标签
'all_user'
=>
[
'api_broker/Client/all_user'
,
[
'method'
=>
'post|get'
]
],
//全部客户 朱伟
]);
...
...
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