Commit 60fc7091 authored by hujun's avatar hujun

独家方

parent 3a53dd99
......@@ -250,4 +250,23 @@ class Houses extends Basic
return $this->response($this->code, $this->msg, $this->data);
}
/**
* 获取独家方
*
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getExclusive() {
if ($this->params['houses_id']) {
$this->data = $this->house->getExclusive($this->params,$this->params['houses_id']);
} else {
$this->code = 101;
$this->msg = 'houses_id is null';
}
return $this->response($this->code, $this->msg, $this->data);
}
}
\ No newline at end of file
......@@ -291,4 +291,38 @@ class GHouses extends BaseModel
}
return $return;
}
/**
* 获取独家方信息
*
* @param $data
* @param $houses_id
* @return bool
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getExclusive($data, $houses_id) {
$result = $this->field('id')->where('id',$houses_id)->where('status','<>',3)->find();
if ($result->id) {
$house_ext = $this->table('g_houses_ext')->where('house_id',$houses_id)->field('agent_start_time,agent_end_time')->find();
$agents = $this->table('g_houses_to_agents')->field('b.id,b.name,b.phone')->alias('a')
->join('a_agents b', 'a.agents_id=b.id','left')
->where('a.is_del','<>',1)
->where('b.status',0)->find();
$img = $this->table('g_houses_imgs')
->field('img_name')
->where('house_id',$houses_id)
->where('img_status',0)->select();
$return['id'] = $agents->id;
$return['name'] = $agents['name'].'-'.$agents['phone'];
$return['agent_start_time'] = $house_ext['agent_start_time'];
$return['agent_end_time'] = $house_ext['agent_end_time'];
$return['exclusive_img'] = $img;
} else {
$return = false;
}
return $return;
}
}
......@@ -107,6 +107,7 @@ Route::group('index', [
'getHouseList' => ['index/houses/getHouseList', ['method' => 'get']], //楼盘列表
'carefullyChosen' => ['index/houses/carefullyChosen', ['method' => 'post']], //设置精选楼盘
'editExclusive' => ['index/houses/editExclusive', ['method' => 'post']], //添加和编辑楼盘独家
'getExclusive' => ['index/houses/getExclusive', ['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