Commit 0bd87f2f authored by clone's avatar clone

首页房源数据统计

parent 1e4276a8
...@@ -37,14 +37,14 @@ class HomePageLog extends Basic ...@@ -37,14 +37,14 @@ 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" => time(), //开始时间
"end_time" => time() . " 23:59:59", //结束时间 "end_time" => time() . " 23:59:59", //结束时间
"name_or_phone" => "li",//用户姓名或电话 经纪人 "name_or_phone" => "li",//用户姓名或电话 经纪人
"search_content" => "111",// 搜索跟进内容 "search_content" => "111",// 搜索跟进内容
"pageNo" => 1, "pageNo" => 1,
"pageSize" => 15 "pageSize" => 15
);*/ );*/
if (empty($params['start_time']) || empty($params['end_time'])) { if (empty($params['start_time']) || empty($params['end_time'])) {
return $this->response("101", '请选择时间'); return $this->response("101", '请选择时间');
...@@ -53,14 +53,14 @@ class HomePageLog extends Basic ...@@ -53,14 +53,14 @@ 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,a.name,a.img,b.store_name";
$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']) . "%" );
} }
if (!empty($params["start_time"]) && !empty($params["end_time"])) { if (!empty($params["start_time"]) && !empty($params["end_time"])) {
$start_time = date("Y-m-d H:i:s",$params["start_time"]); $start_time = date("Y-m-d H:i:s", $params["start_time"]);
$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"])) {
...@@ -74,9 +74,11 @@ class HomePageLog extends Basic ...@@ -74,9 +74,11 @@ class HomePageLog extends Basic
]; ];
$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_, "");
$count = $this->uPhoneFollowUpModel->getSearchCount($join, $where_);
if (count($result) > 0) { if (count($result) > 0) {
$list["result"] = $result; $list["result"] = $result;
$list["img_path"] = AGENTHEADERIMGURL; $list["img_path"] = AGENTHEADERIMGURL;
$list["total"] = $count;
return $this->response("200", "request success", $list); return $this->response("200", "request success", $list);
} else { } else {
return $this->response("200", "request null"); return $this->response("200", "request null");
...@@ -95,20 +97,22 @@ class HomePageLog extends Basic ...@@ -95,20 +97,22 @@ class HomePageLog extends Basic
public function houseFollowUpList() public function houseFollowUpList()
{ {
$params = $this->params; $params = $this->params;
/* $params = array( /* $params = array(
"start_time" => time(), //开始时间 "start_time" => time(), //开始时间
"end_time" => time() . " 23:59:59", //结束时间 "end_time" => time() . " 23:59:59", //结束时间
"name_or_phone" => "li",//用户姓名或电话 "name_or_phone" => "li",//用户姓名或电话
"search_content" => "111",// 搜索跟进内容 "search_content" => "111",// 搜索跟进内容
"pageNo" => 1, "pageNo" => 1,
"pageSize" => 15 "pageSize" => 15
);*/ );*/
if (empty($params['start_time']) || empty($params['end_time'])) { if (empty($params['start_time']) || empty($params['end_time'])) {
return $this->response("101", '请选择时间'); return $this->response("101", '请选择时间');
} }
$where_ = [];
$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'];
...@@ -118,8 +122,8 @@ class HomePageLog extends Basic ...@@ -118,8 +122,8 @@ class HomePageLog extends Basic
$where_["f.follow_up_info"] = array( "like", "%" . trim($params['search_content']) . "%" ); $where_["f.follow_up_info"] = array( "like", "%" . trim($params['search_content']) . "%" );
} }
if (!empty($params["start_time"]) && !empty($params["end_time"])) { if (!empty($params["start_time"]) && !empty($params["end_time"])) {
$start_time = date("Y-m-d H:i:s",$params["start_time"]); $start_time = date("Y-m-d H:i:s", $params["start_time"]);
$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"])) {
...@@ -132,9 +136,11 @@ class HomePageLog extends Basic ...@@ -132,9 +136,11 @@ class HomePageLog extends Basic
]; ];
$order = "f.id desc"; $order = "f.id desc";
$result = $this->gHouseFollowUpModel->getSearch($pageNo, $pageSize, $order, $field, $join, $where_, ""); $result = $this->gHouseFollowUpModel->getSearch($pageNo, $pageSize, $order, $field, $join, $where_, "");
$count = $this->gHouseFollowUpModel->getSearchCount($join, $where_);
if (count($result) > 0) { if (count($result) > 0) {
$list["result"] = $result; $list["result"] = $result;
$list["img_path"] = AGENTHEADERIMGURL; $list["img_path"] = AGENTHEADERIMGURL;
$list["total"] = $count;
return $this->response("200", "request success", $list); return $this->response("200", "request success", $list);
} else { } else {
return $this->response("200", "request null"); return $this->response("200", "request null");
......
...@@ -109,4 +109,19 @@ class GHousesFollowUp extends Model ...@@ -109,4 +109,19 @@ class GHousesFollowUp extends Model
// echo $this->getLastSql(); // echo $this->getLastSql();
return $data; return $data;
} }
/**
* 首页商铺跟进搜索
* @param $join
* @param $where
* @return int
*/
public function getSearchCount( $join, $where)
{
$data = $this->db_
->alias('f')
->join($join)
->where($where)
->count();
return $data;
}
} }
\ No newline at end of file
...@@ -65,6 +65,21 @@ class UPhoneFollowPp extends BaseModel ...@@ -65,6 +65,21 @@ class UPhoneFollowPp extends BaseModel
return $data; return $data;
} }
/**
* @param $join
* @param $where
* @return int
*/
public function getSearchCount( $join, $where)
{
$r = $this
->alias('f')
->join($join)
->where($where)
->count();
return $r;
}
public function getUserAgentTotal($params, $join) public function getUserAgentTotal($params, $join)
{ {
......
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