Commit 3d1e3239 authored by clone's avatar clone

商铺跟进

parent b08a2361
......@@ -3,6 +3,7 @@
namespace app\api_broker\controller;
use app\api_broker\extend\Basic;
use app\model\GHousesFollowUp;
use app\model\UPhoneFollowPp;
use think\Request;
......@@ -17,11 +18,13 @@ class HomePageLog extends Basic
{
private $uPhoneFollowUpModel;
private $gHouseFollowUpModel;
function __construct(Request $request = null)
{
parent::__construct($request);
$this->uPhoneFollowUpModel = new UPhoneFollowPp();
$this->gHouseFollowUpModel = new GHousesFollowUp();
}
/**
......@@ -35,10 +38,10 @@ class HomePageLog extends Basic
{
$params = $this->params;
/* $params = array(
"start_time" => time(),
"end_time" => time() . " 23:59:59",
"name_or_phone" => "li",
"search_content" => "111",
"start_time" => time(), //开始时间
"end_time" => time() . " 23:59:59", //结束时间
"name_or_phone" => "li",//用户姓名或电话
"search_content" => "111",// 搜索跟进内容
"pageNo" => 1,
"pageSize" => 15
);*/
......@@ -78,5 +81,61 @@ class HomePageLog extends Basic
}
}
/**
* 首页商铺跟进
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function houseFollowUpList()
{
$params = $this->params;
/* $params = array(
"start_time" => time(), //开始时间
"end_time" => time() . " 23:59:59", //结束时间
"name_or_phone" => "li",//用户姓名或电话
"search_content" => "111",// 搜索跟进内容
"pageNo" => 1,
"pageSize" => 15
);*/
if (empty($params['start_time']) || empty($params['end_time'])) {
return $this->response("101", '请选择时间');
}
$pageNo = empty($params['pageNo']) ? 1 : $params['pageNo'];
$pageSize = empty($params['pageSize']) ? 15 : $params['pageSize'];
$field = "f.id,f.house_id,f.agent_id,f.follow_up_info,f.create_time,a.name,a.img,b.store_name";
if (!empty($params["search_content"])) {
$where_["f.follow_up_info"] = array( "like", "%" . trim($params['search_content']) . "%" );
}
if (!empty($params["start_time"]) && !empty($params["end_time"])) {
$where_["f.create_time"] = array( 'between', array( $params["start_time"], $params["end_time"] ) );
}
if (!empty($params["name_or_phone"])) {
$where_["a.phone|a.name"] = array( "like", "%" . trim($params["name_or_phone"]) . "%" );
}
$join = [
[ 'a_agents a', 'a.id=f.agent_id', 'left' ],
[ 'a_store b', 'b.id=a.store_id', 'left' ],
];
$order = "f.id desc";
$result = $this->gHouseFollowUpModel->getSearch($pageNo, $pageSize, $order, $field, $join, $where_, "");
if (count($result) > 0) {
$list["result"] = $result;
$list["img_path"] = AGENTHEADERIMGURL;
return $this->response("200", "request success", $list);
} else {
return $this->response("200", "request null");
}
}
}
\ No newline at end of file
......@@ -75,4 +75,30 @@ class GHousesFollowUp extends Model
->where($where_)
->select();
}
/**
* 首页商铺跟进搜索
* @param int $p
* @param int $pageSize
* @param string $order_
* @param $field
* @param $join
* @param $where
* @param $group
* @return false|\PDOStatement|string|\think\Collection
*/
public function getSearch($p = 1, $pageSize = 15, $order_ = 'id desc', $field, $join, $where, $group)
{
$data = $this->db_->field($field)
->alias('f')
->join($join)
->where($where)
->group($group)
->order($order_)
->limit($pageSize)
->page($p)
->select();
echo $this->getLastSql();
return $data;
}
}
\ No newline at end of file
......@@ -444,6 +444,7 @@ Route::group('broker', [
//首页跟进记录
'userFollowUpList' => ['api_broker/HomePageLog/userFollowUpList', [ 'method' => 'get' ] ],
'houseFollowUpList' => ['api_broker/HomePageLog/houseFollowUpList', [ 'method' => 'get' ] ],
......
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