Commit c08d5e79 authored by hujun's avatar hujun

电话跟进

parent 0a3e1dc5
<?php
/**
* Created by PhpStorm.
* User: 43897
* Date: 2019/1/10
* Time: 13:51
*/
namespace app\index\service;
use app\model\AAgents;
use app\model\UPhoneFollowUp;
class PhoneFollowUp
{
private $phone_follow_up;
public function __construct($site_id)
{
$this->phone_follow_up = new UPhoneFollowUp($site_id);
}
/**
* @param string $start_time
* @param string $end_time
* @param array $params
* @param string $field
* @return array|bool|false|\PDOStatement|string|\think\Collection
* @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, $field = 'id,user_id,create_time,content,user_status,labels_id,agent_id')
{
if (empty($start_time) || empty($end_time)) {
return false;
} else {
$where['create_time'] = ['between', [$start_time . ' 00:00:00', $end_time . ' 23:59:59']];
}
$data = [];
if (isset($params['user_id'])) {
$where['user_id'] = $params['user_id'];
}
if (isset($params['agent_id'])) {
$where['agent_id'] = $params['agent_id'];
}
if (!empty($params['store_id'])) {
$agent_where['store_id'] = $params['remark_store_id'];
}
if (!empty($params['district_id'])) {
$agent_where['district_id'] = $params['district_id'];
}
$page_no = isset($params['page_no']) ? $params['page_no'] : 1;
$page_size = isset($params['page_size']) ? $params['page_size'] : 15;
unset($params['page_no']);
unset($params['page_size']);
if (!empty($agent_where)) {
$m_agent = new AAgents();
$agent_id = $m_agent->getAgentsByWhereColumn($agent_where, 'id');
if (empty($agent_id)) {
return $data;
} else {
$where['agent_id'] = ['in', $agent_id];
}
}
if ($start_time == $end_time && date('Y-m-d', strtotime($start_time)) == date('Y-m-d')) {
} else {
$data = $this->phone_follow_up->getFollowList($page_no, $page_size, $order_ = 'id desc', $field, $where);
}
return $data;
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment