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
6a194c9e
Commit
6a194c9e
authored
Jan 02, 2019
by
zw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
后台时间轴
parent
7fa852e4
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
492 additions
and
0 deletions
+492
-0
OrderLogService.php
application/api_broker/service/OrderLogService.php
+119
-0
UserLog.php
application/index/controller/UserLog.php
+116
-0
UserLogService.php
application/index/service/UserLogService.php
+208
-0
OReportModel.php
application/model/OReportModel.php
+24
-0
UPhoneFollowPp.php
application/model/UPhoneFollowPp.php
+21
-0
route.php
application/route.php
+4
-0
No files found.
application/api_broker/service/OrderLogService.php
View file @
6a194c9e
...
...
@@ -884,6 +884,125 @@ class OrderLogService
return
$this
->
sortByTime
(
$result
);
}
/**
* 最新 客户动态时间轴
* @param $user_id
* @param string $search
* @param $site_id
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
selectListByUserIdAndSiteId
(
$user_id
,
$search
=
""
,
$site_id
)
{
$result
=
[];
$sort
=
0
;
//todo 1.验证订单是否存在
$oReportModel
=
new
OReportModel
();
$oMarchInModel
=
new
OMarchInModel
();
$followUpLogModel
=
new
FollowUpLogModel
();
$oPayLogModel
=
new
OPayLogModel
();
$oRefundModel
=
new
ORefundModel
();
$oBargainModel
=
new
OBargainModel
();
$field_report
=
"a.id,a.create_time,a.predict_see_time,a.intro,b.id as order_id,b.house_id,b.house_title,c.id as agent_id,c.name,c.img,d.store_name"
;
$reportData
=
$oReportModel
->
selectReportByUserId
(
$field_report
,
[
"user_id"
=>
$user_id
]);
if
(
count
(
$result
)
<=
0
&&
count
(
$reportData
)
<=
0
)
{
return
[];
}
$order_ids
=
$report_ids
=
""
;
//报备
foreach
(
$reportData
as
$k
=>
$v
)
{
$v
[
"step_name"
]
=
"report"
;
$house_title
=
mb_substr
(
$v
[
'house_title'
],
0
,
3
,
'utf-8'
)
.
"***"
;
$v
[
"step"
]
=
"报备【id:"
.
$v
[
'house_id'
]
.
" "
.
$house_title
.
"】"
;
$result
[
$sort
++
]
=
$v
;
$order_ids
.=
$v
[
"order_id"
]
.
","
;
$report_ids
.=
$v
[
"id"
]
.
","
;
}
$order_ids
=
rtrim
(
$order_ids
,
","
);
$report_ids
=
rtrim
(
$report_ids
,
","
);
$orderParams
[
"order_id"
]
=
array
(
"in"
,
$order_ids
);
$orderParams
[
"house_title"
]
=
array
(
"like"
,
"%"
.
trim
(
$search
)
.
"%"
);
$reportParams
[
"report_id"
]
=
array
(
"in"
,
$report_ids
);
//进场 march in
$field_march_in
=
"a.id,a.reception_id,a.create_time,b.id as order_id,b.house_id,b.house_title,c.id as agent_id,c.name,c.img,d.store_name"
;
$marchInData
=
$oMarchInModel
->
getMarchInListByOrderId
(
$field_march_in
,
$orderParams
);
if
(
count
(
$marchInData
)
>
0
)
{
foreach
(
$marchInData
as
$k
=>
$v
)
{
$v
[
"step_name"
]
=
"march_in"
;
$house_title
=
mb_substr
(
$v
[
'house_title'
],
0
,
3
,
'utf-8'
)
.
"***"
;
$v
[
"step"
]
=
"进场【id:"
.
$v
[
'house_id'
]
.
" "
.
$house_title
.
"】"
;
$result
[
$sort
++
]
=
$v
;
}
}
//跟进
$field_follow_up
=
"a.id,a.agent_id,a.agent_name,a.user_type,a.decision_maker,a.industry_type,a.area_requirement,a.price_requirement,a.province,a.city,
a.district,a.business_area,a.explain,a.explain_img,a.create_time,b.name,b.img,c.store_name"
;
$followUpLogData
=
$followUpLogModel
->
getFollowUpByOrderId
(
$field_follow_up
,
$reportParams
);
if
(
count
(
$followUpLogData
)
>
0
)
{
foreach
(
$followUpLogData
as
$k
=>
$v
)
{
$v
[
"step_name"
]
=
"follow_up_log"
;
$v
[
"step"
]
=
"跟进"
;
$v
=
$this
->
convertFollowUp
(
$v
);
$v
[
"img_path"
]
=
CHAT_IMG_URL
;
$v
[
"explain_img"
]
=
$v
[
"explain_img"
];
$result
[
$sort
++
]
=
$v
;
}
}
//收款
$field_pay_log
=
"a.id,a.create_time,b.id as order_id,b.house_id,b.house_title,c.id as agent_id,c.name,c.img,d.store_name"
;
$payLogData
=
$oPayLogModel
->
getPayLogByOrderId
(
$field_pay_log
,
$orderParams
);
if
(
count
(
$payLogData
)
>
0
)
{
foreach
(
$payLogData
as
$k
=>
$v
)
{
$v
[
"step_name"
]
=
"pay_log"
;
$house_title
=
mb_substr
(
$v
[
'house_title'
],
0
,
3
,
'utf-8'
)
.
"***"
;
$v
[
"step"
]
=
"收款【id:"
.
$v
[
'house_id'
]
.
" "
.
$house_title
.
"】"
;
$result
[
$sort
++
]
=
$v
;
}
}
//退款
$field_refund
=
"a.id,a.create_time,b.id as order_id,b.house_id,b.house_title,c.id as agent_id,c.name,c.img,d.store_name"
;
$refundData
=
$oRefundModel
->
getRefundByOrderId
(
$field_refund
,
$orderParams
);
if
(
count
(
$refundData
)
>
0
)
{
foreach
(
$refundData
as
$k
=>
$v
)
{
$v
[
"step_name"
]
=
"refund"
;
$house_title
=
mb_substr
(
$v
[
'house_title'
],
0
,
3
,
'utf-8'
)
.
"***"
;
$v
[
"step"
]
=
"退款【id:"
.
$v
[
'house_id'
]
.
" "
.
$house_title
.
"】"
;
$result
[
$sort
++
]
=
$v
;
}
}
//成交报告
$field_bargain
=
"a.id,a.create_time,a.house_number,a.is_open,b.id as order_id,b.house_id,b.house_title,c.id as agent_id,c.name,c.img,d.store_name"
;
$bargainData
=
$oBargainModel
->
getBargainByOrderId
(
$field_bargain
,
$orderParams
);
if
(
count
(
$bargainData
)
>
0
)
{
foreach
(
$bargainData
as
$k
=>
$v
)
{
$v
[
"step_name"
]
=
"bargain"
;
$house_title
=
mb_substr
(
$v
[
'house_title'
],
0
,
3
,
'utf-8'
)
.
"***"
;
$v
[
"step"
]
=
"成交报告【id:"
.
$v
[
'house_id'
]
.
" "
.
$house_title
.
"】"
;
$result
[
$sort
++
]
=
$v
;
}
}
return
$this
->
sortByTime
(
$result
);
}
/**
* 查询流程 商铺动态
...
...
application/index/controller/UserLog.php
0 → 100644
View file @
6a194c9e
<?php
namespace
app\index\controller
;
use
app\index\extend\Basic
;
use
app\index\service\UserLogService
;
use
think\Request
;
/**
* Created by PhpStorm.
* User : zw
* Date : 2019/1/2
* Time : 2:23 PM
* Intro:
*/
class
UserLog
extends
Basic
{
private
$service_
;
public
function
__construct
(
Request
$request
=
null
)
{
parent
::
__construct
(
$request
);
$this
->
service_
=
new
UserLogService
();
}
/**
* 获取用户主要信息
* @return \think\Response
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
userDetail
()
{
$params
=
$this
->
params
;
/* $params = array(
"user_id" => 828,
"agent_id" => 1,
);*/
if
(
!
isset
(
$params
[
'user_id'
])
||
!
isset
(
$params
[
'agent_id'
]))
{
return
$this
->
response
(
"101"
,
"参数不全"
);
}
$user_id
=
$params
[
'user_id'
];
$agent_id
=
$params
[
'agent_id'
];
$result
=
$this
->
service_
->
userDetail
(
$user_id
,
$agent_id
);
if
(
$result
[
"code"
]
==
200
){
return
$this
->
response
(
"200"
,
"success!"
,
$result
[
"data"
]);
}
else
{
return
$this
->
response
(
"101"
,
$result
[
"msg"
]);
}
}
/**
* 订单动态
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
userLog
(){
$params
=
$this
->
params
;
/* $params = array(
"user_id" => 828,
"type" => 1,
);*/
if
(
!
isset
(
$params
[
'user_id'
])
||
!
isset
(
$params
[
'type'
]))
{
return
$this
->
response
(
"101"
,
"参数不全"
);
}
$user_id
=
$params
[
'user_id'
];
$type
=
$params
[
'type'
];
$result
=
$this
->
service_
->
userLog
(
$user_id
,
$this
->
siteId
,
$type
);
if
(
count
(
$result
)
>
0
){
return
$this
->
response
(
"200"
,
"success!"
,
$result
);
}
else
{
return
$this
->
response
(
"101"
,
"请求数据为空"
);
}
}
/**
* 电话跟进
* @return \think\Response
*/
public
function
followUpLog
(){
$params
=
$this
->
params
;
/* $params = array(
"user_id" => 828,
"page_no" => 1,
"page_size" => 15
);*/
if
(
!
isset
(
$params
[
'user_id'
]))
{
return
$this
->
response
(
"101"
,
"参数不全"
);
}
$user_id
=
$params
[
'user_id'
];
$pageNo
=
empty
(
$params
[
'page_no'
])
?
1
:
$params
[
'page_no'
];
$pageSize
=
empty
(
$params
[
'page_size'
])
?
15
:
$params
[
'page_size'
];
$result
=
$this
->
service_
->
phoneFollowUp
(
$user_id
,
$this
->
siteId
,
$pageNo
,
$pageSize
);
if
(
count
(
$result
)
>
0
){
return
$this
->
response
(
"200"
,
"success!"
,
$result
);
}
else
{
return
$this
->
response
(
"101"
,
"请求数据为空"
);
}
}
}
\ No newline at end of file
application/index/service/UserLogService.php
0 → 100644
View file @
6a194c9e
<?php
namespace
app\index\service
;
use
app\api_broker\service\CallPhoneService
;
use
app\api_broker\service\ClientService
;
use
app\api_broker\service\OrderLogService
;
use
app\api_broker\service\VipService
;
use
app\model\AAgents
;
use
app\model\ACollectUser
;
use
app\model\ASite
;
use
app\model\GOperatingRecords
;
use
app\model\OReportModel
;
use
app\model\UPhoneFollowPp
;
use
app\model\Users
;
/**
* Created by PhpStorm.
* User : zw
* Date : 2019/1/2
* Time : 2:29 PM
* Intro:
*/
class
UserLogService
{
private
$agentModel
;
private
$userModel
;
private
$orderService
;
public
function
__construct
()
{
$this
->
agentModel
=
new
AAgents
();
$this
->
userModel
=
new
Users
();
$this
->
orderService
=
new
OrderLogService
();
}
/**
* 客户详情
* @param $user_id
* @param $agent_id
* @return mixed
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
userDetail
(
$user_id
,
$agent_id
)
{
//查询客户详情
$user_arr
=
$this
->
userModel
->
useraction_search_user_res
(
$user_id
,
1
);
if
(
count
(
$user_arr
)
<=
0
)
{
return
[
"code"
=>
101
,
"msg"
=>
"没找到此条用户信息"
];
}
$user_arr
[
'user_pic'
]
=
HEADERIMGURL
.
$user_arr
[
'user_pic'
];
$agents_arr
=
$this
->
agentModel
->
verifyUser
(
'name,phone'
,
''
,
[
'id'
=>
$user_arr
[
'agent_id'
]]);
$user_arr
[
'agent_info'
]
=
$agents_arr
?
$agents_arr
[
'name'
]
.
'-'
.
$agents_arr
[
'phone'
]
:
'未知'
;
$data
[
'agent_path'
]
=
AGENTHEADERIMGURL
;
/*查询站点名*/
$site_model
=
new
ASite
();
foreach
(
explode
(
','
,
$user_arr
[
'site_ids'
])
as
$site_k
=>
$site_v
)
{
$site_field
=
'city'
;
$site_params
[
'id'
]
=
$site_v
;
$site_model
=
$site_model
->
findByOne
(
$site_field
,
$site_params
);
$user_arr
[
'site_name'
][]
=
$site_model
[
"city"
];
}
/*查询站点名*/
/*修改记录部分 start*/
$records
=
new
GOperatingRecords
();
$param_
[
'user_id'
]
=
$user_id
;
$param_
[
'type'
]
=
3
;
$records_result
=
$records
->
user_history
(
$param_
);
$data
[
'user_info'
]
=
$user_arr
;
$data
[
'user_history'
]
=
$records_result
;
$param_
[
'type'
]
=
5
;
$records_invite_result
=
$records
->
user_history
(
$param_
);
$data
[
'user_invite_history'
]
=
$records_invite_result
;
/*修改记录部分 end*/
/*是否被收藏 start*/
$data
[
"is_collect"
]
=
2
;
//先判断是否已经存在数据
$field
=
'id,status'
;
$get_params
[
'agents_id'
]
=
$agent_id
;
$get_params
[
'user_id'
]
=
$user_id
;
$collect_house
=
new
ACollectUser
();
$res
=
$collect_house
->
getCollectUser
(
$field
,
$get_params
);
if
(
$res
&&
(
$res
[
0
][
'status'
]
==
1
))
{
//如果存在
$data
[
"is_collect"
]
=
1
;
}
/*是否被收藏 end*/
/*判断客户是否超过24小时保护期间 0:保护器内 1:超过保护期 start*/
//查询客户是否在保护期内
$user_service
=
new
UserService
();
$is_outstrip_twenty_four_hours
=
$user_service
->
isUserProtect
(
$user_id
);
$data
[
'is_outstrip_twenty_four_hours'
]
=
$is_outstrip_twenty_four_hours
;
/*判断客户是否超过24小时保护期间 0:保护器内 1:超过保护期 end*/
/*查询客户邀请人 start*/
/*引荐人来源 10:会员 20:b端经纪人*/
if
(
$user_arr
[
'referrer_source'
]
==
0
)
{
$user_invite_info
=
[];
}
elseif
(
$user_arr
[
'referrer_source'
]
==
10
)
{
$userArr
=
$this
->
userModel
->
selectUser
(
$user_arr
[
'referrer_id'
],
"id,user_phone"
);
if
(
!
$userArr
)
{
$user_invite_info
=
[];
}
else
{
$user_invite_info
[
'referrer_source'
]
=
$user_arr
[
'referrer_source'
];
$user_invite_info
[
'user_phone'
]
=
$userArr
[
'user_phone'
]
?
preg_replace
(
'/(\d{3})\d{4}(\d{4})/'
,
'$1****$2'
,
$userArr
[
'user_phone'
])
:
''
;
$user_invite_info
[
'id'
]
=
$userArr
[
'id'
];
}
}
else
{
$model
=
new
AAgents
();
$result
=
$model
->
searchAgentsByKeyword
(
"id,name,phone"
,
[
"id"
=>
$user_arr
[
'referrer_id'
]]);
if
(
!
$result
)
{
$user_invite_info
=
[];
}
else
{
$user_invite_info
[
'referrer_source'
]
=
$user_arr
[
'referrer_source'
];
$user_invite_info
[
'name'
]
=
$result
[
0
][
'name'
];
$user_invite_info
[
'phone'
]
=
$result
[
0
][
'phone'
];
}
}
$data
[
'user_invite_info'
]
=
$user_invite_info
;
/*查询客户邀请人 end*/
// 判断当天被拨打是否超过5次,同时判断是否当前经纪人跟当前客户是否有电话绑定
//0允许拨打 1不允许拨打
$data
[
'is_outpace_call_num'
]
=
0
;
$clientService
=
new
ClientService
();
if
(
!
$clientService
->
dialTotal
(
$user_id
))
{
$data
[
'is_outpace_call_num'
]
=
1
;
}
$model
=
new
AAgents
();
$result
=
$model
->
searchAgentsByKeyword
(
"id,name,phone"
,
[
"id"
=>
$agent_id
]);
$call
=
new
CallPhoneService
();
$result
=
$call
->
getBindNum
(
$user_arr
[
'user_phone'
],
$result
[
0
][
'phone'
]);
if
(
$result
!=
0
)
{
$data
[
'is_outpace_call_num'
]
=
0
;
}
//查询当前经纪人是否是某个客方的总监 0:可查看 1:不可查看
$data
[
'is_can_look'
]
=
$user_service
->
isUserAgentDirector
(
$user_arr
[
"agent_id"
],
$agent_id
);
$vip_services
=
new
VipService
();
//是否可以查看vip客户 0:可查看 1:不可查看
$data
[
'examine_vip'
]
=
$vip_services
->
vip
(
$agent_id
);
return
[
"code"
=>
200
,
"data"
=>
$data
];
}
/**
* 客户动态
* @param $user_id
* @param $site_id
* @param $type 1表示查最近的一条跟进,2查所有的订单更近
* @return false|mixed|null|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
userLog
(
$user_id
,
$site_id
,
$type
)
{
switch
(
$type
){
case
1
:
$oReportModel
=
new
OReportModel
();
$field_report
=
"a.id,a.create_time,a.predict_see_time,a.intro,b.id as order_id
,b.house_id,b.house_title,c.id as agent_id,c.name,c.img"
;
return
$oReportModel
->
getReport
(
$field_report
,
[
"user_id"
=>
$user_id
]);
case
2
:
return
$this
->
orderService
->
selectListByUserIdAndSiteId
(
$user_id
,
''
,
$site_id
);
default
:
return
null
;
break
;
}
}
/**
* 电话跟进
* @param $user_id
* @param $site_id
* @param $page_no
* @param $page_size
*/
public
function
phoneFollowUp
(
$user_id
,
$site_id
,
$page_no
,
$page_size
)
{
// $userParams["type"] = 0; //电话跟进 $userParams["type"] = 1; //普通跟进
$uPhoneFollowModel
=
new
UPhoneFollowPp
(
$site_id
);
//电话跟进
$userParams
[
"user_id"
]
=
$user_id
;
$field_user_follow
=
"a.id,a.content,a.user_id,a.agent_id,a.type,a.create_time,a.user_status,b.name,b.phone,b.img,c.store_name"
;
$bargainData
=
$uPhoneFollowModel
->
getFollowUpList
(
$field_user_follow
,
$userParams
,
$page_no
,
$page_size
);
return
$bargainData
;
}
}
\ No newline at end of file
application/model/OReportModel.php
View file @
6a194c9e
...
...
@@ -162,6 +162,30 @@ class OReportModel extends Model
->
select
();
}
/**
* 获取最近一条报备记录
* @param string $filed
* @param $params
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
getReport
(
$filed
=
"id"
,
$params
){
$where_
=
[];
if
(
isset
(
$params
[
"user_id"
]))
{
$where_
[
"a.user_id"
]
=
$params
[
"user_id"
];
}
return
$this
->
db
->
field
(
$filed
)
->
alias
(
"a"
)
->
join
(
"o_order b"
,
"a.id = b.f_id"
,
"left"
)
->
join
(
"a_agents c"
,
"a.report_agent_id = c.id"
,
"left"
)
->
where
(
$where_
)
->
order
(
"a.create_time desc"
)
->
limit
(
1
)
->
select
();
}
/**
* @param string $filed
* @param $params
...
...
application/model/UPhoneFollowPp.php
View file @
6a194c9e
...
...
@@ -122,6 +122,7 @@ class UPhoneFollowPp extends BaseModel
}
/*zw start**/
public
function
getFollowUpListByUserId
(
$field
,
$params
)
{
$where_
=
[];
...
...
@@ -144,6 +145,26 @@ class UPhoneFollowPp extends BaseModel
}
public
function
getFollowUpList
(
$field
,
$params
,
$page_no
,
$page_size
)
{
$where_
=
[];
if
(
isset
(
$params
[
"user_id"
]))
{
$where_
[
"a.user_id"
]
=
$params
[
"user_id"
];
}
$result
=
$this
->
UPhoneFollowPp
->
field
(
$field
)
->
alias
(
"a"
)
->
join
(
"a_agents b"
,
"a.agent_id = b.id"
,
"left"
)
->
where
(
$where_
)
->
order
(
"a.create_time desc"
)
->
page
(
$page_no
)
->
limit
(
$page_size
)
->
select
();
return
$result
;
}
/*zw end**/
public
function
phone_up_list
(
$pagesize
,
$pagenum
)
...
...
application/route.php
View file @
6a194c9e
...
...
@@ -393,6 +393,10 @@ Route::group('index', [
'getBlackListInfo'
=>
[
'index/broker/getBlackListInfo'
,
[
'method'
=>
'GET|POST'
]
],
//黑名单详情
'delAgentsBlackListImg'
=>
[
'index/broker/delAgentsBlackListImg'
,
[
'method'
=>
'GET|POST'
]
],
//黑名单删除图片
'userDetail'
=>
[
'index/UserLog/userDetail'
,
[
'method'
=>
'get|post'
]],
'userLog'
=>
[
'index/UserLog/userLog'
,
[
'method'
=>
'get|post'
]],
'followUpLog'
=>
[
'index/UserLog/followUpLog'
,
[
'method'
=>
'get|post'
]],
'dailyDetail'
=>
[
'index/DailyPaper/dailyDetail'
,
[
'method'
=>
'get|post'
]],
'addDaily'
=>
[
'index/DailyPaper/addDaily'
,
[
'method'
=>
'get|post'
]],
'commitCheck'
=>
[
'index/DailyPaper/commitCheck'
,
[
'method'
=>
'get|post'
]],
...
...
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