Commit 0c03168e authored by zhuwei's avatar zhuwei

首页客户跟进

parent 289359db
...@@ -39,11 +39,11 @@ class HomePageLog extends Basic ...@@ -39,11 +39,11 @@ class HomePageLog extends Basic
public function userFollowUpList() public function userFollowUpList()
{ {
$params = $this->params; $params = $this->params;
/* $params = array( /*$params = array(
"start_time" => time(), //开始时间 "start_time" => strtotime('2016-08-14 15:47:36'), //开始时间
"end_time" => time() . " 23:59:59", //结束时间 "end_time" => strtotime('2018-08-14 15:47:36'), //结束时间
"name_or_phone" => "li",//用户姓名或电话 经纪人 "name_or_phone" => "18112347151",//用户姓名或电话 经纪人
"search_content" => "111",// 搜索跟进内容 "search_content" => "",// 搜索跟进内容
"pageNo" => 1, "pageNo" => 1,
"pageSize" => 15 "pageSize" => 15
);*/ );*/
...@@ -55,7 +55,7 @@ class HomePageLog extends Basic ...@@ -55,7 +55,7 @@ class HomePageLog extends Basic
$pageNo = empty($params['pageNo']) ? 1 : $params['pageNo']; $pageNo = empty($params['pageNo']) ? 1 : $params['pageNo'];
$pageSize = empty($params['pageSize']) ? 15 : $params['pageSize']; $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_ = []; $where_ = [];
if (!empty($params["search_content"])) { if (!empty($params["search_content"])) {
$where_["f.content"] = array( "like", "%" . trim($params['search_content']) . "%" ); $where_["f.content"] = array( "like", "%" . trim($params['search_content']) . "%" );
...@@ -65,19 +65,43 @@ class HomePageLog extends Basic ...@@ -65,19 +65,43 @@ class HomePageLog extends Basic
$end_time = date("Y-m-d H:i:s", $params["end_time"]); $end_time = date("Y-m-d H:i:s", $params["end_time"]);
$where_["f.create_time"] = array( 'between', array( $start_time, $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"]) . "%" ); $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 = [ $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' ],
];
$order = "f.id desc"; $order = "f.id desc";
$result = $this->uPhoneFollowUpModel->getSearch($pageNo, $pageSize, $order, $field, $join, $where_, ""); $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_); //$count = $this->uPhoneFollowUpModel->getSearchCount($join, $where_);
if (count($result) > 0) { if (count($result) > 0) {
$list["result"] = $result; $list["result"] = $result;
...@@ -144,7 +168,7 @@ class HomePageLog extends Basic ...@@ -144,7 +168,7 @@ class HomePageLog extends Basic
} }
if (!empty($params["name_or_phone"])) { 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", '手机号有误或者姓名不满两位汉字'); return $this->response("300", '手机号有误或者姓名不满两位汉字');
} }
//$agent_params["phone|name"] = array( "like", "%" . trim($params["name_or_phone"]) . "%" ); //$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