Commit 462401b0 authored by hujun's avatar hujun

商铺列表优化

parent 9aa586a6
This diff is collapsed.
......@@ -272,19 +272,28 @@ class GHouses extends BaseModel
*/
public function getHouseListDish($pageNo = 1, $pageSize = 15, $order_ = 'id desc', $field = '', $params = '', $agents_id = '')
{
$data = $this->field($field)->alias('a')
->join('g_houses_to_agents b', 'a.id=b.houses_id', 'left')
->join('a_agents c', 'b.agents_id=c.id', 'left')
->join('g_houses_ext d', 'a.id=d.house_id', 'left')
// $data = $this->field($field)->alias('a')
// ->join('g_houses_to_agents b', 'a.id=b.houses_id', 'left')
// ->join('a_agents c', 'b.agents_id=c.id', 'left')
// ->join('g_houses_ext d', 'a.id=d.house_id', 'left')
// ->where($params)
// ->order($order_)
// ->limit($pageSize)
// ->page($pageNo)
// ->group('a.id')
// ->select();
$data = $this->field($field)
->where($params)
->order($order_)
->limit($pageSize)
->page($pageNo)
->group('a.id')
->select();
$house_id = array();
$house_id = [];
$house_follow_up = new GHousesFollowUp();
foreach ($data as $k => $v) {
$house_id[$k] = $v['id'];
$v->create_time = date('Y-m-d', strtotime($v->create_time));
......@@ -340,14 +349,15 @@ class GHouses extends BaseModel
*/
public function getHouseListDishTotal($params = '')
{
$data = $this->alias('a')
->join('g_houses_to_agents b', 'a.id=b.houses_id', 'left')
->join('a_agents c', 'b.agents_id=c.id', 'left')
->join('g_houses_ext d', 'a.id=d.house_id', 'left')
->where($params)
->group('a.id')
->count();
return $data;
// $data = $this->alias('a')
// ->join('g_houses_to_agents b', 'a.id=b.houses_id', 'left')
// ->join('a_agents c', 'b.agents_id=c.id', 'left')
// ->join('g_houses_ext d', 'a.id=d.house_id', 'left')
// ->where($params)
// ->group('a.id')
// ->count();
// return $data;
return $this->where($params)->count();
}
/**
......@@ -764,6 +774,9 @@ class GHouses extends BaseModel
if (isset($params["create_time"])) {
$where_["create_time"] = $params["create_time"];
}
if (isset($params['landlord_phone'])) {
$where_["landlord_phone"] = $params['landlord_phone'];
}
$result = Db::table($this->table)
->field($field)
->where($where_)
......@@ -772,11 +785,17 @@ class GHouses extends BaseModel
return $result;
}
/**
* 获取新增楼盘数据
*
* @param $params
* @param $field
* @param $page_no
* @param $page_size
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getAddHouseList($params, $field, $page_no, $page_size)
{
......
......@@ -200,6 +200,20 @@ class GHousesToAgents extends BaseModel
return $result;
}
/**
* @param $field
* @param $params
* @return array
*/
public function getAgentsHouseField($field, $params)
{
return $this->field($field)
->alias("a")
->join("a_agents b", "a.agents_id = b.id", "left")
->where($params)
->column($field);
}
/**
* 楼盘对应的经纪人信息
*
......@@ -250,14 +264,15 @@ class GHousesToAgents extends BaseModel
*
* @param $house_id
* @param int $type
* @return array|\PDOStatement|string|\think\Model
* @param string $field
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getAgentList($house_id, $type = 1)
public function getAgentList($house_id, $type = 1, $field = 'b.id,device_id,b.name,b.phone')
{
return $this->field('b.id,device_id,b.name,b.phone')
return $this->field($field)
->alias('a')
->join('a_agents b', 'a.agents_id = b.id', 'left')
->where('houses_id', $house_id)
......
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