Commit 7fbad51a authored by zw's avatar zw

houseDetail

parent d4c98587
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
namespace app\api_broker\controller; namespace app\api_broker\controller;
use app\api_broker\extend\Basic; use app\api_broker\extend\Basic;
use app\model\AttentionModel;
use app\model\GHouses; use app\model\GHouses;
use app\model\GHousesImgs; use app\model\GHousesImgs;
...@@ -13,16 +14,19 @@ use app\model\GHousesImgs; ...@@ -13,16 +14,19 @@ use app\model\GHousesImgs;
* Time : 10:36 * Time : 10:36
* Intro: * Intro:
*/ */
class Shop extends Basic class Shop extends Basic
{ {
private $gHousesModel; private $gHousesModel;
private $gHousesImgModel; private $gHousesImgModel;
private $attentionModel;
function __construct($request = null) function __construct($request = null)
{ {
parent::__construct($request); parent::__construct($request);
$this->gHousesModel = new GHouses(); $this->gHousesModel = new GHouses();
$this->gHousesImgModel = new GHousesImgs(); $this->gHousesImgModel = new GHousesImgs();
$this->attentionModel = new AttentionModel();
} }
/**查询商品列表 b c端公用 /**查询商品列表 b c端公用
...@@ -45,7 +49,7 @@ class Shop extends Basic ...@@ -45,7 +49,7 @@ class Shop extends Basic
"pageNo" => 1, "pageNo" => 1,
"pageSize" => 15 "pageSize" => 15
);*/ );*/
$params = $this->params; $params = $this->params;
$conditions = []; $conditions = [];
if (empty($params['site_area'])) { if (empty($params['site_area'])) {
...@@ -153,4 +157,73 @@ class Shop extends Basic ...@@ -153,4 +157,73 @@ class Shop extends Basic
return $this->response("200", 'request success', $result); return $this->response("200", 'request success', $result);
} }
} /**
\ No newline at end of file * 楼盘详情
* @return \think\Response
*/
public function getShopDetail()
{
/* $params = array(
"id" => 1,
"site_area" => 1, //1.c端 3.b端
"user_id" => 12 //if c端 用户登录后传入user_id
);*/
$params = $this->params;
$conditions = [];
if (empty($params['id'])) {
return $this->response("101", "详情id不能为空");
}
if (empty($params['site_area'])) {
return $this->response("101", "请求来源错误");
}
if ($params['site_area'] == 1) {
$field = "a.id,a.external_title as title,a.external_address as address,a.city,a.disc,a.business_district_id,a.status,
a.industry_type,a.shop_area_start,a.shop_area_end,a.shop_type,a.residue_num,a.shop_sign,a.is_carefully_chosen,a.rent_type,
a.rent_price,a.management_fee,a.slotting_fee,a.total,a.market_area,a.is_has_gas,a.file_path,
b.enter_num,b.external_item_advantage as item_advantage,b.sign_rule,b.do_business_date, b.opening_date,b.traffic,
b.auditorium,b.tiny_brochure_url";
$conditions['a.is_show'] = array( 'eq', 0 ); //c端只显示公开楼盘
} else {
$field = "a.id,a.internal_title as title,a.internal_address as address,a.city,a.disc,a.business_district_id,a.status,
a.industry_type,a.shop_area_start,a.shop_area_end,a.shop_type,a.residue_num,a.shop_sign,a.is_carefully_chosen,a.rent_type,
a.rent_price,a.management_fee,a.slotting_fee,a.total,a.market_area,a.is_has_gas,a.file_path,
b.enter_num,b.internal_item_advantage as item_advantage,b.sign_rule,b.do_business_date, b.opening_date,b.traffic,
b.auditorium,b.tiny_brochure_url";
}
$conditions['a.id'] = array( "eq", $params["id"] );
$result = $this->gHousesModel->getHouseDetailById($field, $conditions);
$result["api_path"] = IMG_PATH;
$param["house_id"] = $params['id'];
//todo 这里的是否要更改成b端后台上传的类型
$param["img_type"] = 2;
$result["images"] = $this->gHousesImgModel->getHouseImages($param, 15);
$param["img_type"] = 4;//图片类型:1效果图,2实景图,3样板图,4户型图,5交通图
$result["plan_images"] = $this->gHousesImgModel->getHouseImages($param, 1);
if ($result['status'] == 0) {
return $this->response("101", '此楼盘已下架');
}
//todo 查询关注门店
if ($params['site_area'] == 1 && isset($params['user_id'])) {
$attention["user_id"] = array( "eq", $params['user_id'] );
$attention["house_id"] = array( "eq", $params["id"] );
$attention["is_del"] = array( "eq", 0 );;
$attResult = $this->attentionModel->getAttentionByUserIdAndHouseId($attention);
if (count($attResult) > 0)
$result ["attention"] = $attResult["id"];
}
return $this->response("200", 'request success', $result);
}
}
...@@ -409,6 +409,21 @@ class GHouses extends BaseModel ...@@ -409,6 +409,21 @@ class GHouses extends BaseModel
->select(); ->select();
} }
/**
* 楼盘详情
* @param $field
* @param $params
* @return array|false|\PDOStatement|string|\think\Model
*/
function getHouseDetailById($field,$params){
return Db::table($this->table)
->field($field)
->alias("a")
->join('g_houses_ext b', 'a.id=b.house_id', 'left')
->where($params)
->find($params["id"]);
}
/******zw end ************/ /******zw end ************/
} }
...@@ -244,9 +244,13 @@ Route::group('broker', [ ...@@ -244,9 +244,13 @@ Route::group('broker', [
'user_search' => [ 'api_broker/broker/user_search',['method'=>'get|post']],//客户搜索 'user_search' => [ 'api_broker/broker/user_search',['method'=>'get|post']],//客户搜索
'bindAXB' => [ 'api_broker/CellPhone/bindAXB', [ 'method' => 'post' ] ],//隐私号码 'bindAXB' => [ 'api_broker/CellPhone/bindAXB', [ 'method' => 'post' ] ],//隐私号码
'agentsUnBind' => [ 'api_broker/CellPhone/agentsUnBind', [ 'method' => 'post' ] ],//解除绑定关系 'agentsUnBind' => [ 'api_broker/CellPhone/agentsUnBind', [ 'method' => 'post' ] ],//解除绑定关系
'getShopList' => ['api_broker/Shop/getShopList', [ 'method' => 'get|post' ] ],
'updateBindAXB' => ['api_broker/CellPhone/updateBindAXB', [ 'method' => 'post' ] ], //更新绑定关系隐私号码 'updateBindAXB' => ['api_broker/CellPhone/updateBindAXB', [ 'method' => 'post' ] ], //更新绑定关系隐私号码
//商铺
'getShopList' => ['api_broker/Shop/getShopList', [ 'method' => 'get|post' ] ],
'getShopDetail' => ['api_broker/Shop/getShopDetail', [ 'method' => 'get' ] ],
]); ]);
//Route::miss('api/index/miss');//处理错误的url //Route::miss('api/index/miss');//处理错误的url
\ 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