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
2613a9c2
Commit
2613a9c2
authored
Jun 06, 2019
by
clone
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '0529-v3.3.0' of
https://gitee.com/zwyjjc/tl_estate
into 0529-v3.3.0
parents
012b1e0f
16380965
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
274 additions
and
0 deletions
+274
-0
OfficeRemark.php
application/index/controller/OfficeRemark.php
+167
-0
OfficePhoneFollowUpService.php
application/index/service/OfficePhoneFollowUpService.php
+107
-0
No files found.
application/index/controller/OfficeRemark.php
0 → 100644
View file @
2613a9c2
<?php
/**
* Created by PhpStorm.
* User: zfc
* Date: 2018/2/9
* Time: 14:23
*/
namespace
app\index\controller
;
use
app\api_broker\service\CallPhoneService
;
use
app\api_broker\service\ClientService
;
use
app\api_broker\service\RedisCacheService
;
use
app\index\extend\Basic
;
use
app\index\service\OfficePhoneFollowUpService
;
use
app\index\service\PhoneFollowUpService
;
use
app\index\service\UserLogService
;
use
app\index\service\UserService
;
use
app\model\AAgents
;
use
app\model\ASite
;
use
app\model\GOperatingRecords
;
use
app\model\Remarks
;
use
app\model\ULabels
;
use
app\model\UPhoneFollowUp
;
use
app\model\Users
;
use
app\search\service\SearchService
;
class
OfficeRemark
extends
Basic
{
/**
* 跟进列表
*
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
followUpList
()
{
if
(
!
$this
->
request
->
isAjax
())
{
return
view
(
'remark_follow_index'
);
}
if
(
!
strtotime
(
$this
->
params
[
'start_date'
])
||
!
strtotime
(
$this
->
params
[
'end_date'
]))
{
return
$this
->
response
(
101
,
'时间格式错误'
,
[]);
}
if
(
!
strtotime
(
$this
->
params
[
'start_date'
])
||
!
strtotime
(
$this
->
params
[
'end_date'
]))
{
return
$this
->
response
(
101
,
'时间格式错误'
,
[]);
}
if
(
!
empty
(
$this
->
params
[
'start_date'
])
||
!
empty
(
$this
->
params
[
'end_date'
]))
{
$time
=
strtotime
(
$this
->
params
[
'end_date'
])
-
strtotime
(
$this
->
params
[
'start_date'
]);
if
(
$time
>
2592000
||
$time
<
0
)
{
return
$this
->
response
(
101
,
'搜索时间不能大于30天'
);
}
}
$code
=
200
;
$msg
=
''
;
$where
=
$list
=
[];
$where
[
'page_no'
]
=
$this
->
params
[
'pageNo'
];
$where
[
'page_size'
]
=
$this
->
params
[
'pageSize'
];
//默认跟进城市
$site_id
=
$this
->
siteId
;
if
(
!
empty
(
$this
->
params
[
'user_id'
]))
{
$where
[
'user_id'
]
=
(
int
)
$this
->
params
[
'user_id'
];
}
if
(
!
empty
(
$this
->
params
[
'agent_id'
]))
{
$where
[
'agent_id'
]
=
(
int
)
$this
->
params
[
'agent_id'
];
}
if
(
!
empty
(
$this
->
params
[
'content'
]))
{
$where
[
'content'
]
=
$this
->
params
[
'content'
];
}
//有权限的人可以查看其它城市的跟进
if
(
!
empty
(
$this
->
params
[
'site_id'
]))
{
$site_id
=
$this
->
params
[
'site_id'
];
}
$if_search
=
false
;
$is_today
=
true
;
if
(
date
(
'Y-m-d'
)
==
$this
->
params
[
'start_date'
]
&&
date
(
'Y-m-d'
)
==
$this
->
params
[
'end_date'
])
{
$is_today
=
false
;
}
$result
=
[];
if
(
$site_id
==
"10001"
&&
(
$this
->
params
[
'agent_id'
]
>
0
||
!
empty
(
$this
->
params
[
"content"
]))
&&
$is_today
&&
empty
(
$this
->
params
[
'user_id'
]))
{
$searchService
=
new
SearchService
();
$this
->
params
[
'search_content'
]
=
$this
->
params
[
'content'
];
$this
->
params
[
'start_time'
]
=
strtotime
(
$this
->
params
[
'start_date'
]
.
' 00:00:00'
);
$this
->
params
[
'end_time'
]
=
strtotime
(
$this
->
params
[
'end_date'
]
.
' 23:59:59'
);
$search_result
=
$searchService
->
searchByKeyword
(
$this
->
params
,
$this
->
params
[
'pageNo'
],
$this
->
params
[
'pageSize'
],
$this
->
params
[
'agent_id'
]);
$search_result
=
json_decode
(
$search_result
,
true
);
$result
=
$search_result
[
"result"
][
"items"
];
$if_search
=
true
;
}
else
{
$follow_up_service
=
new
OfficePhoneFollowUpService
(
$site_id
);
$result_list
=
$follow_up_service
->
getPhoneFollowList
(
$this
->
params
[
'start_date'
],
$this
->
params
[
'end_date'
],
$where
,
$this
->
userId
);
if
(
$result_list
[
'code'
]
==
200
)
{
$result
=
$result_list
[
'data'
];
}
else
{
$code
=
101
;
$msg
=
$result_list
[
'msg'
];
}
}
if
(
$result
)
{
$redis_service
=
new
RedisCacheService
();
$s_user_service
=
new
UserService
();
$s_user_Log_service
=
new
UserLogService
();
$call
=
new
CallPhoneService
();
$label_data
=
$redis_service
->
userCallLabelCache
();
foreach
(
$result
as
$k
=>
$v
)
{
$user_data
=
$agent_data
=
[];
if
(
!
empty
(
$v
[
'user_id'
]))
{
$user_data
=
$redis_service
->
getRedisCache
(
1
,
$v
[
'user_id'
]);
$list
[
$k
][
'user_name'
]
=
$user_data
[
'user_name'
];
}
else
{
$list
[
$k
][
'user_name'
]
=
''
;
}
if
(
!
empty
(
$v
[
'agent_id'
]))
{
$agent_data
=
$redis_service
->
getRedisCache
(
2
,
$v
[
'agent_id'
]);
$list
[
$k
][
'admin'
]
=
$agent_data
[
'name'
];
}
else
{
$list
[
$k
][
'admin'
]
=
''
;
}
$list
[
$k
][
'agent_id'
]
=
$v
[
'agent_id'
];
$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
(
$if_search
)
{
$list
[
$k
][
'create_time'
]
=
date
(
'Y-m-d H:i:s'
,
$v
[
'create_time'
]
/
1000
);
}
else
{
$list
[
$k
][
'create_time'
]
=
$v
[
'create_time'
];
}
#客户是否在保护期内(0:保护器内 1:超过保护期)
$list
[
$k
][
'is_outstrip_twenty_four_hours'
]
=
$s_user_service
->
isUserProtect
(
$v
[
'user_id'
]);
#判断当天被拨打是否超过5次,同时判断是否当前经纪人跟当前客户是否有电话绑定(0允许拨打 1不允许拨打)
$list
[
$k
][
'is_outpace_call_num'
]
=
$s_user_Log_service
->
userDetailIsOutpaceCallNum
(
$v
[
'user_id'
],
$user_data
[
'user_phone'
],
$this
->
userId
);
if
(
$list
[
$k
][
'is_outpace_call_num'
])
{
$result
=
$call
->
checkBindRedis
(
$this
->
userId
,
$agent_data
[
'phone_list'
],
$v
[
'user_phone'
]);
if
(
$result
!=
''
){
$list
[
$k
][
'is_outpace_call_num'
]
=
0
;
}
}
$list
[
$k
][
'label_name'
]
=
array_key_exists
(
$v
[
'labels_id'
],
$label_data
)
?
$label_data
[
$v
[
'labels_id'
]]
:
''
;
}
}
$data
[
'data'
][
'list'
]
=
$list
;
$data
[
'data'
][
'total'
]
=
40000
;
return
$this
->
response
(
$code
,
$msg
,
$data
);
}
}
\ No newline at end of file
application/index/service/OfficePhoneFollowUpService.php
0 → 100644
View file @
2613a9c2
<?php
/**
* Created by PhpStorm.
* User: 43897
* Date: 2019/1/10
* Time: 13:51
*/
namespace
app\index\service
;
use
app\api_broker\service\VerifyRepetitionService
;
use
app\model\AAgents
;
use
app\model\OfficePhoneFollowUp
;
use
app\model\OfficeUPhoneFollowUpTemporary
;
class
OfficePhoneFollowUpService
{
private
$phoneFollowUp
;
private
$phoneFollowUpTemporary
;
private
$siteId
;
public
function
__construct
(
$site_id
)
{
$this
->
siteId
=
$site_id
;
$this
->
phoneFollowUp
=
new
OfficePhoneFollowUp
(
$site_id
);
$this
->
phoneFollowUpTemporary
=
new
OfficeUPhoneFollowUpTemporary
(
$site_id
);
}
/**
* @param string $start_time
* @param string $end_time
* @param array $params
* @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'
)
{
$vrs
=
new
VerifyRepetitionService
();
$page_no
=
isset
(
$params
[
'page_no'
])
?
$params
[
'page_no'
]
:
1
;
$page_size
=
isset
(
$params
[
'page_size'
])
?
$params
[
'page_size'
]
:
15
;
$is_check
=
$vrs
->
followUpClick
(
$agent_id
);
if
(
$page_no
==
1
&&
!
$is_check
){
$is_bool
=
$vrs
->
getCurrTimeSection
();
$msg
=
"请勿频繁请求"
;
if
(
$is_bool
)
{
$msg
=
"高峰期间每10秒钟只能搜索一次(6.30-8.30)"
;
}
return
[
'code'
=>
'101'
,
'msg'
=>
$msg
];
}
$where
=
' 1=1 '
;
if
(
empty
(
$start_time
)
||
empty
(
$end_time
))
{
return
[
'code'
=>
'101'
,
'msg'
=>
'时间不能为空'
];
}
else
{
$where
.=
' AND create_time BETWEEN "'
.
$start_time
.
' 00:00:00" AND "'
.
$end_time
.
' 23:59:59"'
;
}
if
(
isset
(
$params
[
'user_id'
]))
{
$where
.=
" AND user_id=
{
$params
[
'user_id'
]
}
"
;
}
if
(
isset
(
$params
[
'agent_id'
]))
{
$where
.=
" AND agent_id =
{
$params
[
'agent_id'
]
}
"
;
}
if
(
!
empty
(
$params
[
'store_id'
]))
{
$agent_where
[
'store_id'
]
=
$params
[
'store_id'
];
}
if
(
!
empty
(
$params
[
'district_id'
]))
{
$agent_where
[
'district_id'
]
=
$params
[
'district_id'
];
}
if
(
!
empty
(
$params
[
'content'
]))
{
$params
[
'content'
]
=
trim
(
$params
[
'content'
]);
$where
.=
" AND content LIKE '%
{
$params
[
'content'
]
}
%'"
;
}
if
(
!
empty
(
$agent_where
))
{
$m_agent
=
new
AAgents
();
$agent_id
=
$m_agent
->
getAgentsByWhereColumn
(
$agent_where
,
'id'
);
if
(
empty
(
$agent_id
))
{
return
[
'code'
=>
'101'
,
'msg'
=>
'暂无数据'
];
}
else
{
$agent_id_string
=
implode
(
','
,
$agent_id
);
$where
.=
" AND agent_id in (
{
$agent_id_string
}
)"
;
}
}
$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
);
}
return
[
'code'
=>
'200'
,
'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