Commit 15022c83 authored by clone's avatar clone

楼盘详情

parent b8ac5310
......@@ -14,6 +14,13 @@ use app\model\HouseInfos;
class Shop extends Basic
{
protected $db;
function __construct($request = null)
{
parent::__construct($request);
$this->db = new HouseInfos();
}
/**
* @return \think\Response
......@@ -100,12 +107,35 @@ class Shop extends Basic
$conditions['room_num_left'] = array( '<>', 0 );
}
$HouseInfos = new HouseInfos();
$result = $HouseInfos->getHouseInfoList($pageNo, $pageSize, $order_, $field, $conditions);
$result = $this->db->getHouseInfoList($pageNo, $pageSize, $order_, $field, $conditions);
if (empty($result)) {
return $this->response("200", "此条件没有找到数据");
}
return $this->response("200", '', $result);
return $this->response("200", 'request success', $result);
}
/**
* 楼盘详情
* @return \think\Response
*/
public function getShopDetail()
{
$params = $this->params;
$field = "id,management_fee,title,address,city,disc,disccircles,sales,yetai,room_area2,shangpu_type,is_test,
room_num_left,shangpu_tags,carefully_chosen,price,dish,file_path";
$conditions = [];
if (empty($params['id'])) {
return $this->response("101", "详情id不能为空");
}
$conditions['id'] = array( "eq", $params["id"] );
$result = $this->db->getHouseDetail($field, $conditions);
if($result['room_num_left'] == 0){
return $this->response("101", '此楼盘已下架');
}
return $this->response("200", 'request success', $result);
}
}
\ No newline at end of file
......@@ -42,7 +42,8 @@ class HouseInfos extends Model
* @return float
*/
function getAveragePrice()
{//price
{
//price
$params['rent_type'] = array( "eq", 1 ); //月租金类型
$params['room_num_left'] = array( "<>", 0 );//剩余店铺为0的不算
......@@ -58,6 +59,13 @@ class HouseInfos extends Model
return $averagePrice;
}
function getHouseDetail($field, $params)
{
return $data = $this->dbHouseInfo
->field($field)
->where($params)
->select();
}
}
......@@ -56,6 +56,7 @@ Route::group('api',[
//post shop
'shopList' => ['api/shop/getShopList', ['method' => 'post']],
'shopDetail' => ['api/shop/getShopDetail', ['method' => 'get']],
]);
\ No newline at end of file
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