Commit 6d40c4da authored by hujun's avatar hujun

获取经纪人和楼盘关系信息

parent 053f8bd5
......@@ -175,7 +175,7 @@ class Broker extends Basic
*
* @return \think\Response
*/
public function delTohouses() {
public function delToHouses() {
$data['status'] = 200;
$data['data'] = '';
$data['msg'] = '';
......@@ -194,11 +194,8 @@ class Broker extends Basic
* 获取经纪人和楼盘关系信息
*
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getAgentsTohouses() {
public function getAgentsToHouses() {
$data['status'] = 200;
$data['data'] = '';
$data['msg'] = '';
......@@ -206,13 +203,20 @@ class Broker extends Basic
if ($this->params['houses_id']) {
$pageNo = empty($this->params['pageNo']) ? 1 : $this->params['pageNo'];
$pageSize = empty($this->params['pageSize']) ? 10 : $this->params['pageSize'];
$hg = new GHousesToAgents();
$fields = 'b.id,b.name,b.phone';
$where['a.is_del'] = ['=',0];
$where['b.status'] = ['=',0];
if (!empty($this->params['type'])) {
$where['a.type'] = $this->params['type'];
}
if (!empty($this->params['houses_id'])) {
$where['a.houses_id'] = $this->params['houses_id'];
$data['data'] = $hg->getAgentsHousesList($pageNo, $pageSize, 'id DESC', $fields, $where);
}
$m_house = new GHousesToAgents();
$data['data'] = $m_house->getAgentsHousesList($pageNo, $pageSize, 'id DESC', $fields, $where);
} else {
$data['status'] = 101;
$data['msg'] = 'houses_id is null';
......
......@@ -202,14 +202,12 @@ class GHousesToAgents extends BaseModel
* @param string $order_
* @param string $field
* @param string $params
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @return mixed
*/
public function getAgentsHousesList($pageNo = 1, $pageSize = 15, $order_ = 'id desc', $field = '', $params = '')
{
return $this->field($field)
try {
$result['data'] = $this->field($field)
->alias('a')
->join('a_agents b', 'a.agents_id = b.id', 'left')
->where($params)
......@@ -217,6 +215,12 @@ class GHousesToAgents extends BaseModel
->limit($pageSize)
->page($pageNo)
->select();
$result['status'] = 'successful';
} catch (\Exception $e) {
$result['status'] = 'fail';
$result['msg'] = $e->getMessage();
}
return $result;
}
/**
......
......@@ -104,8 +104,8 @@ Route::group('index', [
'getBrokerList' => [ 'index/broker/getBrokerList', [ 'method' => 'get' ] ],//门店列表的经纪人
'addHousesAgents' => [ 'index/broker/AddHousesAgents', [ 'method' => 'POST' ] ], //新增楼盘与经纪人关系(案场权限人)
'addHousesAgentsDish' => [ 'index/broker/AddHousesAgents', [ 'method' => 'POST' ] ], //新增楼盘与经纪人关系(盘方)
'delTohouses' => [ 'index/broker/delTohouses', [ 'method' => 'POST' ] ], //解除经纪人和楼盘关系
'getAgentsTohouses' => [ 'index/broker/getAgentsTohouses', [ 'method' => 'GET' ] ], //获取经纪人和楼盘关系信息
'delTohouses' => [ 'index/broker/delToHouses', [ 'method' => 'POST' ] ], //解除经纪人和楼盘关系
'getAgentsTohouses' => [ 'index/broker/getAgentsToHouses', [ 'method' => 'GET' ] ], //获取经纪人和楼盘关系信息
'getAgentDistrictStore' => [ 'index/broker/getAgentDistrictStore', [ 'method' => 'GET' ] ], //获取经纪人id获取部门门店名称
'getCurrentCity' => [ 'index/broker/getCurrentCity', [ 'method' => 'GET' ] ], //获取所属城市
'settingCity' => [ 'index/broker/settingCity', [ 'method' => 'POST' ] ], //设置所属城市
......
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