Commit a3132feb authored by hujun's avatar hujun

增加字段

parent 56f1dfce
......@@ -652,17 +652,20 @@ class OfficeRoomService
}
/*
* 房源列表
*
* @param $params
* @param int $is_total
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* User HuJun
* Date 19-6-2 下午2:26
* Date 19-6-3 上午10:31
*/
public function getRoomList($params) {
public function getRoomList($params, $is_total = 0) {
$page_no = empty($params['pageNo']) ? 1 : $params['pageNo'];
$page_size = empty($params['pageSize']) ? 15 : $params['pageSize'];
$result['status'] = 'fail';
$result['msg'] = '';
$result['data'] = [];
$where = $this->buildParams($params);
......@@ -685,14 +688,14 @@ class OfficeRoomService
$agent_where['a.is_del'] = 0;
}
try {
//盘方搜索
if (!empty($agent_where)) {
$agent_arr = $this->agent_room->getAgentsByRoomColumn('houses_id', $agent_where);
if (empty($agent_arr)) {
$data['data']['list'] = [];
$data['data']['total'] = 0;
return $this->response(200, '', $data);
$result['status'] = 'successful';
return $result;
} else {
$agent_str = implode(',', $agent_arr);
$where[] = ['EXP', "id in ({$agent_str})"];
......@@ -723,9 +726,18 @@ class OfficeRoomService
}
}
/*房东手机号搜索 end*/
$field = '';
$field = 'a.id';
$result['data'] = $this->m_office_room->getRoomAgent($page_no, $page_size, $field, $where);
if ($is_total) {
$result['total'] = $this->m_office_room->getRoomAgentTotal($where);
}
}catch (\Exception $e) {
$result['msg'] = $e->getMessage();
}
$this->m_office_room->getRoomAgent($page_no, $page_size, $field, $where);
return $result;
}
/**
......
......@@ -261,4 +261,26 @@ class OfficeGRoom extends BaseModel
->page($page_no)
->select();
}
/**
* @param $page_no
* @param $page_size
* @param $field
* @param $where
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* User HuJun
* Date 19-6-2 下午1:57
*/
public function getRoomAgentTotal($where)
{
return $this->alias('a')
->join('office_g_room_to_agent b', 'a.id = b.house_id', 'left')
->join('a_agents b', 'b.agent_id = b.id', 'left')
->join('office_g_building c', 'a.building_id = c.id', 'left')
->where($where)
->count('a.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