Commit f123bc31 authored by clone's avatar clone

1

parent b708a226
......@@ -25,6 +25,7 @@ use app\model\OBargainModel;
use app\model\OfficeGBuilding;
use app\model\OReportModel;
use app\model\Regions;
use app\model\TLookShopUser;
use think\Log;
......@@ -45,9 +46,9 @@ class Shop extends Basic
function __construct($request = null)
{
parent::__construct($request);
$this->gHousesModel = new GHouses();
$this->gHousesImgModel = new GHousesImgs();
$this->attentionModel = new AttentionModel();
$this->gHousesModel = new GHouses();
$this->gHousesImgModel = new GHousesImgs();
$this->attentionModel = new AttentionModel();
$this->lookShopService_ = new LookShopService();
}
......@@ -106,19 +107,19 @@ class Shop extends Basic
,shop_area_start,shop_area_end,shop_type,residue_num,shop_sign,is_carefully_chosen,rent_type,rent_price,is_exclusive_type,floor";
} else {
// $field = "id,internal_title as title,internal_address as address,city,disc,business_district_id,status,industry_type
// $field = "id,internal_title as title,internal_address as address,city,disc,business_district_id,status,industry_type
$field = "id,internal_title as title,internal_address as address,city,disc,business_district_id,status,industry_type
,shop_area_start,shop_area_end,shop_type,residue_num,shop_sign,is_carefully_chosen,rent_type,rent_price,is_lock
,is_exclusive_type,is_vip,floor";
if(empty($params["city"])){
if (empty($params["city"])) {
$conditions["city"] = trim($this->city);
}else{
} else {
$conditions["city"] = $params["city"];
}
}
$pageNo = empty($params['pageNo']) ? 1 : $params['pageNo'];
$pageNo = empty($params['pageNo']) ? 1 : $params['pageNo'];
$pageSize = empty($params['pageSize']) ? 15 : $params['pageSize'];
//c端查对外的名字 b端查对内的名字
......@@ -137,8 +138,8 @@ 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));
}
......@@ -152,15 +153,15 @@ class Shop extends Basic
//residue_type 2已租,1求租
if (is_numeric($params['residue_type'])) {
if($params['residue_type'] == 1){
$conditions['residue_num'] = array('gt',0);
}else{
if ($params['residue_type'] == 1) {
$conditions['residue_num'] = array('gt', 0);
} else {
$conditions['residue_num'] = 0;
}
}
$order_ = "";
$order_ = "";
$spTagArr = array();
switch ($params['site_area']) {
case 1:
......@@ -200,23 +201,23 @@ class Shop extends Basic
//我的商铺 代表我是盘方的商铺
if (isset($params['agent_id'])) {
$verifyService = new VerifyService();
$ids = $verifyService->getPanpartyByAgentId($params['agent_id']);
$ids = $verifyService->getPanpartyByAgentId($params['agent_id']);
//$conditions['upload_id'] = array( "eq", $params['agent_id'] );
$conditions['id'] = array("in", $ids);
}
$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) {
......@@ -260,9 +261,9 @@ class Shop extends Basic
} 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_store_name = empty($params['p_store_name']) ? "" : $params['p_store_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);
$p_store_name = empty($params['p_store_name']) ? "" : $params['p_store_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);
if (empty($houseIds)) {
return $this->response("200", "此条件没有找到数据");
}
......@@ -279,7 +280,7 @@ class Shop extends Basic
$conditions['status'] = !empty($params['status']) ? $params['status'] : array('in', "1,2"); //只显示上架或下架的
}
if(!empty($params["site_name"])){
if (!empty($params["site_name"])) {
$conditions["city"] = $params["site_name"];
}
......@@ -288,7 +289,7 @@ class Shop extends Basic
// $m_business_district = new GBusinessDistrict();
//获取图片信息
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;
// $business_district = '';//查商圈
......@@ -296,13 +297,13 @@ class Shop extends Basic
// $business_district = $m_business_district->getValue(['id'=>$val["business_district_id"]], 'name');
// }
// $result[$key]["title"] = $val["disc"] . $business_district .$result[$key]["title"];
$result[$key]["title"] = $val["disc"] .$result[$key]["title"];
$result[$key]["title"] = $val["disc"] . $result[$key]["title"];
$param["house_id"] = $val["id"];
$param["img_type"] = 1; //默认主图
$param["house_id"] = $val["id"];
$param["img_type"] = 1; //默认主图
$result[$key]["images"] = $this->gHousesImgModel->getHouseImages($param, 1);
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;
}
......@@ -310,7 +311,7 @@ class Shop extends Basic
$result[$key]["look_lock"] = 0;
if (isset($val['is_lock']) && $val['is_lock'] == 1) {
$isLook = $this->isLookLock($val['id']);
$isLook = $this->isLookLock($val['id']);
$result[$key]["look_lock"] = $isLook ? 1 : 0;
}
}
......@@ -328,18 +329,19 @@ class Shop extends Basic
* @param $house_id
* @return bool
*/
private function isLookLock($house_id){
private function isLookLock($house_id)
{
$vip = new VipService();
if (!$vip->vip($this->agentId, 'index/lockHouse')) {
return true;
}
$m_agent = new GHousesToAgents();
$m_agent = new GHousesToAgents();
$agent_where['a.agents_id'] = $this->agentId;
$agent_where['a.type'] = ['in', '2,3'];
$agent_where['a.type'] = ['in', '2,3'];
$agent_where['a.houses_id'] = $house_id;
$agent_where['a.is_del'] = 0;
$agent_data = $m_agent->getAgentsHouseField('a.id', $agent_where);
$agent_where['a.is_del'] = 0;
$agent_data = $m_agent->getAgentsHouseField('a.id', $agent_where);
foreach ($agent_data as $vvv) {
if ($vvv > 0) {
......@@ -368,17 +370,17 @@ class Shop extends Basic
"pageSize" => 15
);*/
$conditions = [];
$field = "id,internal_title as title,internal_address as address";
if(empty($params["city"])){
$field = "id,internal_title as title,internal_address as address";
if (empty($params["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'];
if (isset($params['keyword']) && !empty($params['keyword']) ) {
$conditions['id|internal_title'] = array("like","%" . trim($params['keyword']) . "%");
if (isset($params['keyword']) && !empty($params['keyword'])) {
$conditions['id|internal_title'] = array("like", "%" . trim($params['keyword']) . "%");
}
$order_ = "status asc,id desc";
......@@ -404,8 +406,8 @@ class Shop extends Basic
private function returnHouseId($landlord_phone)
{
$houseExtModel = new GHousesExt();
$houseIds = $houseExtModel->getHouseId($landlord_phone);
$ids = "";
$houseIds = $houseExtModel->getHouseId($landlord_phone);
$ids = "";
if (count($houseIds) > 0) {
foreach ($houseIds as $item) {
$ids .= $item["house_id"] . ",";
......@@ -425,11 +427,11 @@ class Shop extends Basic
*/
private function returnHouseIdV2($landlord_phone)
{
$houseExtModel = new GLandlordPhone();
$where['phone'] = ['LIKE', '%'.$landlord_phone.'%'];
$houseExtModel = new GLandlordPhone();
$where['phone'] = ['LIKE', '%' . $landlord_phone . '%'];
$where['status'] = 0;
$houseIds = $houseExtModel->getAllList('house_id', $where);
$ids = "";
$houseIds = $houseExtModel->getAllList('house_id', $where);
$ids = "";
if (count($houseIds) > 0) {
foreach ($houseIds as $item) {
$ids .= $item["house_id"] . ",";
......@@ -452,7 +454,7 @@ class Shop extends Basic
private function returnHouseIdByPanParty($p_district_name, $p_store_name, $p_agent_name)
{
$agentModel = new AAgents();
$params = [];
$params = [];
if ($p_district_name) {
$params["c.district_name"] = array("like", "%" . trim($p_district_name) . "%");
}
......@@ -480,8 +482,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;
}
......@@ -516,8 +518,8 @@ class Shop extends Basic
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,
// $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.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,
......@@ -526,7 +528,7 @@ class Shop extends Basic
$conditions['a.status'] = array("neq", 3);
} 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 as address,a.external_title,a.external_address,
$field = "a.id,a.internal_title,a.internal_address as 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.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,
......@@ -538,7 +540,7 @@ class Shop extends Basic
$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.rim_mating,b.section,b.crowd,b.other,a.is_lock,b.project_name,a.is_vip,a.fit_industry_type,a.is_show_image,a.external_image_id,a.floor';
$result = $this->gHousesModel->getHouseDetailById($field, $conditions);
......@@ -547,7 +549,7 @@ class Shop extends Basic
}
$is_look = $this->isLookLock($result['id']);
if ( $result['is_lock'] == 1 && !$is_look) {
if ($result['is_lock'] == 1 && !$is_look) {
return $this->response("101", '没有查看权限');
}
......@@ -562,36 +564,36 @@ class Shop extends Basic
} else {
$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["slotting_fee"] = $result["slotting_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;
}
$result["api_path"] = CK_IMG_URL . 'images/';
$param["house_id"] = $params['id'];
$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交通图
$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 ($params['site_area'] == 3 || $params["site_area"] == 4) {
$is_show_landlord = 1;
if ($result['is_vip'] == 1) {
$house_service = new HouseService();
$house_service = new HouseService();
$is_show_landlord = $house_service->checkLandlordShow($this->agentId, $result['id']);
}
if ($is_show_landlord) {
$m_landlord = new GLandlordPhone();
$result['landlord_phone'] = $m_landlord->getAllList('id,name,phone',['house_id'=>$params["id"], 'status'=>0]);
foreach ($result['landlord_phone'] as $kk=>$vv){
$m_landlord = new GLandlordPhone();
$result['landlord_phone'] = $m_landlord->getAllList('id,name,phone', ['house_id' => $params["id"], 'status' => 0]);
foreach ($result['landlord_phone'] as $kk => $vv) {
$result['landlord_phone'][$kk]['phone'] = substr_replace($result['landlord_phone'][$kk]['phone'], '****', 3, 4);
$result['landlord_phone'][$kk]['name'] = '(房东ID:'.$result['landlord_phone'][$kk]['id'].')'.$result['landlord_phone'][$kk]['name'];
$result['landlord_phone'][$kk]['name'] = '(房东ID:' . $result['landlord_phone'][$kk]['id'] . ')' . $result['landlord_phone'][$kk]['name'];
}
$result['is_show_landlord'] = 1;
} else {
$result['landlord_phone'] = [['name'=> '', 'phone'=>'']];
$result['landlord_phone'] = [['name' => '', 'phone' => '']];
$result['is_show_landlord'] = 0;
}
......@@ -600,8 +602,8 @@ class Shop extends Basic
if ($params['site_area'] == 4) {
//封面图
$param["img_type"] = 1;
$cover_plan = $this->gHousesImgModel->getHouseImages($param, 15);
$param["img_type"] = 1;
$cover_plan = $this->gHousesImgModel->getHouseImages($param, 15);
$result["cover_plan"] = $cover_plan[0];
}
......@@ -610,21 +612,21 @@ class Shop extends Basic
}
//todo 查询关注门店
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["is_del"] = array("eq", 0);
$attResult = $this->attentionModel->getAttentionByUserIdAndHouseId($attention);
$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"]);
$bargainModel = new OBargainModel();
$str = $bargainModel->selectBargainListByHouseId($params["id"]);
$result["enter_num"] .= $str;
$verify = new VerifyService();
$panPartyArr = $verify->getPanpartyAgentsByHouseId($params["id"]);
$verify = new VerifyService();
$panPartyArr = $verify->getPanpartyAgentsByHouseId($params["id"]);
$result["panParty"] = $panPartyArr;
$house_agent_data = [];
......@@ -643,62 +645,62 @@ class Shop extends Basic
}
//上传人
$m_agent = new AAgents();
$upload_data = $m_agent->getAgentById('name,phone', ['agent_id' => $result['upload_id']]);
$m_agent = new AAgents();
$upload_data = $m_agent->getAgentById('name,phone', ['agent_id' => $result['upload_id']]);
$result['upload_user'] = $upload_data[0]['name'] . '-' . $upload_data[0]['phone'];
//独家方
if ($result['is_exclusive_type'] == 1) {
$m_house_agent = new GHousesToAgents();
$where_house['is_del'] = 0;
$where_house['type'] = 3;
$where_house['houses_id'] = $result['id'];
$house_agent_data = $m_house_agent->getAgentsByHouseId('b.id,b.name,b.phone', $where_house);
$result['exclusive_user'] = $house_agent_data[0]['name'];
$m_house_agent = new GHousesToAgents();
$where_house['is_del'] = 0;
$where_house['type'] = 3;
$where_house['houses_id'] = $result['id'];
$house_agent_data = $m_house_agent->getAgentsByHouseId('b.id,b.name,b.phone', $where_house);
$result['exclusive_user'] = $house_agent_data[0]['name'];
$result['exclusive_phone'] = $house_agent_data[0]['phone'];
}
}
if ($params['site_area'] == 3) {
#是否被收藏
$result["is_collect"] =$this->isCollect($params["id"], $params["user_id"]);
$vip_services = new VipService();
$result["is_collect"] = $this->isCollect($params["id"], $params["user_id"]);
$vip_services = new VipService();
$result['is_can_edit'] = $vip_services->vip($params['user_id'], 'index/houseEdit');
}
$is_bool = $this->isCanEditByAgentId($panPartyArr);
if($is_bool){
if ($is_bool) {
$result['is_can_edit'] = 0;
}
$is_show_address = $this->isLookAddress($panPartyArr,$house_agent_data,$params["id"]);
if(!$is_show_address){
$is_show_address = $this->isLookAddress($panPartyArr, $house_agent_data, $params["id"]);
if (!$is_show_address) {
$result['address'] = $result['external_address'];
}
$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']}年";
if ($result['is_show_image'] == 1) {
$result['external_image'] = empty($result['images'][0]) ? "" : CK_IMG_URL . 'images/'.$result['images'][0]['img_name'];
$result['external_image'] = empty($result['images'][0]) ? "" : CK_IMG_URL . 'images/' . $result['images'][0]['img_name'];
} else {
$m_image_depot = new GImageDepot();
$image_id = explode(',', $result['external_image_id']);
$external_image = $m_image_depot->getInfo('img_name', ['id'=>$image_id[0], 'img_status'=>0]);
$result['external_image'] = empty($external_image['img_name']) ? "" : SHOP_IMAGE_DEPOT_URL.$external_image['img_name'];
$m_image_depot = new GImageDepot();
$image_id = explode(',', $result['external_image_id']);
$external_image = $m_image_depot->getInfo('img_name', ['id' => $image_id[0], 'img_status' => 0]);
$result['external_image'] = empty($external_image['img_name']) ? "" : SHOP_IMAGE_DEPOT_URL . $external_image['img_name'];
}
//302版本
//判断是否有权限点击独家合同按钮 0:可查看 1:不可查看
$s_house = new HouseService();
$result['is_can_edit_only_contract'] = $s_house->isCanEditOnlyContract($this->agentId,$params["id"]);
$s_house = new HouseService();
$result['is_can_edit_only_contract'] = $s_house->isCanEditOnlyContract($this->agentId, $params["id"]);
#商铺视频
// dump('999');exit;
$result['shop_videos'] = $s_house->getHouseVideoList($params['id']);
$result['shop_videos'] = $s_house->getHouseVideoList($params['id']);
$result['shop_videos_length'] = $s_house->getHouseVideoLength();
$upload_id = $s_house->getHouseVideoNum($params['id']);
$upload_id = $s_house->getHouseVideoNum($params['id']);
$result['is_upload_video'] = 0; //不能上传视频
if (count($upload_id) < 3) {
$result['is_upload_video'] = 1;
......@@ -734,18 +736,18 @@ class Shop extends Basic
{
$is_collect = 2;
$s_user_log = new UserLogService();
$field = 'id,status';
$agent_ids = $s_user_log->getSiteAgentId($agent_id);
$field = 'id,status';
$agent_ids = $s_user_log->getSiteAgentId($agent_id);
if ($agent_ids) {
//此经纪人有转勤账号
$get_params["agents_id"] = array( 'in', $agent_ids );
$get_params["agents_id"] = array('in', $agent_ids);
} else {
$get_params["agents_id"] = $agent_id;
}
$get_params['house_id'] = $house_id;
$collect_house = new ACollectHouse();
$res = $collect_house->getCollectHouse($field, $get_params);
$collect_house = new ACollectHouse();
$res = $collect_house->getCollectHouse($field, $get_params);
if ($res && ($res[0]['status'] == 1)) {//如果存在
$is_collect = 1;
}
......@@ -781,7 +783,7 @@ class Shop extends Basic
$house_arr = $houseToAgentModel->getHouseNameByAgentId("b.name", $params);
$ids = "";
$ids = "";
foreach ($house_arr as $item) {
$ids .= $item["name"] . ",";
}
......@@ -803,36 +805,37 @@ class Shop extends Basic
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
private function isLookAddress($panPartyArr,$house_agent_data,$house_id){
private function isLookAddress($panPartyArr, $house_agent_data, $house_id)
{
$vip_services = new VipService();
$is_can = $vip_services->vip($this->agentId, 'is_show_address');
if($is_can == 0 ){
$is_can = $vip_services->vip($this->agentId, 'is_show_address');
if ($is_can == 0) {
return true;
}
foreach ($panPartyArr as $item){
if($this->agentId == $item["id"]){
foreach ($panPartyArr as $item) {
if ($this->agentId == $item["id"]) {
return true;
}
}
if(!empty($house_agent_data)){
foreach ($house_agent_data as $value){
if($this->agentId == $value["id"]){
if (!empty($house_agent_data)) {
foreach ($house_agent_data as $value) {
if ($this->agentId == $value["id"]) {
return true;
}
}
}
//根据经纪人id和楼盘查询是否30天有报备
$start_time = date("Y-m-d",strtotime('-30day'));
$end_time =date("Y-m-d H:i:s",time());
$reportModel = new OReportModel();
$start_time = date("Y-m-d", strtotime('-30day'));
$end_time = date("Y-m-d H:i:s", time());
$reportModel = new OReportModel();
$params["report_agent_id"] = $this->agentId;
$params["house_id"] = $house_id;
$params["create_time"] = array("between",array($start_time,$end_time));
$reportList = $reportModel->selectReportByUserId("a.id",$params);
if(count($reportList) > 0){
$params["create_time"] = array("between", array($start_time, $end_time));
$reportList = $reportModel->selectReportByUserId("a.id", $params);
if (count($reportList) > 0) {
return true;
}
......@@ -844,14 +847,15 @@ class Shop extends Basic
* @param $panPartyArr
* @return bool
*/
private function isCanEditByAgentId($panPartyArr){
private function isCanEditByAgentId($panPartyArr)
{
$agentModel = new AAgents();
foreach ($panPartyArr as $item){
foreach ($panPartyArr as $item) {
$params["store_id"] = $item["store_id"];
$params["level"] = array("in","20,40");
$result = $agentModel->getStoreIdByAgentId("id",$params);
$params["level"] = array("in", "20,40");
$result = $agentModel->getStoreIdByAgentId("id", $params);
if($this->agentId == $result[0]["id"]){
if ($this->agentId == $result[0]["id"]) {
return true;
}
}
......@@ -866,31 +870,31 @@ class Shop extends Basic
public function edit()
{
$result['code'] = 200;
$result['msg'] = '';
$result_data = [];
$house = new HouseService();
$result['msg'] = '';
$result_data = [];
$house = new HouseService();
if ($this->request->isPost()) {
$data = $house->addHouse($this->params, $this->agentId, 1, $this->siteId);
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['msg'] = '新增或编辑成功';
$result['msg'] = '新增或编辑成功';
} else {
$result['code'] = 101;
$result['msg'] = $data['msg'];
$result['msg'] = $data['msg'];
}
} else {
if (empty($this->params['id'])) {
$result['code'] = 101;
$result['msg'] = 'Id is null';
$result['msg'] = 'Id is null';
} else {
//获取商铺详情
$data = $house->getHouseById($this->params['id'], 1);
if ($data['status'] == 'successful') {
$result_data = $data['data'];
} else {
$result['msg'] = $data['msg'];
$result['msg'] = $data['msg'];
$result['code'] = 101;
}
}
......@@ -917,22 +921,22 @@ class Shop extends Basic
public function uploadHouseFile()
{
$data['status'] = 101;
$data['msg'] = '';
$data['data'] = '';
$data['msg'] = '';
$data['data'] = '';
$file = request()->file('file');
if ($file) {
$path = ROOT_PATH . 'public' . DS . 'resource' . DS . 'lib' . DS . 'Attachments' . DS . 'images';
$info = $file->validate(['size' => 1024000, 'ext' => 'jpg,png'])->move($path);
if ($info) {
$img_path = $info->getSaveName(); //生成的图片路径
$img_path = $info->getSaveName(); //生成的图片路径
$data['img_type'] = $this->params['img_type'];
$data['img_name'] = $img_path;
$img = new GHousesImgs();
$img = new GHousesImgs();
$img->addHouseImg($data, $this->params['house_id']);
$data['status'] = 200;
$data['msg'] = '上传成功';
$data['data'] = [
$data['msg'] = '上传成功';
$data['data'] = [
'file_name' => CK_IMG_URL . 'images' . DS . $img_path,
'save_path' => $img_path
];
......@@ -958,15 +962,15 @@ class Shop extends Basic
public function delHouseFile()
{
$data['status'] = 101;
$data['msg'] = '';
$data['data'] = '';
$data['msg'] = '';
$data['data'] = '';
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']);
}
$img = new GHousesImgs();
$id = $img->getHouseImagesInfo('id', [
$id = $img->getHouseImagesInfo('id', [
'house_id' => $this->params['house_id'],
'img_name' => $this->params['save_path'],
'img_status' => 0
......@@ -996,7 +1000,7 @@ class Shop extends Basic
{
header('Access-Control-Allow-Origin:*');
$regions = new Regions();
$data = $regions->getRegionsCity();
$data = $regions->getRegionsCity();
return $this->response(200, '', $data);
}
......@@ -1012,7 +1016,7 @@ class Shop extends Basic
{
header('Access-Control-Allow-Origin:*');
$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);
}
......@@ -1043,12 +1047,12 @@ class Shop extends Basic
$result = $this->gHousesModel->getHouseInfo('province,city,disc', ['id' => $params["house_id"]]);
if ($result) {
$params['province'] = $result[0]['province'] ? $result[0]['province'] : '上海市';
$params['city'] = $result[0]['city'] ? $result[0]['city'] : '上海市';
$params['disc'] = $result[0]['disc'] ? $result[0]['disc'] : '黄浦区';
$params['city'] = $result[0]['city'] ? $result[0]['city'] : '上海市';
$params['disc'] = $result[0]['disc'] ? $result[0]['disc'] : '黄浦区';
}
$follow_up_model = new GHousesFollowUp();
$id = $follow_up_model->addHousesFollowUp($params);
$id = $follow_up_model->addHousesFollowUp($params);
if ($id > 0) {
return $this->response("200", "request success", ["id" => $id]);
} else {
......@@ -1066,7 +1070,7 @@ class Shop extends Basic
public function getBusinessAll()
{
$code = 200;
$msg = '';
$msg = '';
$where['is_del'] = 0;
$where['status'] = 0;
......@@ -1093,10 +1097,10 @@ class Shop extends Basic
try {
$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) {
$code = 101;
$msg = $e->getMessage();
$msg = $e->getMessage();
$data = [];
}
......@@ -1108,21 +1112,22 @@ class Shop extends Basic
*
* @return \think\Response
*/
public function getHouseAddress() {
public function getHouseAddress()
{
if (empty($this->params['address']) || empty($this->params['city'])) {
return $this->response(101, '参数错误');
}
$data = [];
$msg = "";
try {
$m_house = new GHouses();
$where['internal_address'] = ['LIKE', '%'. $this->params['address']. '%'];
$where['city'] = $this->params['city'];
$data = $m_house->getHouseInfo('id,internal_address as address', $where);
$code = 200;
$m_house = new GHouses();
$where['internal_address'] = ['LIKE', '%' . $this->params['address'] . '%'];
$where['city'] = $this->params['city'];
$data = $m_house->getHouseInfo('id,internal_address as address', $where);
$code = 200;
} catch (\Exception $e) {
$code = 101;
$msg = "内部错误:".$e->getMessage();
$msg = "内部错误:" . $e->getMessage();
}
return $this->response($code, $msg, $data);
......@@ -1133,30 +1138,32 @@ class Shop extends Basic
*
* @return \think\Response
*/
public function getOfficeBuildingAddress() {
public function getOfficeBuildingAddress()
{
if (empty($this->params['address']) || empty($this->params['city'])) {
return $this->response(101, '参数错误');
}
$data = [];
$msg = "";
try {
$m_house = new OfficeGBuilding();
$where['internal_address'] = ['LIKE', '%'. $this->params['address']. '%'];
$where['city'] = $this->params['city'];
$data = $m_house->getFindData('id,address', $where);
$code = 200;
$m_house = new OfficeGBuilding();
$where['internal_address'] = ['LIKE', '%' . $this->params['address'] . '%'];
$where['city'] = $this->params['city'];
$data = $m_house->getFindData('id,address', $where);
$code = 200;
} catch (\Exception $e) {
$code = 101;
$msg = "内部错误:".$e->getMessage();
$msg = "内部错误:" . $e->getMessage();
}
return $this->response($code, $msg, $data);
}
private function getBusinessDistrictNameById($businessDistrictId){
$model = new GBusinessDistrict();
private function getBusinessDistrictNameById($businessDistrictId)
{
$model = new GBusinessDistrict();
$params["id"] = $businessDistrictId;
return $model->getValue($params,"name");
return $model->getValue($params, "name");
}
......@@ -1169,8 +1176,8 @@ class Shop extends Basic
$res = $this->gHousesModel->getExclusive($this->params['houses_id']);
// dump($res);
foreach ($res['exclusive_img'] as $key => $val) {
$res['exclusive_img'][$key]['file_name'] = IMAGES_URL.'resource/lib/Attachments/images/'.$val['img_name'];
$res['exclusive_img'][$key]['save_path'] = $val['img_name'];
$res['exclusive_img'][$key]['file_name'] = IMAGES_URL . 'resource/lib/Attachments/images/' . $val['img_name'];
$res['exclusive_img'][$key]['save_path'] = $val['img_name'];
}
} else {
return $this->response("101", "houses_id is null");
......@@ -1188,8 +1195,8 @@ class Shop extends Basic
if (empty($this->params['id'])) {
return $this->response(101, '参数错误');
}
$code = 200;
$msg = "";
$code = 200;
$msg = "";
$house = new HouseService();
if ($this->params['is_exclusive_type'] == 1) {
if (empty($this->params['exclusive_ids'])) {
......@@ -1198,7 +1205,7 @@ class Shop extends Basic
$result = $house->addHouse($this->params, $this->agentId, 1, 0, 'exclusive');
if ($result['status'] == 'fail') {
$code = 101;
$msg = $result['msg'];
$msg = $result['msg'];
}
} else {
$result = $house->delAgentHouse(3, $this->params['id']);
......@@ -1225,7 +1232,7 @@ class Shop extends Basic
$msg = '';
$service = new HouseService();
$result = $service->addVideo($this->params['house_id'], $this->params['video_name'], $this->params['video_image'], $this->agentId, $this->agentName, $this->agentPhone);
$result = $service->addVideo($this->params['house_id'], $this->params['video_name'], $this->params['video_image'], $this->agentId, $this->agentName, $this->agentPhone);
if ($result['status'] == 'fail') {
$code = 101;
$msg = $result['msg'];
......@@ -1253,31 +1260,31 @@ class Shop extends Basic
}
$where['is_del'] = 0;
$vip = new VipService();
$vip = new VipService();
$is_auth = $vip->checkRule($this->agentId, 'index/checkVideo');
if ($is_auth) {
$where['a.upload_id'] = $this->agentId;
$is_auth = 0;
$is_auth = 0;
} else {
$m_agent = new AAgents();
$agent_data = $m_agent->getAgentInfo('district_id,store_id', $this->agentId);
$m_agent = new AAgents();
$agent_data = $m_agent->getAgentInfo('district_id,store_id', $this->agentId);
$where['b.district_id'] = $agent_data['district_id'];
$where['b.store_id'] = $agent_data['store_id'];
$is_auth = 1;
$where['b.store_id'] = $agent_data['store_id'];
$is_auth = 1;
}
$m_house_video = new GHousesVideo();
$pageNo = empty($this->params['page_no']) ? 1 : $this->params['page_no'];
$pageSize = empty($this->params['page_size']) ? 15 : $this->params['page_size'];
$field = 'a.id,a.video_name,a.house_id,a.upload_name,a.check_name,a.check_id,a.check_time,a.create_time,a.video_image';
$data = $m_house_video->getVideoAgentList($pageNo, $pageSize, 'a.id desc', $field, $where);
foreach ($data as $k=>$v) {
$data[$k]['check_time'] = $v['check_time'] ? $v['check_time'] : '';
$m_house_video = new GHousesVideo();
$pageNo = empty($this->params['page_no']) ? 1 : $this->params['page_no'];
$pageSize = empty($this->params['page_size']) ? 15 : $this->params['page_size'];
$field = 'a.id,a.video_name,a.house_id,a.upload_name,a.check_name,a.check_id,a.check_time,a.create_time,a.video_image';
$data = $m_house_video->getVideoAgentList($pageNo, $pageSize, 'a.id desc', $field, $where);
foreach ($data as $k => $v) {
$data[$k]['check_time'] = $v['check_time'] ? $v['check_time'] : '';
$data[$k]['check_status'] = $v['check_id'] ? 1 : 0;
$data[$k]['path'] = 'resource/lib/Attachments/video/';
$data[$k]['is_auth'] = $is_auth;
$data[$k]['check_time'] = date('Y-m-d', strtotime($v['check_time']));
$data[$k]['create_time'] = date('Y-m-d', strtotime($v['create_time']));
$data[$k]['path'] = 'resource/lib/Attachments/video/';
$data[$k]['is_auth'] = $is_auth;
$data[$k]['check_time'] = date('Y-m-d', strtotime($v['check_time']));
$data[$k]['create_time'] = date('Y-m-d', strtotime($v['create_time']));
}
return $this->response(200, '', $data);
}
......@@ -1296,8 +1303,8 @@ class Shop extends Basic
return $this->response($code, '参数错误');
}
$m_house_video = new GHousesVideo();
$video_data = $m_house_video->getVideoFind('id,upload_id',['id'=>$this->params['video_id'], 'is_del'=>0]);
$m_house_video = new GHousesVideo();
$video_data = $m_house_video->getVideoFind('id,upload_id', ['id' => $this->params['video_id'], 'is_del' => 0]);
if (!$video_data['id']) {
return $this->response($code, '没有该视频');
......@@ -1305,18 +1312,18 @@ class Shop extends Basic
$is_auth = 0;
if ($this->params['type'] == 'check') {
$data['check_id'] = $this->agentId;
$data['check_id'] = $this->agentId;
$data['check_name'] = $this->agentName;
$data['check_time'] = date('Y-m-d H:i:s');
$rule_name = 'index/checkVideo';
$vip = new VipService();
$is_auth = $vip->checkRule($this->agentId, $rule_name);
$rule_name = 'index/checkVideo';
$vip = new VipService();
$is_auth = $vip->checkRule($this->agentId, $rule_name);
} else {
$data['is_del'] = 1;
if ($video_data['upload_id'] != $this->agentId) {
$rule_name = 'index/delVideo';
$vip = new VipService();
$is_auth = $vip->checkRule($this->agentId, $rule_name);
$vip = new VipService();
$is_auth = $vip->checkRule($this->agentId, $rule_name);
}
}
......@@ -1324,13 +1331,36 @@ class Shop extends Basic
return $this->response(101, '没有权限');
}
$num = $m_house_video->updateData($data, ['id'=>$this->params['video_id']]);
$num = $m_house_video->updateData($data, ['id' => $this->params['video_id']]);
if ($num) {
$msg = $this->params['type'] == 'check' ? '审核成功' : '删除成功';
$msg = $this->params['type'] == 'check' ? '审核成功' : '删除成功';
$code = 200;
} else {
$msg = $this->params['type'] == 'check' ? '审核失败':'删除失败';
$msg = $this->params['type'] == 'check' ? '审核失败' : '删除失败';
}
return $this->response($code, $msg);
}
public function getUserLookShopList()
{
header('Access-Control-Allow-Origin:*');
$params = $this->params;
/* $params = array(
"house_id" => 1,
"pageNo" => 1,
"pageSize" => 15
);*/
$pageNo = empty($params['pageNo']) ? 1 : $params['pageNo'];
$pageSize = empty($params['pageSize']) ? 15 : $params['pageSize'];
if (!isset($params["house_id"])) {
return $this->response("101", "请求参数错误");
}
//t_look_shop_user
$lookShopUserModel = new TLookShopUser();
$where_["house_id"] = $params["house_id"];
$logArr = $lookShopUserModel->getLogList($where_, "id,user_id,type,house_id,look_day", $pageNo, $pageSize);
return $this->response("200", "success", $logArr);
}
}
......@@ -55,4 +55,14 @@ class TLookShopUser extends Model
->where($condition)
->count();
}
public function getLogList($condition, $field, $pageNo, $pageSize)
{
return $this->db_
->field($field)
->where($condition)
->page($pageNo)
->limit($pageSize)
->order("id desc")
->select();
}
}
\ No newline at end of file
......@@ -571,9 +571,9 @@ Route::group('index', [
'DailyUncommittedList' => ['index/DailyUncommitted/DailyUncommittedList', ['method' => 'POST|GET']],
'selectDailyUncommitted' => ['index/DailyUncommitted/selectDailyUncommitted', ['method' => 'POST|GET']],
'methodOfAnalysis' => ['index/WorkLearning/methodOfAnalysis', ['method' => 'GET']], //方法分析
'qualityAssessment' => ['index/WorkLearning/qualityAssessment', ['method' => 'GET']], //素质测评
'valueAssessment' => ['index/WorkLearning/valueAssessment', ['method' => 'GET']], //价值观考核
'methodOfAnalysis' => ['index/WorkLearning/methodOfAnalysis', ['method' => 'GET']], //方法分析
'qualityAssessment' => ['index/WorkLearning/qualityAssessment', ['method' => 'GET']], //素质测评
'valueAssessment' => ['index/WorkLearning/valueAssessment', ['method' => 'GET']], //价值观考核
'readExcelTest' => ['index/ReadExcel/readExcelTest', ['method' => 'POST']],
......@@ -640,9 +640,9 @@ Route::group('api', [
'getTradeList' => ['api/TradeLog/getTradeList', ['method' => 'post|get']],
//AttentionShop
'addOrUpdateAttention' => [ 'api/AttentionShop/addOrUpdateAttention', [ 'method' => 'post|get' ] ],
'attentionList' => [ 'api/AttentionShop/attentionList', [ 'method' => 'post | get' ] ],
'attentionOfficeList' => [ 'api/AttentionShop/attentionOfficeList', [ 'method' => 'post | get' ] ],//关注的办公楼
'addOrUpdateAttention' => ['api/AttentionShop/addOrUpdateAttention', ['method' => 'post|get']],
'attentionList' => ['api/AttentionShop/attentionList', ['method' => 'post | get']],
'attentionOfficeList' => ['api/AttentionShop/attentionOfficeList', ['method' => 'post | get']],//关注的办公楼
'addSublet' => ['api/Sublet/addSublet', ['method' => 'post|get']],
......@@ -680,7 +680,7 @@ Route::group('api', [
'getFindShop' => ['api/FindShop/getFindShopByParams', ['method' => 'get|post']],
'getRecommendShopList' => ['api/FindShop/getRecommendShopList', ['method' => 'get|post']],
'uploadImg' => ['api/UploadImg/uploadImg', ['method' => 'POST|GET']], //图片上传
'uploadImg' => ['api/UploadImg/uploadImg', ['method' => 'POST|GET']], //图片上传
]);
......@@ -1054,6 +1054,7 @@ Route::group('broker', [
'getWorkLearningList' => ['api_broker/UploadWorkLearning/getWorkLearningList', ['method' => 'GET']],//保存0素质测评 1方法分析 2价值观考核图片
'subletList' => ['api_broker/Sublet/subletList', ['method' => 'GET']],//委托转铺列表
'getUserLookShopList' => ['api_broker/Shop/getUserLookShopList', ['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