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
c299166f
Commit
c299166f
authored
Dec 27, 2018
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
跟进列表优化
parent
b159de29
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
65 additions
and
73 deletions
+65
-73
Remark.php
application/index/controller/Remark.php
+35
-36
ULabels.php
application/model/ULabels.php
+29
-3
UPhoneFollowPp.php
application/model/UPhoneFollowPp.php
+1
-34
No files found.
application/index/controller/Remark.php
View file @
c299166f
...
...
@@ -43,14 +43,22 @@ class Remark extends Basic
if
(
$this
->
params
[
'pageNo'
]
==
1
&&
!
$is_check
){
return
$this
->
response
(
"101"
,
"请勿频繁请求"
);
}
$u_phone_follow
=
new
UPhoneFollowPp
(
$this
->
siteId
);
$user_service
=
new
UserService
();
$clientService
=
new
ClientService
();
$m_agent_phone
=
new
AAgentsPhone
();
$m_user
=
new
Users
();
$m_label
=
new
ULabels
();
$m_agent
=
new
AAgents
();
$redis
=
RedisExt
::
getRedis
();
$data
[
'status'
]
=
200
;
$data
[
'msg'
]
=
''
;
$agent_where
=
$where
=
[];
$pageNo
=
empty
(
$this
->
params
[
'pageNo'
])
?
1
:
$this
->
params
[
'pageNo'
];
$pageSize
=
empty
(
$this
->
params
[
'pageSize'
])
?
15
:
$this
->
params
[
'pageSize'
];
$u_phone_follow
=
new
UPhoneFollowPp
(
$this
->
siteId
);
if
(
!
empty
(
$this
->
params
[
'start_date'
])
&&
empty
(
$this
->
params
[
'end_date'
]))
{
$where
[
'create_time'
]
=
[
'> time'
,
$this
->
params
[
'start_date'
]
.
' 00:00:00'
];
}
...
...
@@ -82,18 +90,6 @@ class Remark extends Basic
$agent_where
[
'district_id'
]
=
$this
->
params
[
'remark_district_id'
];
}
/*if (!empty($this->params['province'])) {
$where['province'] = $this->params['province'];
}
if (!empty($this->params['city'])) {
$where['city'] = $this->params['city'];
}*/
/*if ($this->city != '全部') {
$where['city'] = $this->city;
}*/
if
(
!
empty
(
$this
->
params
[
'disc'
]))
{
$where
[
'disc'
]
=
$this
->
params
[
'disc'
];
}
...
...
@@ -103,7 +99,6 @@ class Remark extends Basic
}
if
(
!
empty
(
$agent_where
))
{
$m_agent
=
new
AAgents
();
$agent_id
=
$m_agent
->
getAgentsByWhereColumn
(
$agent_where
,
'id'
);
if
(
empty
(
$agent_id
))
{
...
...
@@ -113,38 +108,40 @@ class Remark extends Basic
$where
[
'agent_id'
]
=
[
'in'
,
$agent_id
];
}
}
$field
=
'id,user_id,create_time,content,user_status,labels_id,agent_id as f_agent_id'
;
$data
[
'data'
][
'list'
]
=
$u_phone_follow
->
getFollowList
(
$pageNo
,
$pageSize
,
$order_
=
'id desc'
,
$field
,
$where
);
$redis
=
RedisExt
::
getRedis
();
$field
=
'id,user_id,create_time,content,user_status,labels_id,agent_id'
;
$list
=
$u_phone_follow
->
getFollowList
(
$pageNo
,
$pageSize
,
$order_
=
'id desc'
,
$field
,
$where
);
$label_data
=
$m_label
->
getColumn
(
'id,name'
,
[
'type'
=>
1
]);
//获取标签
foreach
(
$list
as
$k
=>
$v
)
{
if
(
!
empty
(
$v
[
'user_id'
]))
{
$user_data
=
$m_user
->
getUserById
(
'user_name,user_phone,vip,agent_id,create_time'
,
$v
[
'user_id'
]);
$list
[
$k
][
'user_name'
]
=
$user_data
[
'user_name'
];
$list
[
$k
][
'user_phone'
]
=
$user_data
[
'user_phone'
];
$list
[
$k
][
'u_create_time'
]
=
$user_data
[
'create_time'
];
$list
[
$k
][
'vip'
]
=
$user_data
[
'vip'
];
$list
[
$k
][
'agent_id'
]
=
$user_data
[
'agent_id'
];
//客户客方
}
foreach
(
$data
[
'data'
][
'list'
]
as
$k
=>
$v
)
{
//dump($v);
//查询客户是否在保护期内
//判断客户是否超过24小时保护期间 0:保护器内 1:超过保护期
$user_service
=
new
UserService
();
$is_outstrip_twenty_four_hours
=
$user_service
->
isUserProtect
(
$v
[
"user_id"
]);
$
data
[
'data'
][
'list'
]
[
$k
][
'is_outstrip_twenty_four_hours'
]
=
$is_outstrip_twenty_four_hours
;
$
list
[
$k
][
'is_outstrip_twenty_four_hours'
]
=
$is_outstrip_twenty_four_hours
;
/* 判断当天被拨打是否超过5次,同时判断是否当前经纪人跟当前客户是否有电话绑定 start*/
//0允许拨打 1不允许拨打
$is_outpace_call_num
=
0
;
$clientService
=
new
ClientService
();
if
(
!
$clientService
->
dialTotal
(
$v
[
"user_id"
]))
{
$is_outpace_call_num
=
1
;
}
$model
=
new
AAgents
();
$result
=
$model
->
searchAgentsByKeyword
(
"id,name,phone"
,
[
"id"
=>
$this
->
params
[
"agent_id"
]]);
//$call = new CallPhoneService();
//$result = $call->getBindNum($v['user_phone'],$result[0]['phone']);
$phone
=
$m_agent
->
getAgentsById
(
$this
->
params
[
'agent_id'
],
'phone'
);
if
(
$is_outpace_call_num
==
1
)
{
$is_privacy
=
$redis
->
get
(
's_is_privacy'
);
//判断是否当前经纪人跟当前客户是否有电话绑定 从redis查询
if
(
empty
(
$result
[
0
][
'phone'
]))
{
$m_agent_phone
=
new
AAgentsPhone
();
$agent_phone
=
$m_agent_phone
->
getList
(
1
,
1
,
''
,
'phone'
,
[
'agent_id'
=>
$this
->
userId
]);
$phone
=
$agent_phone
[
0
][
'phone'
];
}
else
{
$phone
=
$result
[
0
][
'phone'
];
if
(
empty
(
$phone
))
{
$phone
=
$m_agent_phone
->
getAgentsByWhere
([
'agent_id'
=>
$this
->
userId
],
'phone'
);
}
$call_key
=
'call_'
.
$this
->
userId
.
'_'
.
$phone
.
'_'
.
$v
[
'user_phone'
]
.
'_'
.
$is_privacy
;
$redis_res
=
$redis
->
get
(
$call_key
);
...
...
@@ -153,12 +150,14 @@ class Remark extends Basic
$is_outpace_call_num
=
1
;
}
}
$
data
[
'data'
][
'list'
]
[
$k
][
'is_outpace_call_num'
]
=
$is_outpace_call_num
;
$
list
[
$k
][
'is_outpace_call_num'
]
=
$is_outpace_call_num
;
/* 判断当天被拨打是否超过5次,同时判断是否当前经纪人跟当前客户是否有电话绑定 end*/
$data
[
'data'
][
'list'
][
$k
][
'user_phone'
]
=
substr_replace
(
$data
[
'data'
][
'list'
][
$k
][
'user_phone'
],
'****'
,
3
,
4
);
$list
[
$k
][
'user_phone'
]
=
substr_replace
(
$list
[
$k
][
'user_phone'
],
'****'
,
3
,
4
);
$list
[
$k
][
'admin'
]
=
$m_agent
->
getAgentsById
(
$v
[
'agent_id'
],
'name'
);
$data
[
$k
][
'label_name'
]
=
array_key_exists
(
$v
[
'labels_id'
])
?
$label_data
[
$v
[
'labels_id'
]]
:
''
;
}
$data
[
'data'
][
'list'
]
=
$list
;
$data
[
'data'
][
'total'
]
=
40000
;
return
$this
->
response
(
200
,
'成功'
,
$data
);
}
...
...
application/model/ULabels.php
View file @
c299166f
...
...
@@ -3,9 +3,18 @@
namespace
app\model
;
use
think\Db
;
class
ULabels
extends
BaseModel
{
protected
$table
=
"u_labels"
;
private
$db_
;
public
function
__construct
(
$data
=
[])
{
parent
::
__construct
(
$data
);
$this
->
db_
=
Db
::
name
(
$this
->
table
);
}
/**
* @param $where
...
...
@@ -17,7 +26,7 @@ class ULabels extends BaseModel
public
function
uleList
(
$where
)
{
$r
=
$this
->
where
(
$where
)
->
select
();
$r
=
$this
->
db_
->
where
(
$where
)
->
select
();
return
$r
;
}
...
...
@@ -30,7 +39,7 @@ class ULabels extends BaseModel
* @throws \think\exception\DbException
*/
public
function
repetition
(
$name
,
$key
){
$r
=
$this
->
field
(
$name
)
$r
=
$this
->
db_
->
field
(
$name
)
->
where
(
$name
,
'='
,
$key
)
->
select
();
//$this->getLastSql();
...
...
@@ -41,9 +50,16 @@ class ULabels extends BaseModel
}
}
/**
* @param $id
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
get_labelsname
(
$id
)
{
$u_labels
=
db
(
'u_labels'
)
$u_labels
=
$this
->
db_
->
where
(
'id'
,
$id
)
->
field
(
'id,name'
)
//->limit($pagesize)
...
...
@@ -52,4 +68,14 @@ class ULabels extends BaseModel
return
$u_labels
;
}
/**
* @param $field
* @param $where
* @return array
*/
public
function
getColumn
(
$field
,
$where
)
{
return
$this
->
db_
->
where
(
$where
)
->
column
(
$field
);
}
}
application/model/UPhoneFollowPp.php
View file @
c299166f
...
...
@@ -201,45 +201,12 @@ class UPhoneFollowPp extends BaseModel
* @throws \think\exception\DbException
*/
public
function
getFollowList
(
$pageNo
=
1
,
$pageSize
=
15
,
$order_
=
'id desc'
,
$field
=
''
,
$params
=
''
)
{
$data
=
$this
->
UPhoneFollowPp
->
field
(
$field
)
return
$this
->
UPhoneFollowPp
->
field
(
$field
)
->
where
(
$params
)
->
order
(
$order_
)
->
limit
(
$pageSize
)
->
page
(
$pageNo
)
->
select
();
//echo $this->getLastSql();
$m_label
=
new
ULabels
();
$m_user
=
new
Users
();
$m_agent
=
new
AAgents
();
$label_data
=
$m_label
->
field
(
'id,name'
)
->
where
(
'type'
,
1
)
->
select
();
foreach
(
$data
as
$k
=>
$v
)
{
if
(
!
empty
(
$v
[
'f_agent_id'
]))
{
$data
[
$k
][
'admin'
]
=
$m_agent
->
getAgentsById
(
$v
[
'f_agent_id'
],
'name'
);
}
if
(
!
empty
(
$v
[
'user_id'
]))
{
$user_data
=
$m_user
->
getUserById
(
'user_name,user_phone,vip,agent_id,create_time'
,
$v
[
'user_id'
]);
$data
[
$k
][
'user_name'
]
=
$user_data
[
'user_name'
];
$data
[
$k
][
'user_phone'
]
=
$user_data
[
'user_phone'
];
$data
[
$k
][
'u_create_time'
]
=
$user_data
[
'create_time'
];
$data
[
$k
][
'vip'
]
=
$user_data
[
'vip'
];
$data
[
$k
][
'agent_id'
]
=
$user_data
[
'agent_id'
];
//客户客方
}
if
(
!
isset
(
$v
[
'labels_id'
]))
{
continue
;
}
foreach
(
$label_data
as
$k2
=>
$v2
)
{
if
(
$v2
[
'id'
]
==
$v
[
'labels_id'
])
{
$data
[
$k
][
'label_name'
]
=
$v2
[
'name'
];
}
}
}
return
$data
;
}
/**
...
...
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