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
e860c1b9
Commit
e860c1b9
authored
Aug 22, 2018
by
zhuwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
客户详情上一页下一页接口 (客户跟进列表)
parent
3582725f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
193 additions
and
1 deletion
+193
-1
User.php
application/api_broker/controller/User.php
+168
-0
UPhoneFollowPp.php
application/model/UPhoneFollowPp.php
+23
-0
route.php
application/route.php
+2
-1
No files found.
application/api_broker/controller/User.php
View file @
e860c1b9
...
@@ -6,6 +6,8 @@ use app\api_broker\extend\Basic;
...
@@ -6,6 +6,8 @@ use app\api_broker\extend\Basic;
use
app\api_broker\service\ClientService
;
use
app\api_broker\service\ClientService
;
use
app\api_broker\service\UserExpiredTimeService
;
use
app\api_broker\service\UserExpiredTimeService
;
use
app\api_broker\service\VipService
;
use
app\api_broker\service\VipService
;
use
app\model\AAgents
;
use
app\model\UPhoneFollowPp
;
use
app\model\Users
;
use
app\model\Users
;
use
think\Request
;
use
think\Request
;
...
@@ -490,4 +492,169 @@ class User extends Basic
...
@@ -490,4 +492,169 @@ class User extends Basic
);
);
}
}
/**
* 客户详情上一页下一页接口 (客户跟进列表)
* @return \think\Response
* 朱伟 2018-08-07
*/
public
function
getLastOrNextUserIDPhoneFollowPu
()
{
header
(
'Access-Control-Allow-Origin:*'
);
$params
=
$this
->
params
;
// $checkResult = $this->validate($params, "UserGetLastOrNextUserIdValidate.verifyStatus");
// if (true !== $checkResult) {
// return $this->response("300", $checkResult);
// }
// $params = array(
// "id" => 1956,
// "agent_id" => 9,
// "type" =>"next",
// );
$last_month
=
date
(
"Y-m-d"
,
strtotime
(
"-1 month"
));
if
(
!
empty
(
$this
->
params
[
'start_date'
])
&&
empty
(
$this
->
params
[
'end_date'
]))
{
if
(
strtotime
(
$last_month
)
>
strtotime
(
$this
->
params
[
'start_date'
]))
{
$where
[
'a.create_time'
]
=
[
'> time'
,
$last_month
.
' 00:00:00'
];
}
else
{
$where
[
'a.create_time'
]
=
[
'> time'
,
$this
->
params
[
'start_date'
]
.
' 00:00:00'
];
}
}
else
{
$where
[
'a.create_time'
]
=
[
'> time'
,
$last_month
.
' 00:00:00'
];
}
if
(
!
empty
(
$this
->
params
[
'end_date'
])
&&
empty
(
$this
->
params
[
'start_date'
]))
{
$where
[
'a.create_time'
]
=
[
'< time'
,
$this
->
params
[
'end_date'
]
.
' 23:59:59'
];;
}
if
(
!
empty
(
$this
->
params
[
'end_date'
])
&&
!
empty
(
$this
->
params
[
'start_date'
]))
{
if
(
strtotime
(
$last_month
)
>
strtotime
(
$this
->
params
[
'start_date'
]))
{
$start_date
=
$last_month
;
}
else
{
$start_date
=
$this
->
params
[
'start_date'
];
}
$where
[
'a.create_time'
]
=
[
'between'
,[
$start_date
.
' 00:00:00'
,
$this
->
params
[
'end_date'
]
.
' 23:59:59'
]];
}
if
(
!
empty
(
$this
->
params
[
'content'
]))
{
$where
[
'a.content'
]
=
[
'LIKE'
,
"%
{
$this
->
params
[
'content'
]
}
%"
];
}
//跟进人名字
if
(
!
empty
(
$this
->
params
[
'remark_name'
]))
{
if
(
mb_strlen
(
$this
->
params
[
'remark_name'
])
<
2
)
{
// return $this->response(101, '名字长度不足2位');
}
$agent_where
[
'a.name'
]
=
[
'LIKE'
,
'%'
.
$this
->
params
[
'remark_name'
]
.
'%'
];
}
//跟进人手机号
if
(
!
empty
(
$this
->
params
[
'remark_phone'
]))
{
$agent_where
[
'a.phone'
]
=
$this
->
params
[
'remark_phone'
];
}
//跟进人门店
if
(
!
empty
(
$this
->
params
[
'remark_store_id'
]))
{
$agent_where
[
'a.store_id'
]
=
$this
->
params
[
'remark_store_id'
];
}
//跟进人部门
if
(
!
empty
(
$this
->
params
[
'remark_district_id'
]))
{
$agent_where
[
'a.district_id'
]
=
$this
->
params
[
'remark_district_id'
];
}
if
(
!
empty
(
$this
->
params
[
'province'
]))
{
$where
[
'a.province'
]
=
$this
->
params
[
'province'
];
}
if
(
!
empty
(
$this
->
params
[
'city'
]))
{
$where
[
'a.city'
]
=
$this
->
params
[
'city'
];
}
if
(
!
empty
(
$this
->
params
[
'disc'
]))
{
$where
[
'a.disc'
]
=
$this
->
params
[
'disc'
];
}
if
(
!
empty
(
$this
->
params
[
'user_id'
]))
{
$where
[
'a.user_id'
]
=
$this
->
params
[
'user_id'
];
}
if
(
!
empty
(
$agent_where
))
{
$m_agent
=
new
AAgents
();
$agent_id_arr
=
$m_agent
->
getAgentById
(
'id'
,
$agent_where
);
if
(
empty
(
$agent_id_arr
))
{
$data
[
'data'
][
'list'
]
=
[];
return
$this
->
response
(
200
,
''
,
$data
);
//处理经纪人空数据
}
else
{
$agent_id
=
[];
foreach
(
$agent_id_arr
as
$K
=>
$v
)
{
$agent_id
[]
=
$v
[
'id'
];
}
$where
[
'a.agent_id'
]
=
[
'in'
,
$agent_id
];
}
}
if
(
$params
[
'type'
]
==
'last'
)
{
$where
[
'a.id'
]
=
[
'gt'
,
$params
[
'id'
]
];
$order
=
'a.id asc'
;
}
else
{
$where
[
'a.id'
]
=
[
'lt'
,
$params
[
'id'
]
];
$order
=
'a.id desc'
;
}
$field
=
'a.id,a.user_id,b.user_nick,b.agent_id,b.vip,b.create_time'
;
$model
=
new
UPhoneFollowPp
();
$model_res
=
$model
->
getLastOrNextUserIDPhoneFollowP
(
$where
,
$field
,
$limit
=
1
,
$order
);
if
(
!
$model_res
)
{
return
$this
->
response
(
"201"
,
"查无数据"
,
[
'user_id'
=>
$params
[
'id'
]]);
}
// 判断当天被拨打是否超过5次
// $clientService = new ClientService();
// if (!$clientService->dialTotal($model_res[0]['user_id'])) {
// return $this->response("201", "当天被拨打超过5次", ['user_id'=>$model_res[0]['id']]);
// }
//如果非客方
if
(
$model_res
[
0
][
'agent_id'
]
!=
$params
[
'agent_id'
]){
// 判断是否vip客户,如果是 只有是当前经纪人自己的客户才能查看
//vip客户 0:否 1:是
$vip_services
=
new
VipService
();
$examine_vip
=
$vip_services
->
vip
(
$params
[
'agent_id'
]);
if
((
$model_res
[
0
][
'vip'
]
==
1
))
{
if
((
$examine_vip
==
1
))
{
return
$this
->
response
(
"201"
,
"vip 非客方"
,
[
'user_id'
=>
$model_res
[
0
][
'id'
]]);
}
}
// 判断是否24小时保护期内
if
((
time
()
-
strtotime
(
$model_res
[
0
][
'create_time'
]))
<
(
60
*
60
*
24
)){
return
$this
->
response
(
"201"
,
"24小时保护期内"
,
[
'user_id'
=>
$model_res
[
0
][
'id'
]]);
}
}
// dump($model_res);exit();
$where
=
[];
// $where['city'] = trim($this->city);
$field
=
'max(a.id) as max_id'
;
$order
=
'a.id asc'
;
$max_id
=
$model
->
getLastOrNextUserIDPhoneFollowP
(
$where
,
$field
,
$limit
=
''
,
$order
);
$field
=
'MIN(a.id) as min_id'
;
$min_id
=
$model
->
getLastOrNextUserIDPhoneFollowP
(
$where
,
$field
,
$limit
=
''
,
$order
);
return
$this
->
response
(
"200"
,
"success!"
,
[
'id'
=>
$model_res
[
0
][
'id'
],
'user_id'
=>
$model_res
[
0
][
'user_id'
],
'max_user_id'
=>
$max_id
[
0
][
'max_id'
],
'min_user_id'
=>
$min_id
[
0
][
'min_id'
]
]
);
}
}
}
\ No newline at end of file
application/model/UPhoneFollowPp.php
View file @
e860c1b9
...
@@ -319,4 +319,27 @@ class UPhoneFollowPp extends BaseModel
...
@@ -319,4 +319,27 @@ class UPhoneFollowPp extends BaseModel
->
order
(
$order
)
->
order
(
$order
)
->
value
(
$field
);
->
value
(
$field
);
}
}
public
function
getLastOrNextUserIDPhoneFollowP
(
$where
,
$field
,
$limit
,
$order
)
{
$return
=
$this
->
field
(
$field
)
->
alias
(
'a'
)
->
join
(
'u_users b'
,
'a.user_id = b.id'
,
'left'
)
->
where
(
$where
)
->
order
(
$order
)
->
limit
(
$limit
)
->
select
();
/*$return = Db::name($this->table)
->field($field)
->where($where)
->limit($limit)
->order($order)
->select();*/
//dump($this->getLastSql());
echo
$this
->
getLastSql
();
return
$return
;
}
}
}
application/route.php
View file @
e860c1b9
...
@@ -546,7 +546,8 @@ Route::group('broker', [
...
@@ -546,7 +546,8 @@ Route::group('broker', [
//user
//user
'returnSearchCondition'
=>
[
'api_broker/User/returnSearchCondition'
,
[
'method'
=>
'get'
]
],
//客户搜索条件
'returnSearchCondition'
=>
[
'api_broker/User/returnSearchCondition'
,
[
'method'
=>
'get'
]
],
//客户搜索条件
'searchUser'
=>
[
'api_broker/User/searchUser'
,
[
'method'
=>
'get|post'
]
],
//客户搜索
'searchUser'
=>
[
'api_broker/User/searchUser'
,
[
'method'
=>
'get|post'
]
],
//客户搜索
'getLastOrNextUserID'
=>
[
'api_broker/User/getLastOrNextUserID'
,
[
'method'
=>
'get|post'
]
],
//客户搜索
'getLastOrNextUserID'
=>
[
'api_broker/User/getLastOrNextUserID'
,
[
'method'
=>
'get|post'
]
],
//
'getLastOrNextUserIDPhoneFollowPu'
=>
[
'api_broker/User/getLastOrNextUserIDPhoneFollowPu'
,
[
'method'
=>
'get|post'
]
],
//
'superviseListNew'
=>
[
'api_broker/Supervise/superviseList'
,
[
'method'
=>
'POST|GET'
]
],
//监督执行列表 朱伟 2018-06-15
'superviseListNew'
=>
[
'api_broker/Supervise/superviseList'
,
[
'method'
=>
'POST|GET'
]
],
//监督执行列表 朱伟 2018-06-15
'addSupervise'
=>
[
'api_broker/Supervise/addSupervise'
,
[
'method'
=>
'POST|GET'
]
],
//新增-监督执行 朱伟 2018-06-20
'addSupervise'
=>
[
'api_broker/Supervise/addSupervise'
,
[
'method'
=>
'POST|GET'
]
],
//新增-监督执行 朱伟 2018-06-20
...
...
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