Commit 7291e902 authored by clone's avatar clone

Merge branch '0618-v3.3.2' into test

parents 9fb3943b 85a26866
<?php
namespace app\api\controller;
use app\api\extend\Basic;
use think\Request;
/**
* Created by PhpStorm.
* User: zw
* Date: 2019/6/18
* Time: 11:10
*/
class OfficeShop extends Basic{
public function __construct(Request $request = null)
{
parent::__construct($request);
}
/**
* 获取办公楼列表
* @return \think\Response
*/
public function getShopList(){
$list = [];
if(count($list) > 0){
return $this->response("200","success",$list);
}else{
return $this->response("200","request null");
}
}
/**
* 获取详情
*/
public function getShopDetail(){
}
public function getFilter(){
header('Access-Control-Allow-Origin:*');
$params = $this->params;
if (empty($params["city"])) {
return $this->response("101", "参数错误");
}
$city = $params["city"];
$regions = new Regions();
$cityList = $regions->getRegionsByCity($city);
$i = $j = 0;
$result["area"][$i]["city"] = "全部";
$result["area"][$i]["disc"][] = "全部";
foreach ($cityList as $k => $v) {
$i++;
if (!empty($v["name"])) {
$result["area"][$i]["city"] = $v["name"];
$result["area"][$i]["disc"][] = "全" . $v["name"];
}
foreach ($v["city"] as $item) {
if (!empty($item)) {
$result["area"][$i]["disc"][] = $item;
}
}
if ($j == 0) {
$result["area"][$i]["business_district"][$j]['district'] = "全" . $v["name"];
$result["area"][$i]["business_district"][$j]['business'][] = [
'id' => 0, 'name' => '全部'
];
}
foreach ($v['business_district'] as $item2) {
if (!empty($item2)) {
$j++;
$result["area"][$i]["business_district"][$j] = $item2;
}
}
break; //目前只有上海和杭州其余的先不显示
}
$result['yetai'] = array('全部', '商场美食', '沿街餐饮', '百货超市', '服饰鞋包', '亲子教育', '休闲娱乐', '办公', '其他');
//租金租金(0:租金-大于三万; 1:租金一万到三万之间; 2:租金-小于一万)
$result['money'] = array(
array('id' => '-1', 'value' => '全部'), array('id' => '0', 'value' => '3万以上'),
array('id' => '1', 'value' => '1万-3万'), array('id' => '2', 'value' => '1万以下')
);
//面积
$result['acreage'] = array(
array('id' => '-1', 'value' => '全部'), array('id' => '0', 'value' => '30m²以内'),
array('id' => '1', 'value' => '30-60m²'), array('id' => '2', 'value' => '60-100m²'), array('id' => '3', 'value' => '100-300m²')
, array('id' => '4', 'value' => '300-500m²'), array('id' => '5', 'value' => '500m²以上')
);
$result['more'][] = "全部";
$labelsResult = $this->room_labels->getLabels();
if (count($labelsResult) > 0) {
foreach ($labelsResult as $labelsKey => $labelsVal) {
if ($labelsVal['name']) {
$result['more'][] = $labelsVal['name'];
}
}
}
return $this->response("200", "request success", $result);
}
}
\ No newline at end of file
......@@ -9,6 +9,7 @@ namespace app\api\controller;
* Time : 15:12
* Intro: 获取商铺list
*/
use app\api\extend\Basic;
use app\api_broker\service\LookShopService;
use app\api_broker\service\VerifyService;
......@@ -41,15 +42,15 @@ class Shop extends Basic
function __construct($request = null)
{
parent::__construct($request);
$this->db = new GHouses();
$this->dbImg = new GHousesImgs();
$this->labels = new GLabels();
$this->room_labels = new OfficeGLabels();
$this->attentionModel = new AttentionModel();
$this->gHousesModel = new GHouses();
$this->gHousesImgModel = new GHousesImgs();
$this->db = new GHouses();
$this->dbImg = new GHousesImgs();
$this->labels = new GLabels();
$this->room_labels = new OfficeGLabels();
$this->attentionModel = new AttentionModel();
$this->gHousesModel = new GHouses();
$this->gHousesImgModel = new GHousesImgs();
$this->lookShopService_ = new LookShopService();
$this->imageDepotModel = new GImageDepot();
$this->imageDepotModel = new GImageDepot();
}
......@@ -105,7 +106,7 @@ class Shop extends Basic
$conditions["city"] = trim($params['city']);
$pageNo = empty($params['pageNo']) ? 1 : $params['pageNo'];
$pageNo = empty($params['pageNo']) ? 1 : $params['pageNo'];
$pageSize = empty($params['pageSize']) ? 15 : $params['pageSize'];
$s_house = new HouseService();
......@@ -125,15 +126,15 @@ class Shop extends Basic
}
if (isset($params['start_time']) && isset($params['end_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']);
$start_time = date('Y-m-d H:i:s', $params['start_time']);
$end_time = date('Y-m-d H:i:s', $params['end_time']);
$conditions['create_time'] = array('between', array($start_time, $end_time));
}
if (isset($params['fit_industry_type'])) { //适合业态
$conditions['fit_industry_type'] = array('like', "%" . trim($params['fit_industry_type']) . "%");
}
$order_ = "";
$order_ = "";
$spTagArr = array();
switch ($params['site_area']) {
case 1:
......@@ -161,17 +162,17 @@ class Shop extends Basic
$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) { //面积
$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米以上不用传结束面积
$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_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) { //金额
$conditions['rent_price'] = array('between', array($price_start * 100, $price_end * 100));
} else if ($price_start >= 0 && $price_end < 0) {
......@@ -194,7 +195,7 @@ class Shop extends Basic
return $this->response("101", "请求数据异常");
}
if (!empty($conditions)) {
$conditions['status'] = array('eq', 1); //只显示上架
$conditions['status'] = array('eq', 1); //只显示上架
$conditions['is_show'] = array('eq', 0); //c端只显示可显示的楼盘
}
......@@ -213,51 +214,51 @@ class Shop extends Basic
$conditions['id'] = array("in", $houseIds);
}
$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) {
$result[$key]["api_path"] = SHOP_IMAGE_DEPOT_URL;
$result[$key]["rent_price"] = $val["rent_price"] * 0.01;
$result[$key]["images"] = [];
//获取图片信息
foreach ($result as $key => $val) {
$result[$key]["api_path"] = SHOP_IMAGE_DEPOT_URL;
$result[$key]["rent_price"] = $val["rent_price"] * 0.01;
$result[$key]["images"] = [];
if (empty($val['is_show_image'])) {
if ($val["external_image_id"]) {
$param["id"] = array("in", $val["external_image_id"]);
$param["img_status"] = 0;
if (empty($val['is_show_image'])) {
if ($val["external_image_id"]) {
$param["id"] = array("in", $val["external_image_id"]);
$param["img_status"] = 0;
$field = 'id,0 as house_id,img_type,label,img_name,img_status';
$field = 'id,0 as house_id,img_type,label,img_name,img_status';
$res = $this->imageDepotModel->getImageDepotById($field, $param, 1);
$result[$key]["images"] = count($res) > 0 ? $res : [];
}
} else {
$result[$key]["api_path"] = CK_IMG_URL.'images/';
$house_img_where["house_id"] = $val["id"];
$house_img_where["img_type"] = 2; //默认主图 产品盼盼于11.16号修改
$result[$key]["images"] = $this->gHousesImgModel->getHouseImages($house_img_where, 1);
$res = $this->imageDepotModel->getImageDepotById($field, $param, 1);
$result[$key]["images"] = count($res) > 0 ? $res : [];
}
#商铺视频
$result[$key]['shop_videos'] = $s_house->getHouseVideoList($val['id']);
// $result[$key]['shop_videos_length'] = $s_house->getHouseVideoLength();
} else {
$result[$key]["api_path"] = CK_IMG_URL . 'images/';
$house_img_where["house_id"] = $val["id"];
$house_img_where["img_type"] = 2; //默认主图 产品盼盼于11.16号修改
$result[$key]["images"] = $this->gHousesImgModel->getHouseImages($house_img_where, 1);
}
if ($params['site_area'] == 6) {
$list["list"] = $result;
$total = $this->gHousesModel->getHousesCount($conditions, $spTagArr);
$list["total"] = $total;
return $this->response("200", 'request success', $list);
}
#商铺视频
$result[$key]['shop_videos'] = $s_house->getHouseVideoList($val['id']);
// $result[$key]['shop_videos_length'] = $s_house->getHouseVideoLength();
}
if ($params['site_area'] == 6) {
$list["list"] = $result;
$total = $this->gHousesModel->getHousesCount($conditions, $spTagArr);
$list["total"] = $total;
return $this->response("200", 'request success', $list);
}
if (empty($result)) {
return $this->response("200", "此条件没有找到数据");
}
return $this->response("200", 'request success', $result);
if (empty($result)) {
return $this->response("200", "此条件没有找到数据");
}
return $this->response("200", 'request success', $result);
}
/**
* 返回盘方楼盘id
* @param $p_district_id
......@@ -271,7 +272,7 @@ class Shop extends Basic
private function returnHouseIdByPanParty($p_district_id, $p_store_id, $p_agent_id)
{
$agentModel = new AAgents();
$params = [];
$params = [];
if ($p_district_id) {
$params["c.id"] = array("like", "%" . trim($p_district_id) . "%");
}
......@@ -299,8 +300,8 @@ class Shop extends Basic
}
$verifyService = new VerifyService();
$selectParams = array("in", $agentIds);
$houseIds = $verifyService->getPanpartyByAgentId($selectParams);
$selectParams = array("in", $agentIds);
$houseIds = $verifyService->getPanpartyByAgentId($selectParams);
if ($houseIds) {
$ids = $houseIds;
}
......@@ -308,33 +309,33 @@ class Shop extends Basic
}
/**
* 楼盘详情
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getShopDetail()
{
header('Access-Control-Allow-Origin:*');
$params = $this->params;
/* $params = array(
"id" => 7407,
"site_area" => 3, //1.c端 3.b端 4.pc端
//"user_id" => 2 //if c端 用户登录后传入user_id
);*/
$conditions = [];
if (empty($params['id'])) {
return $this->response("101", "详情id不能为空");
}
if (empty($params['site_area'])) {
return $this->response("101", "请求来源错误");
}
/**
* 楼盘详情
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getShopDetail()
{
header('Access-Control-Allow-Origin:*');
$params = $this->params;
/* $params = array(
"id" => 7407,
"site_area" => 3, //1.c端 3.b端 4.pc端
//"user_id" => 2 //if c端 用户登录后传入user_id
);*/
$field = "a.id,a.internal_title,a.external_title as title,a.external_address as address,a.city,a.disc,a.business_district_id,a.status,a.external_image_id,
$conditions = [];
if (empty($params['id'])) {
return $this->response("101", "详情id不能为空");
}
if (empty($params['site_area'])) {
return $this->response("101", "请求来源错误");
}
$field = "a.id,a.internal_title,a.external_title as title,a.external_address as address,a.city,a.disc,a.business_district_id,a.status,a.external_image_id,
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,
b.enter_num,b.external_item_advantage as item_advantage,b.sign_rule,b.do_business_date, b.opening_date,b.traffic,
......@@ -342,236 +343,250 @@ class Shop extends Basic
b.area_width,b.depth,b.electric_quantity,b.voltage,b.exhaust_fume,b.running_water,b.downriver,b.business_scope,b.decoration
,b.rim_mating,b.section,b.crowd,b.other,a.is_show_image,a.fit_industry_type,a.floor";
$conditions['a.status'] = array("eq", 1);
$conditions['a.is_show'] = array('eq', 0); //c端只显示公开楼盘
$conditions['a.status'] = array("eq", 1);
$conditions['a.is_show'] = array('eq', 0); //c端只显示公开楼盘
$conditions['a.id'] = array("eq", $params["id"]);
$result = $this->gHousesModel->getHouseDetailById($field, $conditions);
if (count($result) <= 0) {
return $this->response("101", '此楼盘不存在');
}
$conditions['a.id'] = array("eq", $params["id"]);
$result = $this->gHousesModel->getHouseDetailById($field, $conditions);
if (count($result) <= 0) {
return $this->response("101", '此楼盘不存在');
}
if ($result["start_business_date"] == "0000-00-00 00:00:00" || empty($result["start_business_date"])) {
$result["start_business_date"] = "";
} else {
$result["start_business_date"] = date("Y-m-d", strtotime($result["start_business_date"]));
}
if ($result["opening_date"] == "0000-00-00 00:00:00" || empty($result["opening_date"])) {
$result["opening_date"] = "";
} else {
$result["opening_date"] = date("Y-m-d", strtotime($result["opening_date"]));
}
$result["rent_price"] = $result["rent_price"] * 0.01;
$result["management_fee"] = $result["management_fee"] * 0.01;
$result["slotting_fee"] = $result["slotting_fee"] * 0.01;
if ($result["external_slotting_fee"] != '-1') {
$result["external_slotting_fee"] = $result["external_slotting_fee"] * 0.01;
}
if ($result["start_business_date"] == "0000-00-00 00:00:00" || empty($result["start_business_date"])) {
$result["start_business_date"] = "";
} else {
$result["start_business_date"] = date("Y-m-d", strtotime($result["start_business_date"]));
}
if ($result["opening_date"] == "0000-00-00 00:00:00" || empty($result["opening_date"])) {
$result["opening_date"] = "";
} else {
$result["opening_date"] = date("Y-m-d", strtotime($result["opening_date"]));
}
$result["rent_price"] = $result["rent_price"] * 0.01;
$result["management_fee"] = $result["management_fee"] * 0.01;
$result["slotting_fee"] = $result["slotting_fee"] * 0.01;
if ($result["external_slotting_fee"] != '-1') {
$result["external_slotting_fee"] = $result["external_slotting_fee"] * 0.01;
}
if (empty($result['is_show_image'])) {
$result["api_path"] = SHOP_IMAGE_DEPOT_URL;
$result["images"] = [];
if ($result["external_image_id"]) {
$param["id"] = array("in", $result["external_image_id"]);
$param["img_status"] = 0;
$field = 'id,0 as house_id,img_type,label,img_name,img_status';
$res = $this->imageDepotModel->getImageDepotById($field, $param);
$result["images"] = count($res) > 0 ? $res : [];
}
} else {
$result["api_path"] = CK_IMG_URL.'images/';
$param["house_id"] = $params['id'];
//todo 这里的是否要更改成b端后台上传的类型
$param["img_type"] = 2;
$result["images"] = $this->gHousesImgModel->getHouseImages($param, 15);
$param["img_type"] = 3;//图片类型:1效果图,2实景图,3样板图,4户型图,5交通图
$result["plan_images"] = $this->gHousesImgModel->getHouseImages($param, 1);
if (empty($result['is_show_image'])) {
$result["api_path"] = SHOP_IMAGE_DEPOT_URL;
$result["images"] = [];
if ($result["external_image_id"]) {
$param["id"] = array("in", $result["external_image_id"]);
$param["img_status"] = 0;
$field = 'id,0 as house_id,img_type,label,img_name,img_status';
$res = $this->imageDepotModel->getImageDepotById($field, $param);
$result["images"] = count($res) > 0 ? $res : [];
}
} else {
$result["api_path"] = CK_IMG_URL . 'images/';
$param["house_id"] = $params['id'];
//todo 这里的是否要更改成b端后台上传的类型
$param["img_type"] = 2;
$result["images"] = $this->gHousesImgModel->getHouseImages($param, 15);
$param["img_type"] = 3;//图片类型: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[0]["id"];
}
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[0]["id"];
}
//todo 查询成交报告中的提交的业态拼接到已入驻中
$bargainModel = new OBargainModel();
$str = $bargainModel->selectBargainListByHouseId($params["id"]);
$result["enter_num"] .= $str;
//todo 查询成交报告中的提交的业态拼接到已入驻中
$bargainModel = new OBargainModel();
$str = $bargainModel->selectBargainListByHouseId($params["id"]);
$result["enter_num"] .= $str;
$verify = new VerifyService();
$agentId = $verify->getPanpartyAgentsByHouseId($params["id"]);
$result["panParty"] = $agentId;
$result["head_portrait"] = AGENTHEADERIMGURL;
$verify = new VerifyService();
$agentId = $verify->getPanpartyAgentsByHouseId($params["id"]);
$result["panParty"] = $agentId;
$result["head_portrait"] = AGENTHEADERIMGURL;
$result['new_sign_rule'] = "付{$result['payment_month']}{$result['deposit_month']},签订{$result['age_limit']}年";
$result['payment_deposit'] = empty($result['payment_month']) ? "" : "付{$result['payment_month']}{$result['deposit_month']}";
$result['age_limit'] = empty($result['age_limit']) ? "" : "签订{$result['age_limit']}年";
$result['new_sign_rule'] = "付{$result['payment_month']}{$result['deposit_month']},签订{$result['age_limit']}年";
$result['payment_deposit'] = empty($result['payment_month']) ? "" : "付{$result['payment_month']}{$result['deposit_month']}";
$result['age_limit'] = empty($result['age_limit']) ? "" : "签订{$result['age_limit']}年";
$result['address'] = $result['city'].$result['disc'].$result['internal_title'];//7151
$result['address'] = $result['city'] . $result['disc'] . $result['internal_title'];//7151
#商铺视频
$s_house = new HouseService();
$result['shop_videos'] = $s_house->getHouseVideoList($params["id"]);
$result['shop_videos_length'] = $s_house->getHouseVideoLength();
$this->lookShopService_->addUserLookShop((int)$params["user_id"], (int)$params["id"]);
return $this->response("200", 'request success', $result);
}
/**
* 搜索页搜索条件
* @return \think\Response
*/
public
function filtrateCondition()
{
header('Access-Control-Allow-Origin:*');
$params = $this->params;
$city_code = isset($params["city_code"]) ? $params["city_code"] : "330000"; //上海310000 浙江 330000
$regions = new Regions();
$cityList = $regions->getRegionsCitySH($city_code);
$i = $j = 0;
$result["area"][$i]["city"] = "全部";
$result["area"][$i]["disc"][] = "全部";
foreach ($cityList as $k => $v) {
$i++;
if (!empty($v["name"])) {
$result["area"][$i]["city"] = $v["name"];
$result["area"][$i]["disc"][] = "全" . $v["name"];
}
foreach ($v["city"] as $item) {
if (!empty($item)) {
$result["area"][$i]["disc"][] = $item;
}
}
#商铺视频
$s_house = new HouseService();
$result['shop_videos'] = $s_house->getHouseVideoList($params["id"]);
$result['shop_videos_length'] = $s_house->getHouseVideoLength();
if ($j == 0) {
$result["area"][$i]["business_district"][$j]['district'] = "全" . $v["name"];
$result["area"][$i]["business_district"][$j]['business'][] = [
'id' => 0, 'name' => '全部'
];
}
$this->lookShopService_->addUserLookShop((int)$params["user_id"], (int)$params["id"]);
return $this->response("200", 'request success', $result);
}
foreach ($v['business_district'] as $item2) {
if (!empty($item2)) {
$j++;
$result["area"][$i]["business_district"][$j] = $item2;
}
/**搜索页搜索条件
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function filtrateCondition()
{
header('Access-Control-Allow-Origin:*');
$params = $this->params;
$city_code = isset($params["city_code"]) ? $params["city_code"] : "330000"; //上海310000 浙江 330000
$regions = new Regions();
$cityList = $regions->getRegionsCitySH($city_code);
$i = $j = 0;
$result["area"][$i]["city"] = "全部";
$result["area"][$i]["disc"][] = "全部";
foreach ($cityList as $k => $v) {
$i++;
if (!empty($v["name"])) {
$result["area"][$i]["city"] = $v["name"];
$result["area"][$i]["disc"][] = "全" . $v["name"];
}
foreach ($v["city"] as $item) {
if (!empty($item)) {
$result["area"][$i]["disc"][] = $item;
}
}
break; //目前只有上海和杭州其余的先不显示
if ($j == 0) {
$result["area"][$i]["business_district"][$j]['district'] = "全" . $v["name"];
$result["area"][$i]["business_district"][$j]['business'][] = [
'id' => 0, 'name' => '全部'
];
}
$result['yetai'] = array('全部', '商场美食', '沿街餐饮', '百货超市', '服饰鞋包', '亲子教育', '休闲娱乐', '办公', '其他');
foreach ($v['business_district'] as $item2) {
if (!empty($item2)) {
$j++;
$result["area"][$i]["business_district"][$j] = $item2;
}
}
//租金租金(0:租金-大于三万; 1:租金一万到三万之间; 2:租金-小于一万)
$result['money'] = array(array('id' => '-1', 'value' => '全部'), array('id' => '0', 'value' => '3万以上'),
array('id' => '1', 'value' => '1万-3万'), array('id' => '2', 'value' => '1万以下'));
break; //目前只有上海和杭州其余的先不显示
}
//面积
$result['acreage'] = array(array('id' => '-1', 'value' => '全部'), array('id' => '0', 'value' => '30m²以内'),
array('id' => '1', 'value' => '30-60m²'), array('id' => '2', 'value' => '60-100m²'), array('id' => '3', 'value' => '100-300m²')
, array('id' => '4', 'value' => '300-500m²'), array('id' => '5', 'value' => '500m²以上'));
$result['yetai'] = array('全部', '商场美食', '沿街餐饮', '百货超市', '服饰鞋包', '亲子教育', '休闲娱乐', '办公', '其他');
$result['more'][] = "全部";
$labelsResult = $this->labels->getLabels();
if (count($labelsResult) > 0) {
foreach ($labelsResult as $labelsKey => $labelsVal) {
if ($labelsVal['name']) {
$result['more'][] = $labelsVal['name'];
//租金租金(0:租金-大于三万; 1:租金一万到三万之间; 2:租金-小于一万)
$result['money'] = array(
array('id' => '-1', 'value' => '全部'), array('id' => '0', 'value' => '3万以上'),
array('id' => '1', 'value' => '1万-3万'), array('id' => '2', 'value' => '1万以下')
);
//面积
$result['acreage'] = array(
array('id' => '-1', 'value' => '全部'), array('id' => '0', 'value' => '30m²以内'),
array('id' => '1', 'value' => '30-60m²'), array('id' => '2', 'value' => '60-100m²'), array('id' => '3', 'value' => '100-300m²')
, array('id' => '4', 'value' => '300-500m²'), array('id' => '5', 'value' => '500m²以上')
);
$result['more'][] = "全部";
$labelsResult = $this->labels->getLabels();
if (count($labelsResult) > 0) {
foreach ($labelsResult as $labelsKey => $labelsVal) {
if ($labelsVal['name']) {
$result['more'][] = $labelsVal['name'];
}
}
}
return $this->response("200", "request success", $result);
}
/**
* 搜索页搜索条件
* @return \think\Response
*/
public
function filtrateConditionV2()
{
header('Access-Control-Allow-Origin:*');
$params = $this->params;
if (empty($params["city"])) {
return $this->response("101", "参数错误");
}
return $this->response("200", "request success", $result);
}
/**搜索页搜索条件
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function filtrateConditionV2()
{
header('Access-Control-Allow-Origin:*');
$params = $this->params;
if (empty($params["city"])) {
return $this->response("101", "参数错误");
}
$city = $params["city"];
$regions = new Regions();
$cityList = $regions->getRegionsByCity($city);
$i = $j = 0;
$result["area"][$i]["city"] = "全部";
$result["area"][$i]["disc"][] = "全部";
foreach ($cityList as $k => $v) {
$i++;
if (!empty($v["name"])) {
$result["area"][$i]["city"] = $v["name"];
$result["area"][$i]["disc"][] = "全" . $v["name"];
}
$city = $params["city"];
$regions = new Regions();
$cityList = $regions->getRegionsByCity($city);
$i = $j = 0;
$result["area"][$i]["city"] = "全部";
$result["area"][$i]["disc"][] = "全部";
foreach ($cityList as $k => $v) {
$i++;
if (!empty($v["name"])) {
$result["area"][$i]["city"] = $v["name"];
$result["area"][$i]["disc"][] = "全" . $v["name"];
}
foreach ($v["city"] as $item) {
if (!empty($item)) {
$result["area"][$i]["disc"][] = $item;
}
foreach ($v["city"] as $item) {
if (!empty($item)) {
$result["area"][$i]["disc"][] = $item;
}
}
if ($j == 0) {
$result["area"][$i]["business_district"][$j]['district'] = "全" . $v["name"];
$result["area"][$i]["business_district"][$j]['business'][] = [
'id' => 0, 'name' => '全部'
];
}
if ($j == 0) {
$result["area"][$i]["business_district"][$j]['district'] = "全" . $v["name"];
$result["area"][$i]["business_district"][$j]['business'][] = [
'id' => 0, 'name' => '全部'
];
}
foreach ($v['business_district'] as $item2) {
if (!empty($item2)) {
$j++;
$result["area"][$i]["business_district"][$j] = $item2;
}
foreach ($v['business_district'] as $item2) {
if (!empty($item2)) {
$j++;
$result["area"][$i]["business_district"][$j] = $item2;
}
break; //目前只有上海和杭州其余的先不显示
}
$result['yetai'] = array('全部', '商场美食', '沿街餐饮', '百货超市', '服饰鞋包', '亲子教育', '休闲娱乐', '办公', '其他');
break; //目前只有上海和杭州其余的先不显示
}
//租金租金(0:租金-大于三万; 1:租金一万到三万之间; 2:租金-小于一万)
$result['money'] = array(array('id' => '-1', 'value' => '全部'), array('id' => '0', 'value' => '3万以上'),
array('id' => '1', 'value' => '1万-3万'), array('id' => '2', 'value' => '1万以下'));
$result['yetai'] = array('全部', '商场美食', '沿街餐饮', '百货超市', '服饰鞋包', '亲子教育', '休闲娱乐', '办公', '其他');
//面积
$result['acreage'] = array(array('id' => '-1', 'value' => '全部'), array('id' => '0', 'value' => '30m²以内'),
array('id' => '1', 'value' => '30-60m²'), array('id' => '2', 'value' => '60-100m²'), array('id' => '3', 'value' => '100-300m²')
, array('id' => '4', 'value' => '300-500m²'), array('id' => '5', 'value' => '500m²以上'));
//租金租金(0:租金-大于三万; 1:租金一万到三万之间; 2:租金-小于一万)
$result['money'] = array(
array('id' => '-1', 'value' => '全部'), array('id' => '0', 'value' => '3万以上'),
array('id' => '1', 'value' => '1万-3万'), array('id' => '2', 'value' => '1万以下')
);
$result['more'][] = "全部";
$labelsResult = $this->labels->getLabels();
if (count($labelsResult) > 0) {
foreach ($labelsResult as $labelsKey => $labelsVal) {
if ($labelsVal['name']) {
$result['more'][] = $labelsVal['name'];
//面积
$result['acreage'] = array(
array('id' => '-1', 'value' => '全部'), array('id' => '0', 'value' => '30m²以内'),
array('id' => '1', 'value' => '30-60m²'), array('id' => '2', 'value' => '60-100m²'), array('id' => '3', 'value' => '100-300m²')
, array('id' => '4', 'value' => '300-500m²'), array('id' => '5', 'value' => '500m²以上')
);
$result['more'][] = "全部";
$labelsResult = $this->labels->getLabels();
if (count($labelsResult) > 0) {
foreach ($labelsResult as $labelsKey => $labelsVal) {
if ($labelsVal['name']) {
$result['more'][] = $labelsVal['name'];
}
}
}
return $this->response("200", "request success", $result);
}
return $this->response("200", "request success", $result);
}
/**
* 搜索页搜索条件
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function filtrateConditionRoom()
{
......@@ -582,15 +597,15 @@ class Shop extends Basic
}
$city = $params["city"];
$regions = new Regions();
$cityList = $regions->getRegionsByCity($city);
$i = $j = 0;
$result["area"][$i]["city"] = "全部";
$regions = new Regions();
$cityList = $regions->getRegionsByCity($city);
$i = $j = 0;
$result["area"][$i]["city"] = "全部";
$result["area"][$i]["disc"][] = "全部";
foreach ($cityList as $k => $v) {
$i++;
if (!empty($v["name"])) {
$result["area"][$i]["city"] = $v["name"];
$result["area"][$i]["city"] = $v["name"];
$result["area"][$i]["disc"][] = "全" . $v["name"];
}
foreach ($v["city"] as $item) {
......@@ -600,7 +615,7 @@ class Shop extends Basic
}
if ($j == 0) {
$result["area"][$i]["business_district"][$j]['district'] = "全" . $v["name"];
$result["area"][$i]["business_district"][$j]['district'] = "全" . $v["name"];
$result["area"][$i]["business_district"][$j]['business'][] = [
'id' => 0, 'name' => '全部'
];
......@@ -619,16 +634,20 @@ class Shop extends Basic
$result['yetai'] = array('全部', '商场美食', '沿街餐饮', '百货超市', '服饰鞋包', '亲子教育', '休闲娱乐', '办公', '其他');
//租金租金(0:租金-大于三万; 1:租金一万到三万之间; 2:租金-小于一万)
$result['money'] = array(array('id' => '-1', 'value' => '全部'), array('id' => '0', 'value' => '3万以上'),
array('id' => '1', 'value' => '1万-3万'), array('id' => '2', 'value' => '1万以下'));
$result['money'] = array(
array('id' => '-1', 'value' => '全部'), array('id' => '0', 'value' => '3万以上'),
array('id' => '1', 'value' => '1万-3万'), array('id' => '2', 'value' => '1万以下')
);
//面积
$result['acreage'] = array(array('id' => '-1', 'value' => '全部'), array('id' => '0', 'value' => '30m²以内'),
$result['acreage'] = array(
array('id' => '-1', 'value' => '全部'), array('id' => '0', 'value' => '30m²以内'),
array('id' => '1', 'value' => '30-60m²'), array('id' => '2', 'value' => '60-100m²'), array('id' => '3', 'value' => '100-300m²')
, array('id' => '4', 'value' => '300-500m²'), array('id' => '5', 'value' => '500m²以上'));
, array('id' => '4', 'value' => '300-500m²'), array('id' => '5', 'value' => '500m²以上')
);
$result['more'][] = "全部";
$labelsResult = $this->room_labels->getLabels();
$labelsResult = $this->room_labels->getLabels();
if (count($labelsResult) > 0) {
foreach ($labelsResult as $labelsKey => $labelsVal) {
if ($labelsVal['name']) {
......@@ -640,55 +659,54 @@ class Shop extends Basic
return $this->response("200", "request success", $result);
}
/**
* 商铺列表进场统计
* @return \think\Response
*/
public
function getMarchInList()
{
$params = $this->params;
/* $params = array(
"house_id" => 7277,
"is_return_list" => 2,//1只返回统计2,返回列表
"page_no" => 1,
"page_size" => 15
);*/
$checkResult = $this->validate($params, "ShopValidate.getMarchInList");
if (true !== $checkResult) {
return $this->response("101", $checkResult);
}
$page_no = empty($params['page_no']) ? 1 : $params['page_no'];
$page_size = empty($params['page_size']) ? 15 : $params['page_size'];
$marchInModel = new OMarchInModel();
$attentionModel = new AttentionModel();
$week_time = date("Y-m-d", strtotime("-7 day"));
$month_time = date("Y-m-d", strtotime("-30 day"));
$week_params['house_id'] = $params['house_id'];
$week_params['create_time'] = array('gt', $week_time);
$month_params['house_id'] = $params['house_id'];
$month_params['create_time'] = array('gt', $month_time);
$result_week = $marchInModel->getMarchInNum($week_params);
$result_month = $marchInModel->getMarchInNum($month_params);
$attention = $attentionModel->getAttentionNumByHouseId($week_params);
$result["week"] = $result_week[0]["num"];
$result["month"] = $result_month[0]["num"];
$result["last_march_in"] = empty($result_month[0]["create_time"]) ? "" : $result_month[0]["create_time"];
$result["attention"] = $attention + 50;//todo 产品定义
if ($params["is_return_list"] == 2) {
$field = "a.create_time,c.name,c.img";
$marchInList = $marchInModel->getMarchInList($field, $month_params, $page_no, $page_size);
$result["list"] = $marchInList;
$result["img_path"] = AGENTHEADERIMGURL;
}
/**
* 商铺列表进场统计
* @return \think\Response
*/
public function getMarchInList()
{
$params = $this->params;
/* $params = array(
"house_id" => 7277,
"is_return_list" => 2,//1只返回统计2,返回列表
"page_no" => 1,
"page_size" => 15
);*/
$checkResult = $this->validate($params, "ShopValidate.getMarchInList");
if (true !== $checkResult) {
return $this->response("101", $checkResult);
}
$page_no = empty($params['page_no']) ? 1 : $params['page_no'];
$page_size = empty($params['page_size']) ? 15 : $params['page_size'];
$marchInModel = new OMarchInModel();
$attentionModel = new AttentionModel();
$week_time = date("Y-m-d", strtotime("-7 day"));
$month_time = date("Y-m-d", strtotime("-30 day"));
$week_params['house_id'] = $params['house_id'];
$week_params['create_time'] = array('gt', $week_time);
$month_params['house_id'] = $params['house_id'];
$month_params['create_time'] = array('gt', $month_time);
$result_week = $marchInModel->getMarchInNum($week_params);
$result_month = $marchInModel->getMarchInNum($month_params);
$attention = $attentionModel->getAttentionNumByHouseId($week_params);
$result["week"] = $result_week[0]["num"];
$result["month"] = $result_month[0]["num"];
$result["last_march_in"] = empty($result_month[0]["create_time"]) ? "" : $result_month[0]["create_time"];
$result["attention"] = $attention + 50;//todo 产品定义
if ($params["is_return_list"] == 2) {
$field = "a.create_time,c.name,c.img";
$marchInList = $marchInModel->getMarchInList($field, $month_params, $page_no, $page_size);
$result["list"] = $marchInList;
$result["img_path"] = AGENTHEADERIMGURL;
}
return $this->response("200", "success", $result);
return $this->response("200", "success", $result);
}
}
\ No newline at end of file
}
}
\ No newline at end of file
......@@ -325,4 +325,22 @@ class OfficeRoom extends Basic
return $this->response("200", 'request success', $result);
}
/**
* 检查重盘
* @document http://showdoc.tonglianjituan.com/index.php?s=/1&page_id=874
* @return \think\Response
*/
public function checkRepetition()
{
$result = $this->service->checkRepetition($this->params);
if ($result['status'] == 'fail') {
$this->code = 101;
$this->msg = $result['msg'];
} else {
$this->data = $result['data'];
}
return $this->response($this->code, $this->msg, $this->data);
}
}
\ No newline at end of file
......@@ -84,7 +84,7 @@ class User extends Basic
}
/**
* 客户条件搜索
* app客户列表 搜索 我的客户
* @return \think\Response
*/
public function searchUser()
......@@ -92,7 +92,7 @@ class User extends Basic
$params = $this->params;
$pageNo = empty($params['pageNo']) ? 1 : $params['pageNo'];
$pageSize = empty($params['pageSize']) ? 15 : $params['pageSize'];
#接口调用类型 0:客户搜索 1:全部客户
#接口调用类型 0:客户搜索 1:全部客户 2:我的客户
$app_request_source_type = !empty($params["app_request_source_type"]) ? $params["app_request_source_type"] : 0;
$conditions = [];
......@@ -206,7 +206,8 @@ class User extends Basic
$conditions['entrust_type'] =$params['entrust_type'];
}
$field = "id as user_id,sex,user_name,city,user_phone,user_status,agent_id,create_time,industry_type,price_demand,area_demand,vip,user_label,source_intro,site_ids";
$field = "id as user_id,sex,user_name,city,user_phone,user_status,agent_id,create_time,industry_type,
price_demand,area_demand,vip,user_label,source_intro,site_ids,entrust_type,concrete_industry";
$return_user_list = $this->userModel->selectUserList($field, $conditions, $pageNo, $pageSize, "id desc");
if (empty($return_user_list)) {
return $this->response("200", "此条件没有找到数据");
......
......@@ -303,4 +303,22 @@ class OfficeRoom extends Basic
}
return $this->response($this->code, $this->msg, $this->data);
}
/**
* 检查重盘
* @document http://showdoc.tonglianjituan.com/index.php?s=/1&page_id=875
* @return \think\Response
*/
public function checkRepetition()
{
$result = $this->service->checkRepetition($this->params);
if ($result['status'] == 'fail') {
$this->code = 101;
$this->msg = $result['msg'];
} else {
$this->data = $result['data'];
}
return $this->response($this->code, $this->msg, $this->data);
}
}
\ No newline at end of file
......@@ -256,7 +256,7 @@ class OfficeRoomService
$field = 'id,building_id,is_show,is_exclusive_type,is_rent,status,source,price_total,price,slotting_fee,';
$field .= 'management_fee,station_start,station_end,area,floor,room_number,floor_tag,enter_date,';
$field .= 'payment_month,deposit_month,age_limit_start,age_limit_end,is_register,is_partition,carport,decoration,';
$field .= 'rent_free,shop_sign,fee_rule,agent_start_time,agent_end_time,landlord_remark';
$field .= 'rent_free,shop_sign,fee_rule,agent_start_time,agent_end_time,landlord_remark,mansion';
$data = $this->m_office_room->getFindData($field, ['id' => $id]);
if ($data) {
......@@ -626,6 +626,7 @@ class OfficeRoomService
/**
* 获取房源详情
* @return array
* http://showdoc.tonglianjituan.com/index.php?s=/1&page_id=867
*/
public function getOfficeRoomInfo($id,$agent_id){
......@@ -633,7 +634,7 @@ class OfficeRoomService
a.is_register,a.age_limit_start,a.age_limit_end,a.rent_free,a.management_fee,a.slotting_fee,a.carport,a.enter_date,
a.is_partition,a.decoration,a.payment_month,a.deposit_month,a.source,a.create_time,a.operation_id,a.landlord_remark,
a.fee_rule,a.update_time,b.address,a.is_exclusive_type,a.agent_start_time,a.agent_end_time,c.name as business_name,
a.shop_sign,b.longitude,b.latitude,b.intro,a.is_rent,a.room_number,a.is_show';
a.shop_sign,b.longitude,b.latitude,b.intro,a.is_rent,a.room_number,a.is_show,a.mansion';
$result = $this->m_office_room->getOfficeRoomInfo($field,['a.id'=>$id]);
if (!$result) {
......@@ -1490,4 +1491,45 @@ class OfficeRoomService
}
return $result;
}
/**
* 是否重盘
*
* @param $params
* @return mixed
*/
public function checkRepetition($params) {
$result['status'] = 'fail';
$result['msg'] = '';
$result['data'] = [];
$check = $this->validate->scene('checkRepetition')->check($params);
if (false === $check) {
$result['msg'] = $this->validate->getError();
return $result;
}
$page_no = empty($params['pageNo']) ? 1 : $params['pageNo'];
$page_size = empty($params['pageSize']) ? 15 : $params['pageSize'];
try {
$field = 'a.id,a.floor,a.room_number,a.mansion';
$where['b.city'] = $params['city'];
$where['a.floor'] = $params['floor'];
$where['a.mansion'] = $params['mansion'];
$list = $this->m_office_room->getRoomBuildingListLimit($page_no, $page_size, $field, $where);
if ($list) {
$data = [];
foreach ($list as $k=>$v) {
$data[$k]['id'] = $v['id'];
$data[$k]['address'] = $v['mansion'].'-'.$v['floor'].'-'.$v['room_number'];
}
$result['data'] = $data;
}
$result['status'] = 'successful';
} catch (\Exception $e) {
$result['msg'] = "内部错误:".$e->getMessage();
}
return $result;
}
}
\ No newline at end of file
......@@ -234,7 +234,7 @@ class UserLogService
//查询客户详情
$field = 'id as user_id,sex,user_pic,other_pic,user_nick,user_name,user_phone,site_ids,agent_id,user_label,
industry_type,price_demand,area_demand,vip,user_status,entrust_type';
industry_type,price_demand,area_demand,vip,user_status,entrust_type,concrete_industry';
$result = $this->userModel->getUserDetailStreamline($user_id,$field);
if (count($result) <= 0) {
......
......@@ -45,7 +45,9 @@ class OfficeBuildingRoomValidate extends Validate
'is_carefully_chosen' => 'require|in:0,1',
'agent_start_time' => 'require',
'agent_end_time' => 'require',
'title'=>'require'
'title'=>'require',
'mansion'=>'require|length:2,255',
'city'=>'require|length:2,10'
];
protected $message = [
......@@ -104,7 +106,11 @@ class OfficeBuildingRoomValidate extends Validate
'is_carefully_chosen.in' => '是否精选参数错误',
'agent_start_time.require' => '独家开始时间必填',
'agent_end_time.require' => '独家结束时间必填',
'title.require'=>'楼盘字段标题必传'
'title.require'=>'楼盘字段标题必传',
'mansion.require'=>'楼号/栋/座必传',
'mansion.length' => '楼号/栋/座字数要在2至255之间',
'city.require'=>'城市必填',
'city.length'=>'城市长度不正确'
];
protected $scene = [
......@@ -118,6 +124,7 @@ class OfficeBuildingRoomValidate extends Validate
'is_carefully_chosen' => ['id', 'is_carefully_chosen'],
'exclusive' => ['agent_start_time,agent_end_time,is_exclusive_type,id'],
'del'=>['id'],
'show' => 'id,is_show'
'show' => 'id,is_show',
'checkRepetition'=>'city,floor,room_number'
];
}
\ No newline at end of file
......@@ -203,6 +203,11 @@ class OfficeGRoom extends BaseModel
$save_data['status'] = $data['status'];
}
//楼号/栋/座
if (isset($data['mansion'])) {
$save_data['mansion'] = $data['mansion'];
}
if (empty($data['id'])) {
$save_data['operation_id'] = $agent_id; //上传人
$save_data['create_time'] = date('Y-m-d H:i:s');
......@@ -449,6 +454,29 @@ class OfficeGRoom extends BaseModel
->find();
}
/**
* @param int $pageNo
* @param int $pageSize
* @param $field
* @param $params
* @param string $order
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
function getRoomBuildingListLimit($pageNo = 1, $pageSize = 15, $field, $params, $order = 'a.id desc')
{
return $data = $this->field($field)
->alias("a")
->join("office_g_building b","a.building_id=b.id","left")
->where($params)
->order($order)
->limit($pageSize)
->page($pageNo)
->select();
}
/**
* @param $field
* @param $params
......
......@@ -1007,6 +1007,7 @@ Route::group('office', [
'collectionListByBargainId' => [ 'api_broker/OfficePerformance/collectionListByBargainId', [ 'method' => 'POST|GET' ] ],
'getOfficeRoomByReport' => [ 'api_broker/OfficeRoom/getOfficeRoomByReport', [ 'method' => 'get|post' ] ],
'followUpLog' => [ 'api_broker/OfficeUser/followUpLog', [ 'method' => 'get|post' ] ],
'getHouseAddress' => ['api_broker/OfficeRoom/checkRepetition', ['method' => 'get']], //搜索楼号/栋/座+楼层+房号
]);
......@@ -1054,6 +1055,7 @@ Route::group('office_index', [
'inspectionRecordDistrict/:check_status' => ['index/OfficeReport/inspectionRecordAll', ['method' => 'GET'], ['check_status' => 2]], //部门约带看
'inspectionRecordAll/:check_status' => ['index/OfficeReport/inspectionRecordAll', ['method' => 'GET'], ['check_status' => 3]], //全部约带看
'getDistance' => ['index/OfficeManage/getDistance', ['method' => 'GET']], //获取两个经纬度距离
'getHouseAddress' => ['index/OfficeRoom/checkRepetition', ['method' => 'get']], //搜索楼号/栋/座+楼层+房号
]);
Route::group('office_api', [
......
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