Commit 0c03168e authored by zhuwei's avatar zhuwei

首页客户跟进

parent 289359db
......@@ -39,11 +39,11 @@ class HomePageLog extends Basic
public function userFollowUpList()
{
$params = $this->params;
/* $params = array(
"start_time" => time(), //开始时间
"end_time" => time() . " 23:59:59", //结束时间
"name_or_phone" => "li",//用户姓名或电话 经纪人
"search_content" => "111",// 搜索跟进内容
/*$params = array(
"start_time" => strtotime('2016-08-14 15:47:36'), //开始时间
"end_time" => strtotime('2018-08-14 15:47:36'), //结束时间
"name_or_phone" => "18112347151",//用户姓名或电话 经纪人
"search_content" => "",// 搜索跟进内容
"pageNo" => 1,
"pageSize" => 15
);*/
......@@ -55,7 +55,7 @@ class HomePageLog extends Basic
$pageNo = empty($params['pageNo']) ? 1 : $params['pageNo'];
$pageSize = empty($params['pageSize']) ? 15 : $params['pageSize'];
$field = "f.id,f.user_id,f.agent_id,f.type,f.content,f.create_time,f.user_status,a.name,a.img,b.store_name";
$field = "f.id,f.user_id,f.agent_id,f.type,f.content,f.create_time,f.user_status";
$where_ = [];
if (!empty($params["search_content"])) {
$where_["f.content"] = array( "like", "%" . trim($params['search_content']) . "%" );
......@@ -65,19 +65,43 @@ class HomePageLog extends Basic
$end_time = date("Y-m-d H:i:s", $params["end_time"]);
$where_["f.create_time"] = array( 'between', array( $start_time, $end_time ) );
}
if (!empty($params["name_or_phone"])) {
/*if (!empty($params["name_or_phone"])) {
$where_["a.name|a.phone"] = array( "like", "%" . trim($params["name_or_phone"]) . "%" );
}*/
if (!empty($params["name_or_phone"])) {
if((preg_match("/^1\d{10}$/", $params['name_or_phone']) != 1) or (strlen($params['name_or_phone']) < 6)){
return $this->response("300", '手机号有误或者姓名不满两位汉字');
}
//$agent_params["phone|name"] = array( "like", "%" . trim($params["name_or_phone"]) . "%" );
$agent_params["phone|name"] = $params["name_or_phone"];
$agent_field = "id";
$model = new AAgents();
$res_a = $model->getAgentsIdsArray($agent_field, $agent_params);
if($res_a){
$where_["f.agent_id"] = ['in',$res_a];
}
}
$where_["u.city"] = trim($this->city);
$where_["f.city"] = trim($this->city) ? trim($this->city) :'上海市';
$join = [
[ 'a_agents a', 'a.id=f.agent_id', 'left' ],
[ 'u_users u', 'u.id=f.user_id', 'left' ],
[ 'a_store b', 'b.id=a.store_id', 'left' ],
];
$join = [];
$order = "f.id desc";
$result = $this->uPhoneFollowUpModel->getSearch($pageNo, $pageSize, $order, $field, $join, $where_, "");
foreach ($result as $key => $value) {
$agent_params =[];
$agent_params["a.id"] = $value['agent_id'];
$agent_field = "a.name,a.img,b.store_name";
$model = new AAgents();
$res_a = $model->getAgentsInfo($agent_field, $agent_params);
$result[$key]['name'] =$res_a[0]['name'];
$result[$key]['img'] =$res_a[0]['img'];
$result[$key]['store_name']=$res_a[0]['store_name'];
}
//$count = $this->uPhoneFollowUpModel->getSearchCount($join, $where_);
if (count($result) > 0) {
$list["result"] = $result;
......@@ -144,7 +168,7 @@ class HomePageLog extends Basic
}
if (!empty($params["name_or_phone"])) {
if(!preg_match("/^1\d{10}$/", $params['name_or_phone']) and (strlen($params['name_or_phone']) < 6)){
if((preg_match("/^1\d{10}$/", $params['name_or_phone']) != 1) or (strlen($params['name_or_phone']) < 6)){
return $this->response("300", '手机号有误或者姓名不满两位汉字');
}
//$agent_params["phone|name"] = array( "like", "%" . trim($params["name_or_phone"]) . "%" );
......
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