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
9f602fae
Commit
9f602fae
authored
Apr 11, 2019
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
跟进列表
parent
464268c0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
58 additions
and
65 deletions
+58
-65
Remark.php
application/index/controller/Remark.php
+4
-32
PhoneFollowUpService.php
application/index/service/PhoneFollowUpService.php
+54
-33
No files found.
application/index/controller/Remark.php
View file @
9f602fae
...
...
@@ -31,9 +31,6 @@ class Remark extends Basic
* 跟进列表
*
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
followUpList
()
{
...
...
@@ -88,37 +85,12 @@ class Remark extends Basic
$follow_up_service
=
new
PhoneFollowUpService
(
$site_id
);
$result_data
=
$follow_up_service
->
getPhoneFollowList
(
$this
->
params
[
'start_date'
],
$this
->
params
[
'end_date'
],
$where
,
$this
->
userId
);
if
(
$result_data
[
'code'
]
==
200
)
{
if
(
!
empty
(
$result_data
[
'data'
]))
{
foreach
(
$result_data
[
'data'
]
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'
];
//客户客方
}
$list
[
$k
][
'user_phone'
]
=
substr_replace
(
$list
[
$k
][
'user_phone'
],
'****'
,
3
,
4
);
$list
[
$k
][
'admin'
]
=
$m_agent
->
getAgentsById
(
$v
[
'agent_id'
],
'name'
);
$list
[
$k
][
'label_name'
]
=
$v
[
'label_name'
];
$list
[
$k
][
'is_outstrip_twenty_four_hours'
]
=
$v
[
'is_outstrip_twenty_four_hours'
];
$list
[
$k
][
'is_outpace_call_num'
]
=
$v
[
'is_outpace_call_num'
];
$list
[
$k
][
'create_time'
]
=
$v
[
'create_time'
];
$list
[
$k
][
'user_id'
]
=
$v
[
'user_id'
];
$list
[
$k
][
'content'
]
=
$v
[
'content'
];
$list
[
$k
][
'user_status'
]
=
$v
[
'user_status'
];
$list
[
$k
][
'id'
]
=
$v
[
'id'
];
}
}
if
(
$result_data
[
'status'
]
!=
'fail'
)
{
$data
[
'data'
][
'list'
]
=
$result_data
[
'data'
];
}
else
{
$msg
=
$result_data
[
'data'
];
$code
=
101
;
$list
=
[];
$data
[
'data'
][
'list'
]
=
[];
$msg
=
$result_data
[
'msg'
];
}
$data
[
'data'
][
'list'
]
=
$list
;
$data
[
'data'
][
'total'
]
=
40000
;
return
$this
->
response
(
$code
,
$msg
,
$data
);
}
...
...
application/index/service/PhoneFollowUpService.php
View file @
9f602fae
...
...
@@ -8,6 +8,7 @@
namespace
app\index\service
;
use
app\api_broker\service\RedisCacheService
;
use
app\api_broker\service\VerifyRepetitionService
;
use
app\model\AAgents
;
use
app\model\ULabels
;
...
...
@@ -36,13 +37,11 @@ class PhoneFollowUpService
* @param string $field
* @param $agent_id
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
getPhoneFollowList
(
string
$start_time
,
string
$end_time
,
array
$params
,
$agent_id
,
$field
=
'id,user_id,create_time,content,user_status,labels_id,agent_id'
)
{
$msg
=
''
;
$data
=
[];
$vrs
=
new
VerifyRepetitionService
();
$page_no
=
isset
(
$params
[
'page_no'
])
?
$params
[
'page_no'
]
:
1
;
$page_size
=
isset
(
$params
[
'page_size'
])
?
$params
[
'page_size'
]
:
15
;
...
...
@@ -84,40 +83,61 @@ class PhoneFollowUpService
$where
.=
" AND content LIKE '%
{
$params
[
'content'
]
}
%'"
;
}
if
(
!
empty
(
$agent_where
))
{
$m_agent
=
new
AAgents
();
$agent_id
=
$m_agent
->
getAgentsByWhereColumn
(
$agent_where
,
'id'
);
try
{
if
(
!
empty
(
$agent_where
))
{
$m_agent
=
new
AAgents
();
$agent_id
=
$m_agent
->
getAgentsByWhereColumn
(
$agent_where
,
'id'
);
if
(
empty
(
$agent_id
))
{
return
[
'code'
=>
'101'
,
'data'
=>
'暂无数据'
];
}
else
{
$agent_id_string
=
implode
(
','
,
$agent_id
);
$where
.=
" AND agent_id in (
{
$agent_id_string
}
)"
;
}
}
if
(
empty
(
$agent_id
))
{
return
[
'code'
=>
'101'
,
'data'
=>
'暂无数据'
];
$date
=
date
(
"Y-m-d"
,
time
());
if
(
$end_time
==
$date
&&
$start_time
==
$date
)
{
$data
=
$this
->
phoneFollowUpTemporary
->
getFollowList
(
$page_no
,
$page_size
,
$order_
=
'id desc'
,
$field
,
$where
);
}
else
{
$agent_id_string
=
implode
(
','
,
$agent_id
);
$where
.=
" AND agent_id in (
{
$agent_id_string
}
)"
;
$data
=
$this
->
phoneFollowUp
->
getFollowList
(
$page_no
,
$page_size
,
$order_
=
''
,
$field
,
$where
);
}
}
$date
=
date
(
"Y-m-d"
,
time
());
if
(
$end_time
==
$date
&&
$start_time
==
$date
)
{
$data
=
$this
->
phoneFollowUpTemporary
->
getFollowList
(
$page_no
,
$page_size
,
$order_
=
'id desc'
,
$field
,
$where
);
}
else
{
$data
=
$this
->
phoneFollowUp
->
getFollowList
(
$page_no
,
$page_size
,
$order_
=
''
,
$field
,
$where
);
}
$s_user_service
=
new
UserService
();
$s_user_Log_service
=
new
UserLogService
();
$m_user
=
new
Users
();
$m_label
=
new
ULabels
();
$label_data
=
$m_label
->
getColumn
(
'id,name'
,
[
'type'
=>
1
]);
//获取标签
foreach
(
$data
as
$k
=>
$v
)
{
#客户是否在保护期内(0:保护器内 1:超过保护期)
$data
[
$k
][
'is_outstrip_twenty_four_hours'
]
=
$s_user_service
->
isUserProtect
(
$v
[
'user_id'
]);
#判断当天被拨打是否超过5次,同时判断是否当前经纪人跟当前客户是否有电话绑定(0允许拨打 1不允许拨打)
$user_res
=
$m_user
->
getUserDetailStreamline
(
$v
[
'user_id'
],
'user_name,user_phone'
);
$data
[
$k
][
'is_outpace_call_num'
]
=
$s_user_Log_service
->
userDetailIsOutpaceCallNum
(
$v
[
'user_id'
],
$user_res
[
'user_phone'
],
$agent_id
);
$data
[
$k
][
'label_name'
]
=
array_key_exists
(
$v
[
'labels_id'
],
$label_data
)
?
$label_data
[
$v
[
'labels_id'
]]
:
''
;
$s_user_service
=
new
UserService
();
$s_user_Log_service
=
new
UserLogService
();
// $m_user = new Users();
$m_label
=
new
ULabels
();
$label_data
=
$m_label
->
getColumn
(
'id,name'
,
[
'type'
=>
1
]);
//获取标签
$redis_service
=
new
RedisCacheService
();
foreach
(
$data
as
$k
=>
$v
)
{
if
(
!
empty
(
$v
[
'user_id'
]))
{
$user_data
=
$redis_service
->
getRedisCache
(
1
,
$v
[
'user_id'
]);
#客户是否在保护期内(0:保护器内 1:超过保护期)
$data
[
$k
][
'is_outstrip_twenty_four_hours'
]
=
$s_user_service
->
isUserProtect
(
$v
[
'user_id'
]);
#判断当天被拨打是否超过5次,同时判断是否当前经纪人跟当前客户是否有电话绑定(0允许拨打 1不允许拨打)
// $user_res = $m_user->getUserDetailStreamline($v['user_id'], 'user_name,user_phone');
$data
[
$k
][
'is_outpace_call_num'
]
=
$s_user_Log_service
->
userDetailIsOutpaceCallNum
(
$v
[
'user_id'
],
$user_data
[
'user_phone'
],
$agent_id
);
$data
[
$k
][
'label_name'
]
=
array_key_exists
(
$v
[
'labels_id'
],
$label_data
)
?
$label_data
[
$v
[
'labels_id'
]]
:
''
;
$data
[
$k
][
'user_name'
]
=
$user_data
[
'user_name'
];
}
else
{
$data
[
$k
][
'user_name'
]
=
''
;
}
if
(
!
empty
(
$v
[
'agent_id'
]))
{
$agent_data
=
$redis_service
->
getRedisCache
(
2
,
$v
[
'agent_id'
]);
$data
[
$k
][
'admin'
]
=
$agent_data
[
'name'
];
}
else
{
$data
[
$k
][
'admin'
]
=
''
;
}
}
$status
=
'successful'
;
}
catch
(
\Exception
$e
)
{
$status
=
'fail'
;
$msg
=
'内部错误'
.
$e
->
getMessage
();
}
return
[
'code'
=>
'200'
,
'data'
=>
$data
];
return
[
'status'
=>
$status
,
$msg
,
'data'
=>
$data
];
}
}
\ No newline at end of file
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