Commit f5b1d637 authored by zw's avatar zw

是否对c端显示

parent b90c6f7d
...@@ -38,9 +38,9 @@ class Shop extends Basic ...@@ -38,9 +38,9 @@ class Shop extends Basic
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(); $this->attentionModel = new AttentionModel();
$this->lookShopService_ = new LookShopService(); $this->lookShopService_ = new LookShopService();
} }
...@@ -80,7 +80,8 @@ class Shop extends Basic ...@@ -80,7 +80,8 @@ class Shop extends Basic
"p_district_name" => "一部", "p_district_name" => "一部",
"p_store_name" => "门店", "p_store_name" => "门店",
"p_agent_name" => "张三", "p_agent_name" => "张三",
//是否对C端显示 181009
"is_show" => 0,//0是1否显示在c端用户
"pageNo" => 1, "pageNo" => 1,
"pageSize" => 15 "pageSize" => 15
...@@ -101,38 +102,38 @@ class Shop extends Basic ...@@ -101,38 +102,38 @@ class Shop extends Basic
$conditions["city"] = trim($this->city); $conditions["city"] = trim($this->city);
} }
$pageNo = empty($params['pageNo']) ? 1 : $params['pageNo']; $pageNo = empty($params['pageNo']) ? 1 : $params['pageNo'];
$pageSize = empty($params['pageSize']) ? 15 : $params['pageSize']; $pageSize = empty($params['pageSize']) ? 15 : $params['pageSize'];
//c端查对外的名字 b端查对内的名字 //c端查对外的名字 b端查对内的名字
if (isset($params['title']) && $params['site_area'] == 1 || $params['site_area'] == 2) { if (isset($params['title']) && $params['site_area'] == 1 || $params['site_area'] == 2) {
$conditions['external_title'] = array( "like", "%" . trim($params['title']) . "%" ); $conditions['external_title'] = array("like", "%" . trim($params['title']) . "%");
} else if (isset($params['title'])) { } else if (isset($params['title'])) {
$conditions['internal_title'] = array( "like", "%" . trim($params['title']) . "%" ); $conditions['internal_title'] = array("like", "%" . trim($params['title']) . "%");
} }
//c端查对外的名字 b端查对内的名字 //c端查对外的名字 b端查对内的名字
if (isset($params['address']) && $params['site_area'] == 1 || $params['site_area'] == 2) { if (isset($params['address']) && $params['site_area'] == 1 || $params['site_area'] == 2) {
$conditions['external_address'] = array( "like", "%" . trim($params['address']) . "%" ); $conditions['external_address'] = array("like", "%" . trim($params['address']) . "%");
} else if (isset($params['address'])) { } else if (isset($params['address'])) {
$conditions['internal_address'] = array( "like", "%" . trim($params['address']) . "%" ); $conditions['internal_address'] = array("like", "%" . trim($params['address']) . "%");
} }
if (isset($params['start_time']) && isset($params['end_time'])) { if (isset($params['start_time']) && isset($params['end_time'])) {
$start_time = date('Y-m-d H:i:s', $params['start_time']); $start_time = date('Y-m-d H:i:s', $params['start_time']);
$end_time = date('Y-m-d H:i:s', $params['end_time']); $end_time = date('Y-m-d H:i:s', $params['end_time']);
$conditions['create_time'] = array( 'between', array( $start_time, $end_time ) ); $conditions['create_time'] = array('between', array($start_time, $end_time));
} }
$order_ = ""; $order_ = "";
$spTagArr = array(); $spTagArr = array();
switch ($params['site_area']) { switch ($params['site_area']) {
case 1: case 1:
case 3: case 3:
if (isset($params['is_carefully_chosen']) && $params['is_carefully_chosen'] == 1) { if (isset($params['is_carefully_chosen']) && $params['is_carefully_chosen'] == 1) {
$conditions['is_carefully_chosen'] = array( 'eq', $params['is_carefully_chosen'] ); $conditions['is_carefully_chosen'] = array('eq', $params['is_carefully_chosen']);
$order_ = "home_page_sort desc, id desc"; $order_ = "home_page_sort desc, id desc";
} }
...@@ -141,52 +142,55 @@ class Shop extends Basic ...@@ -141,52 +142,55 @@ class Shop extends Basic
case 4: case 4:
case 5: case 5:
if (isset($params['disc'])) { //区域 if (isset($params['disc'])) { //区域
$conditions['disc'] = array( 'eq', trim($params['disc']) ); $conditions['disc'] = array('eq', trim($params['disc']));
} }
if (isset($params['business_id'])) { //商圈 if (isset($params['business_id'])) { //商圈
$conditions['business_district_id'] = array( 'eq', trim($params['business_id']) ); $conditions['business_district_id'] = array('eq', trim($params['business_id']));
} }
if (isset($params['industry_type'])) { //业态 if (isset($params['industry_type'])) { //业态
$conditions['industry_type'] = array( 'like', "%" . trim($params['industry_type']) . "%" ); $conditions['industry_type'] = array('like', "%" . trim($params['industry_type']) . "%");
} }
if (isset($params['shop_type'])) { //商铺类型 if (isset($params['shop_type'])) { //商铺类型
$conditions['shop_type'] = array( "eq", $params['shop_type'] ); $conditions['shop_type'] = array("eq", $params['shop_type']);
}
if (isset($params['is_show'])) { //是否对c端显示
$conditions['is_show'] = array("eq", $params['is_show']);
} }
//我的商铺 代表我是盘方的商铺 //我的商铺 代表我是盘方的商铺
if (isset($params['agent_id'])) { if (isset($params['agent_id'])) {
$verifyService = new VerifyService(); $verifyService = new VerifyService();
$ids = $verifyService->getPanpartyByAgentId($params['agent_id']); $ids = $verifyService->getPanpartyByAgentId($params['agent_id']);
//$conditions['upload_id'] = array( "eq", $params['agent_id'] ); //$conditions['upload_id'] = array( "eq", $params['agent_id'] );
$conditions['id'] = array( "in", $ids ); $conditions['id'] = array("in", $ids);
} }
$area_start = isset($params['shop_area_start']) ? $params['shop_area_start'] : -1; $area_start = isset($params['shop_area_start']) ? $params['shop_area_start'] : -1;
$area_end = isset($params['shop_area_end']) ? $params['shop_area_end'] : -1; $area_end = isset($params['shop_area_end']) ? $params['shop_area_end'] : -1;
if ($area_start >= 0 && $area_end >= 0) { //面积 if ($area_start >= 0 && $area_end >= 0) { //面积
$conditions['shop_area_start'] = array( 'between', array( $area_start, $area_end ) ); $conditions['shop_area_start'] = array('between', array($area_start, $area_end));
$conditions['shop_area_end'] = array( 'between', array( $area_start, $area_end ) ); $conditions['shop_area_end'] = array('between', array($area_start, $area_end));
} else if ($area_start >= 0 && $area_end < 0) { //100米以上不用传结束面积 } else if ($area_start >= 0 && $area_end < 0) { //100米以上不用传结束面积
$conditions['shop_area_start'] = array( 'egt', $area_start ); $conditions['shop_area_start'] = array('egt', $area_start);
$conditions['shop_area_end'] = array( 'egt', $area_start ); $conditions['shop_area_end'] = array('egt', $area_start);
} }
$price_start = isset($params['rent_price_start']) ? $params['rent_price_start'] : -1; $price_start = isset($params['rent_price_start']) ? $params['rent_price_start'] : -1;
$price_end = isset($params['rent_price_end']) ? $params['rent_price_end'] : -1; $price_end = isset($params['rent_price_end']) ? $params['rent_price_end'] : -1;
if ($price_start >= 0 && $price_end >= 0) { //金额 if ($price_start >= 0 && $price_end >= 0) { //金额
$conditions['rent_price'] = array( 'between', array( $price_start * 100, $price_end * 100 ) ); $conditions['rent_price'] = array('between', array($price_start * 100, $price_end * 100));
} else if ($price_start >= 0 && $price_end < 0) { } else if ($price_start >= 0 && $price_end < 0) {
$conditions['rent_price'] = array( 'egt', $price_start * 100 ); $conditions['rent_price'] = array('egt', $price_start * 100);
} }
if (isset($params['shop_sign']) && $params['shop_sign'] != "全部") { //商铺标签 if (isset($params['shop_sign']) && $params['shop_sign'] != "全部") { //商铺标签
$shopTagsArr = array_filter(explode(',', $params['shop_sign'])); $shopTagsArr = array_filter(explode(',', $params['shop_sign']));
if (count($shopTagsArr) == 1) { if (count($shopTagsArr) == 1) {
$spTagArr['shop_sign'] = array( 'like', "%" . trim($shopTagsArr[0]) . "%" ); $spTagArr['shop_sign'] = array('like', "%" . trim($shopTagsArr[0]) . "%");
} else { } else {
foreach ($shopTagsArr as $key => $val) { foreach ($shopTagsArr as $key => $val) {
$spTagArr['shop_sign'][] = array( 'like', "%" . trim($val) . "%" ); $spTagArr['shop_sign'][] = array('like', "%" . trim($val) . "%");
} }
} }
} }
...@@ -196,11 +200,11 @@ class Shop extends Basic ...@@ -196,11 +200,11 @@ class Shop extends Basic
return $this->response("101", "请求数据异常"); return $this->response("101", "请求数据异常");
} }
if (!empty($conditions)) { if (!empty($conditions)) {
$conditions['status'] = array( 'eq', 1 ); //只显示上架 $conditions['status'] = array('eq', 1); //只显示上架
if ($params['site_area'] == 1 || $params['site_area'] == 2) { if ($params['site_area'] == 1 || $params['site_area'] == 2) {
$conditions['is_show'] = array( 'eq', 0 ); //c端只显示可显示的楼盘 $conditions['is_show'] = array('eq', 0); //c端只显示可显示的楼盘
} elseif ($params["site_area"] == 4) { } elseif ($params["site_area"] == 4) {
$conditions['status'] = !empty($params['status']) ? $params['status'] : array( 'in', "1,2" ); //b端搜索显示上架下架的 $conditions['status'] = !empty($params['status']) ? $params['status'] : array('in', "1,2"); //b端搜索显示上架下架的
} }
} }
...@@ -215,52 +219,52 @@ class Shop extends Basic ...@@ -215,52 +219,52 @@ class Shop extends Basic
} elseif (isset($params['p_district_name']) || isset($params['p_store_name']) || isset($params['p_agent_name'])) { } elseif (isset($params['p_district_name']) || isset($params['p_store_name']) || isset($params['p_agent_name'])) {
$p_district_name = empty($params['p_district_name']) ? "" : $params['p_district_name']; $p_district_name = empty($params['p_district_name']) ? "" : $params['p_district_name'];
$p_store_name = empty($params['p_store_name']) ? "" : $params['p_store_name']; $p_store_name = empty($params['p_store_name']) ? "" : $params['p_store_name'];
$p_agent_name = empty($params['p_agent_name']) ? "" : $params['p_agent_name']; $p_agent_name = empty($params['p_agent_name']) ? "" : $params['p_agent_name'];
$houseIds = $this->returnHouseIdByPanParty($p_district_name, $p_store_name, $p_agent_name); $houseIds = $this->returnHouseIdByPanParty($p_district_name, $p_store_name, $p_agent_name);
if (empty($houseIds)) { if (empty($houseIds)) {
return $this->response("200", "此条件没有找到数据"); return $this->response("200", "此条件没有找到数据");
} }
} }
if (!empty($houseIds)) { if (!empty($houseIds)) {
$conditions['id'] = array( "in", $houseIds ); $conditions['id'] = array("in", $houseIds);
} }
//如果有传经纪人id则代表我的商铺不区分状态 //如果有传经纪人id则代表我的商铺不区分状态
if (isset($params['agent_id'])) { if (isset($params['agent_id'])) {
unset($conditions["city"]); unset($conditions["city"]);
//$conditions['status'] = array( 'in', "1,2" ); //只显示上架或下架的 //$conditions['status'] = array( 'in', "1,2" ); //只显示上架或下架的
$conditions['status'] = !empty($params['status']) ? $params['status'] : array( 'in', "1,2" ); //只显示上架或下架的 $conditions['status'] = !empty($params['status']) ? $params['status'] : array('in', "1,2"); //只显示上架或下架的
} }
$result = $this->gHousesModel->getHousesList($pageNo, $pageSize, $order_, $field, $conditions, $spTagArr); $result = $this->gHousesModel->getHousesList($pageNo, $pageSize, $order_, $field, $conditions, $spTagArr);
//获取图片信息 //获取图片信息
foreach ($result as $key => $val) { foreach ($result as $key => $val) {
$result[$key]["api_path"] = CK_IMG_URL . 'images/'; $result[$key]["api_path"] = CK_IMG_URL . 'images/';
$result[$key]["rent_price"] = $val["rent_price"] * 0.01; $result[$key]["rent_price"] = $val["rent_price"] * 0.01;
$result[$key]["title"] = $val["disc"] . $result[$key]["title"]; $result[$key]["title"] = $val["disc"] . $result[$key]["title"];
$param["house_id"] = $val["id"]; $param["house_id"] = $val["id"];
$param["img_type"] = 1; //默认主图 $param["img_type"] = 1; //默认主图
$result[$key]["images"] = $this->gHousesImgModel->getHouseImages($param, 1); $result[$key]["images"] = $this->gHousesImgModel->getHouseImages($param, 1);
if ($params["site_area"] == 3 || $params["site_area"] == 4) { if ($params["site_area"] == 3 || $params["site_area"] == 4) {
$isLook = $this->lookShopService_->isLooked($this->agentId, $val["id"]); $isLook = $this->lookShopService_->isLooked($this->agentId, $val["id"]);
$result[$key]["is_look"] = $isLook; $result[$key]["is_look"] = $isLook;
} }
//锁盘后,盘方、独家方、有权限的可以查看 //锁盘后,盘方、独家方、有权限的可以查看
if (isset($val['is_lock']) && $val['is_lock'] == 1) { if (isset($val['is_lock']) && $val['is_lock'] == 1) {
$vip = new VipService(); $vip = new VipService();
if (!$vip->vip($this->agentId, 'index/lockHouse') ) { if (!$vip->vip($this->agentId, 'index/lockHouse')) {
$result[$key]["look_lock"] = 1; $result[$key]["look_lock"] = 1;
} }
$m_agent = new GHousesToAgents(); $m_agent = new GHousesToAgents();
$agent_data = $m_agent->getAgentsHouseField('a.id', ['a.agents_id'=>$this->agentId, 'a.type'=>['in', '2,3']]); $agent_data = $m_agent->getAgentsHouseField('a.id', ['a.agents_id' => $this->agentId, 'a.type' => ['in', '2,3']]);
foreach ($agent_data as $vvv) { foreach ($agent_data as $vvv) {
if ($vvv > 0){ if ($vvv > 0) {
$result[$key]["look_lock"] = 1; $result[$key]["look_lock"] = 1;
} }
} }
...@@ -280,8 +284,8 @@ class Shop extends Basic ...@@ -280,8 +284,8 @@ class Shop extends Basic
private function returnHouseId($landlord_phone) private function returnHouseId($landlord_phone)
{ {
$houseExtModel = new GHousesExt(); $houseExtModel = new GHousesExt();
$houseIds = $houseExtModel->getHouseId($landlord_phone); $houseIds = $houseExtModel->getHouseId($landlord_phone);
$ids = ""; $ids = "";
if (count($houseIds) > 0) { if (count($houseIds) > 0) {
foreach ($houseIds as $item) { foreach ($houseIds as $item) {
$ids .= $item["house_id"] . ","; $ids .= $item["house_id"] . ",";
...@@ -294,15 +298,15 @@ class Shop extends Basic ...@@ -294,15 +298,15 @@ class Shop extends Basic
private function returnHouseIdByPanParty($p_district_name, $p_store_name, $p_agent_name) private function returnHouseIdByPanParty($p_district_name, $p_store_name, $p_agent_name)
{ {
$agentModel = new AAgents(); $agentModel = new AAgents();
$params = []; $params = [];
if ($p_district_name) { if ($p_district_name) {
$params["c.district_name"] = array( "like", "%" . trim($p_district_name) . "%" ); $params["c.district_name"] = array("like", "%" . trim($p_district_name) . "%");
} }
if ($p_store_name) { if ($p_store_name) {
$params["b.store_name"] = array( "like", "%" . trim($p_store_name) . "%" ); $params["b.store_name"] = array("like", "%" . trim($p_store_name) . "%");
} }
if ($p_agent_name) { if ($p_agent_name) {
$params["a.name"] = array( "like", "%" . trim($p_agent_name) . "%" ); $params["a.name"] = array("like", "%" . trim($p_agent_name) . "%");
} }
$ids = ""; $ids = "";
if (empty($params)) { if (empty($params)) {
...@@ -322,8 +326,8 @@ class Shop extends Basic ...@@ -322,8 +326,8 @@ class Shop extends Basic
} }
$verifyService = new VerifyService(); $verifyService = new VerifyService();
$selectParams = array( "in", $agentIds ); $selectParams = array("in", $agentIds);
$houseIds = $verifyService->getPanpartyByAgentId($selectParams); $houseIds = $verifyService->getPanpartyByAgentId($selectParams);
if ($houseIds) { if ($houseIds) {
$ids = $houseIds; $ids = $houseIds;
} }
...@@ -358,27 +362,27 @@ class Shop extends Basic ...@@ -358,27 +362,27 @@ class Shop extends Basic
if ($params['site_area'] == 3) { if ($params['site_area'] == 3) {
$field = "a.id,a.internal_title as title,a.internal_address as address,a.city,a.disc,a.business_district_id,a.status, $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.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,a.longitude,a.latitude, a.rent_price,a.management_fee,a.slotting_fee,a.total,a.market_area,a.is_has_gas,a.file_path,a.longitude,a.latitude,
b.enter_num,b.internal_item_advantage as item_advantage,b.sign_rule,b.do_business_date, b.opening_date,b.traffic, 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,b.start_business_date,a.upload_id,b.fee_rule,b.landlord_remark,a.create_time,b.landlord_phone, b.auditorium,b.tiny_brochure_url,b.start_business_date,a.upload_id,b.fee_rule,b.landlord_remark,a.create_time,b.landlord_phone,
a.is_show,a.is_exclusive_type,a.update_time,a.external_title,a.external_address,b.external_item_advantage,b.agent_start_time,b.agent_end_time"; a.is_show,a.is_exclusive_type,a.update_time,a.external_title,a.external_address,b.external_item_advantage,b.agent_start_time,b.agent_end_time";
$conditions['a.status'] = array( "neq", 3 ); $conditions['a.status'] = array("neq", 3);
} else { } else {
$field = "a.id,a.internal_title,a.internal_address,a.external_title,a.external_address, $field = "a.id,a.internal_title,a.internal_address,a.external_title,a.external_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.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.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,a.longitude,a.latitude,a.is_show,a.is_exclusive_type, a.total,a.market_area,a.is_has_gas,a.file_path,a.longitude,a.latitude,a.is_show,a.is_exclusive_type,
b.enter_num,b.internal_item_advantage as item_advantage, b.sign_rule,b.do_business_date, b.opening_date,b.traffic, 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,b.start_business_date,a.upload_id,b.fee_rule,b.landlord_remark,a.create_time,b.landlord_phone b.auditorium,b.tiny_brochure_url,b.start_business_date,a.upload_id,b.fee_rule,b.landlord_remark,a.create_time,b.landlord_phone
,a.update_time,b.agent_start_time,b.agent_end_time,b.internal_item_advantage,b.external_item_advantage"; ,a.update_time,b.agent_start_time,b.agent_end_time,b.internal_item_advantage,b.external_item_advantage";
$conditions['a.status'] = array( "neq", 3 ); $conditions['a.status'] = array("neq", 3);
} }
$conditions['a.id'] = array( "eq", $params["id"] ); $conditions['a.id'] = array("eq", $params["id"]);
$field .= ',b.age_limit,b.payment_month,b.deposit_month,b.external_slotting_fee,c.agents_id, b.area_width,b.depth, $field .= ',b.age_limit,b.payment_month,b.deposit_month,b.external_slotting_fee,c.agents_id, b.area_width,b.depth,
b.electric_quantity,b.voltage,b.exhaust_fume,b.running_water,b.downriver,b.business_scope,b.decoration,b.source b.electric_quantity,b.voltage,b.exhaust_fume,b.running_water,b.downriver,b.business_scope,b.decoration,b.source
,b.rim_mating,b.section,b.crowd,b.other'; ,b.rim_mating,b.section,b.crowd,b.other';
$result = $this->gHousesModel->getHouseDetailById($field, $conditions); $result = $this->gHousesModel->getHouseDetailById($field, $conditions);
...@@ -396,18 +400,18 @@ class Shop extends Basic ...@@ -396,18 +400,18 @@ class Shop extends Basic
} else { } else {
$result["opening_date"] = date("Y-m-d", strtotime($result["opening_date"])); $result["opening_date"] = date("Y-m-d", strtotime($result["opening_date"]));
} }
$result["rent_price"] = $result["rent_price"] * 0.01; $result["rent_price"] = $result["rent_price"] * 0.01;
$result["management_fee"] = $result["management_fee"] * 0.01; $result["management_fee"] = $result["management_fee"] * 0.01;
$result["slotting_fee"] = $result["slotting_fee"] * 0.01; $result["slotting_fee"] = $result["slotting_fee"] * 0.01;
if ($result["external_slotting_fee"] != '-1') { if ($result["external_slotting_fee"] != '-1') {
$result["external_slotting_fee"] = $result["external_slotting_fee"] * 0.01; $result["external_slotting_fee"] = $result["external_slotting_fee"] * 0.01;
} }
$result["api_path"] = CK_IMG_URL . 'images/'; $result["api_path"] = CK_IMG_URL . 'images/';
$param["house_id"] = $params['id']; $param["house_id"] = $params['id'];
//todo 这里的是否要更改成b端后台上传的类型 //todo 这里的是否要更改成b端后台上传的类型
$param["img_type"] = 2; $param["img_type"] = 2;
$result["images"] = $this->gHousesImgModel->getHouseImages($param, 15); $result["images"] = $this->gHousesImgModel->getHouseImages($param, 15);
$param["img_type"] = 3;//图片类型:1效果图,2实景图,3样板图,4户型图,5交通图 $param["img_type"] = 3;//图片类型:1效果图,2实景图,3样板图,4户型图,5交通图
$result["plan_images"] = $this->gHousesImgModel->getHouseImages($param, 1); $result["plan_images"] = $this->gHousesImgModel->getHouseImages($param, 1);
if ($params['site_area'] == 3 || $params["site_area"] == 4) { if ($params['site_area'] == 3 || $params["site_area"] == 4) {
$result['landlord_phone'] = json_decode($result['landlord_phone'], true); $result['landlord_phone'] = json_decode($result['landlord_phone'], true);
...@@ -416,8 +420,8 @@ class Shop extends Basic ...@@ -416,8 +420,8 @@ class Shop extends Basic
if ($params['site_area'] == 4) { if ($params['site_area'] == 4) {
//封面图 //封面图
$param["img_type"] = 1; $param["img_type"] = 1;
$cover_plan = $this->gHousesImgModel->getHouseImages($param, 15); $cover_plan = $this->gHousesImgModel->getHouseImages($param, 15);
$result["cover_plan"] = $cover_plan[0]; $result["cover_plan"] = $cover_plan[0];
} }
...@@ -426,21 +430,21 @@ class Shop extends Basic ...@@ -426,21 +430,21 @@ class Shop extends Basic
} }
//todo 查询关注门店 //todo 查询关注门店
if ($params['site_area'] == 1 && isset($params['user_id'])) { if ($params['site_area'] == 1 && isset($params['user_id'])) {
$attention["user_id"] = array( "eq", $params['user_id'] ); $attention["user_id"] = array("eq", $params['user_id']);
$attention["house_id"] = array( "eq", $params["id"] ); $attention["house_id"] = array("eq", $params["id"]);
$attention["is_del"] = array( "eq", 0 ); $attention["is_del"] = array("eq", 0);
$attResult = $this->attentionModel->getAttentionByUserIdAndHouseId($attention); $attResult = $this->attentionModel->getAttentionByUserIdAndHouseId($attention);
if (count($attResult) > 0) if (count($attResult) > 0)
$result ["attention"] = $attResult[0]["id"]; $result ["attention"] = $attResult[0]["id"];
} }
//todo 查询成交报告中的提交的业态拼接到已入驻中 //todo 查询成交报告中的提交的业态拼接到已入驻中
$bargainModel = new OBargainModel(); $bargainModel = new OBargainModel();
$str = $bargainModel->selectBargainListByHouseId($params["id"]); $str = $bargainModel->selectBargainListByHouseId($params["id"]);
$result["enter_num"] .= $str; $result["enter_num"] .= $str;
$verify = new VerifyService(); $verify = new VerifyService();
$agentId = $verify->getPanpartyAgentsByHouseId($params["id"]); $agentId = $verify->getPanpartyAgentsByHouseId($params["id"]);
$result["panParty"] = $agentId; $result["panParty"] = $agentId;
...@@ -458,18 +462,18 @@ class Shop extends Basic ...@@ -458,18 +462,18 @@ class Shop extends Basic
} }
//上传人 //上传人
$m_agent = new AAgents(); $m_agent = new AAgents();
$upload_data = $m_agent->getAgentById('name,phone', [ 'agent_id' => $result['upload_id'] ]); $upload_data = $m_agent->getAgentById('name,phone', ['agent_id' => $result['upload_id']]);
$result['upload_user'] = $upload_data[0]['name'] . '-' . $upload_data[0]['phone']; $result['upload_user'] = $upload_data[0]['name'] . '-' . $upload_data[0]['phone'];
//独家方 //独家方
if ($result['is_exclusive_type'] == 1) { if ($result['is_exclusive_type'] == 1) {
$m_house_agent = new GHousesToAgents(); $m_house_agent = new GHousesToAgents();
$where_house['is_del'] = 0; $where_house['is_del'] = 0;
$where_house['type'] = 3; $where_house['type'] = 3;
$where_house['houses_id'] = $result['id']; $where_house['houses_id'] = $result['id'];
$house_agent_data = $m_house_agent->getAgentsByHouseId('name,phone', $where_house); $house_agent_data = $m_house_agent->getAgentsByHouseId('name,phone', $where_house);
$result['exclusive_user'] = $house_agent_data[0]['name']; $result['exclusive_user'] = $house_agent_data[0]['name'];
$result['exclusive_phone'] = $house_agent_data[0]['phone']; $result['exclusive_phone'] = $house_agent_data[0]['phone'];
} }
} }
...@@ -478,16 +482,16 @@ class Shop extends Basic ...@@ -478,16 +482,16 @@ class Shop extends Basic
$result["is_collect"] = 2; $result["is_collect"] = 2;
if ($params['site_area'] == 3) { if ($params['site_area'] == 3) {
//先判断是否已经存在数据 //先判断是否已经存在数据
$field = 'id,status'; $field = 'id,status';
$get_params['agents_id'] = $params["user_id"];//实际就是agents_id,前端之前传错了,将错就错 $get_params['agents_id'] = $params["user_id"];//实际就是agents_id,前端之前传错了,将错就错
$get_params['house_id'] = $params["id"]; $get_params['house_id'] = $params["id"];
$collect_house = new ACollectHouse(); $collect_house = new ACollectHouse();
$res = $collect_house->getCollectHouse($field, $get_params); $res = $collect_house->getCollectHouse($field, $get_params);
if ($res && ($res[0]['status'] == 1)) {//如果存在 if ($res && ($res[0]['status'] == 1)) {//如果存在
$result["is_collect"] = 1; $result["is_collect"] = 1;
} }
$vip_services = new VipService(); $vip_services = new VipService();
$result['is_can_edit'] = $vip_services->vip($params['user_id'], 'index/houseEdit'); $result['is_can_edit'] = $vip_services->vip($params['user_id'], 'index/houseEdit');
} }
...@@ -506,25 +510,25 @@ class Shop extends Basic ...@@ -506,25 +510,25 @@ class Shop extends Basic
public function edit() public function edit()
{ {
$result['code'] = 200; $result['code'] = 200;
$result['msg'] = ''; $result['msg'] = '';
$result_data = []; $result_data = [];
if ($this->request->isPost()) { if ($this->request->isPost()) {
$house = new HouseService(); $house = new HouseService();
$data = $house->addHouse($this->params, $this->agentId, 1); $data = $house->addHouse($this->params, $this->agentId, 1);
if ($data['status'] == 'successful') { if ($data['status'] == 'successful') {
$result_data['house_id'] = $data['data']['house_id']; $result_data['house_id'] = $data['data']['house_id'];
$result_data['internal_title'] = $data['data']['internal_title']; $result_data['internal_title'] = $data['data']['internal_title'];
$result['msg'] = '新增或编辑成功'; $result['msg'] = '新增或编辑成功';
} else { } else {
$result['code'] = 101; $result['code'] = 101;
$result['msg'] = $data['msg']; $result['msg'] = $data['msg'];
} }
} else { } else {
if (empty($this->params['id'])) { if (empty($this->params['id'])) {
$result['code'] = 101; $result['code'] = 101;
$result['msg'] = 'Id is null'; $result['msg'] = 'Id is null';
} else { } else {
//获取商铺详情 //获取商铺详情
$result_data = $this->gHousesModel->getHouseById($this->params['id'], 1); $result_data = $this->gHousesModel->getHouseById($this->params['id'], 1);
...@@ -552,22 +556,22 @@ class Shop extends Basic ...@@ -552,22 +556,22 @@ class Shop extends Basic
public function uploadHouseFile() public function uploadHouseFile()
{ {
$data['status'] = 101; $data['status'] = 101;
$data['msg'] = ''; $data['msg'] = '';
$data['data'] = ''; $data['data'] = '';
$file = request()->file('file'); $file = request()->file('file');
if ($file) { if ($file) {
$path = ROOT_PATH . 'public' . DS . 'resource' . DS . 'lib' . DS . 'Attachments' . DS . 'images'; $path = ROOT_PATH . 'public' . DS . 'resource' . DS . 'lib' . DS . 'Attachments' . DS . 'images';
$info = $file->validate([ 'size' => 1024000, 'ext' => 'jpg,png' ])->move($path); $info = $file->validate(['size' => 1024000, 'ext' => 'jpg,png'])->move($path);
if ($info) { if ($info) {
$img_path = $info->getSaveName(); //生成的图片路径 $img_path = $info->getSaveName(); //生成的图片路径
$data['img_type'] = $this->params['img_type']; $data['img_type'] = $this->params['img_type'];
$data['img_name'] = $img_path; $data['img_name'] = $img_path;
$img = new GHousesImgs(); $img = new GHousesImgs();
$img->addHouseImg($data, $this->params['house_id']); $img->addHouseImg($data, $this->params['house_id']);
$data['status'] = 200; $data['status'] = 200;
$data['msg'] = '上传成功'; $data['msg'] = '上传成功';
$data['data'] = [ $data['data'] = [
'file_name' => CK_IMG_URL . 'images' . DS . $img_path, 'file_name' => CK_IMG_URL . 'images' . DS . $img_path,
'save_path' => $img_path 'save_path' => $img_path
]; ];
...@@ -593,15 +597,15 @@ class Shop extends Basic ...@@ -593,15 +597,15 @@ class Shop extends Basic
public function delHouseFile() public function delHouseFile()
{ {
$data['status'] = 101; $data['status'] = 101;
$data['msg'] = ''; $data['msg'] = '';
$data['data'] = ''; $data['data'] = '';
if (empty($this->params['save_path']) || empty($this->params['house_id'])) { if (empty($this->params['save_path']) || empty($this->params['house_id'])) {
return $this->response($data['status'], 'Save_path or id house_id is null', $data['data']); return $this->response($data['status'], 'Save_path or id house_id is null', $data['data']);
} }
$img = new GHousesImgs(); $img = new GHousesImgs();
$id = $img->getHouseImagesInfo('id', [ $id = $img->getHouseImagesInfo('id', [
'house_id' => $this->params['house_id'], 'house_id' => $this->params['house_id'],
'img_name' => $this->params['save_path'], 'img_name' => $this->params['save_path'],
'img_status' => 0 'img_status' => 0
...@@ -612,7 +616,7 @@ class Shop extends Basic ...@@ -612,7 +616,7 @@ class Shop extends Basic
} else { } else {
$path = ROOT_PATH . 'public' . DS . 'resource' . DS . 'lib' . DS . 'Attachments' . DS . 'Images/'; $path = ROOT_PATH . 'public' . DS . 'resource' . DS . 'lib' . DS . 'Attachments' . DS . 'Images/';
@unlink($path . $this->params['save_path']); @unlink($path . $this->params['save_path']);
$img->editData([ 'img_status' => 1 ], $id['id'], 'id'); $img->editData(['img_status' => 1], $id['id'], 'id');
$data['status'] = 200; $data['status'] = 200;
} }
...@@ -631,7 +635,7 @@ class Shop extends Basic ...@@ -631,7 +635,7 @@ class Shop extends Basic
{ {
header('Access-Control-Allow-Origin:*'); header('Access-Control-Allow-Origin:*');
$regions = new Regions(); $regions = new Regions();
$data = $regions->getRegionsCity(); $data = $regions->getRegionsCity();
return $this->response(200, '', $data); return $this->response(200, '', $data);
} }
...@@ -647,7 +651,7 @@ class Shop extends Basic ...@@ -647,7 +651,7 @@ class Shop extends Basic
{ {
header('Access-Control-Allow-Origin:*'); header('Access-Control-Allow-Origin:*');
$regions = new Regions(); $regions = new Regions();
$data = $regions->getRegions($this->params['code'], $this->params['parent_code']); $data = $regions->getRegions($this->params['code'], $this->params['parent_code']);
return $this->response(200, '', $data); return $this->response(200, '', $data);
} }
...@@ -672,17 +676,17 @@ class Shop extends Basic ...@@ -672,17 +676,17 @@ class Shop extends Basic
return $this->response("101", "请求参数错误"); return $this->response("101", "请求参数错误");
} }
$result = $this->gHousesModel->getHouseInfo('province,city,disc', [ 'id' => $params["house_id"] ]); $result = $this->gHousesModel->getHouseInfo('province,city,disc', ['id' => $params["house_id"]]);
if ($result) { if ($result) {
$params['province'] = $result[0]['province'] ? $result[0]['province'] : '上海市'; $params['province'] = $result[0]['province'] ? $result[0]['province'] : '上海市';
$params['city'] = $result[0]['city'] ? $result[0]['city'] : '上海市'; $params['city'] = $result[0]['city'] ? $result[0]['city'] : '上海市';
$params['disc'] = $result[0]['disc'] ? $result[0]['disc'] : '黄浦区'; $params['disc'] = $result[0]['disc'] ? $result[0]['disc'] : '黄浦区';
} }
$follow_up_model = new GHousesFollowUp(); $follow_up_model = new GHousesFollowUp();
$id = $follow_up_model->addHousesFollowUp($params); $id = $follow_up_model->addHousesFollowUp($params);
if ($id > 0) { if ($id > 0) {
return $this->response("200", "request success", [ "id" => $id ]); return $this->response("200", "request success", ["id" => $id]);
} else { } else {
return $this->response("200", "request error"); return $this->response("200", "request error");
} }
...@@ -698,13 +702,13 @@ class Shop extends Basic ...@@ -698,13 +702,13 @@ class Shop extends Basic
public function getBusinessAll() public function getBusinessAll()
{ {
$code = 200; $code = 200;
$msg = ''; $msg = '';
$where['is_del'] = 0; $where['is_del'] = 0;
$where['status'] = 0; $where['status'] = 0;
if ($this->params['name'] != NULL) { if ($this->params['name'] != NULL) {
$where['name'] = [ 'LIKE', '%' . $this->params['name'] . '%' ]; $where['name'] = ['LIKE', '%' . $this->params['name'] . '%'];
} }
if (!empty($this->params['province'])) { if (!empty($this->params['province'])) {
...@@ -725,10 +729,10 @@ class Shop extends Basic ...@@ -725,10 +729,10 @@ class Shop extends Basic
try { try {
$auth_group = New GBusinessDistrict(); $auth_group = New GBusinessDistrict();
$data = $auth_group->getList(1, 1000, 'id desc', $fields, $where); $data = $auth_group->getList(1, 1000, 'id desc', $fields, $where);
} catch (\Exception $e) { } catch (\Exception $e) {
$code = 101; $code = 101;
$msg = $e->getMessage(); $msg = $e->getMessage();
$data = []; $data = [];
} }
......
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