Commit 07dab21b authored by clone's avatar clone

独家字段

parent 293c5794
...@@ -157,8 +157,9 @@ class AppointmentTime extends Basic ...@@ -157,8 +157,9 @@ class AppointmentTime extends Basic
$param["imgtype"] = 1; //默认主图 $param["imgtype"] = 1; //默认主图
$result[$key]["images"] = $this->dbImg->getHouseImages($param, 1); $result[$key]["images"] = $this->dbImg->getHouseImages($param, 1);
$houseInfo = $this->houseInfoModel->getHouseDetail("room_num_left", array( "id" => $val["house_id"] )); $houseInfo = $this->houseInfoModel->getHouseDetails("a.room_num_left,b.foreign_name", array( "a.id" => $val["house_id"] ));
$result[$key]["room_num_left"] = $houseInfo["room_num_left"]; $result[$key]["room_num_left"] = $houseInfo["room_num_left"];
$result[$key]["foreign_name"] = $houseInfo["foreign_name"];
} }
return $result; return $result;
...@@ -174,7 +175,8 @@ class AppointmentTime extends Basic ...@@ -174,7 +175,8 @@ class AppointmentTime extends Basic
*/ */
public function getYetList($pageNo, $pageSize, $params) public function getYetList($pageNo, $pageSize, $params)
{ {
$field = "a.id,a.phpone as phone,a.agent_id as agents_id,a.receptiontime as expect_time,a.house_id,b.title as house_title,b.room_num_left"; $field = "a.id,a.phpone as phone,a.agent_id as agents_id,a.receptiontime as expect_time,a.house_id,
b.title as house_title,b.room_num_left,c.foreign_name";
$where_["a.receptiontime"] = array( "neq", "null" ); $where_["a.receptiontime"] = array( "neq", "null" );
$where_["a.phpone"] = array( "eq", $params["phone"] ); $where_["a.phpone"] = array( "eq", $params["phone"] );
......
...@@ -73,7 +73,7 @@ class AttentionShop extends Basic ...@@ -73,7 +73,7 @@ class AttentionShop extends Basic
$order_ = 'a.create_time desc'; $order_ = 'a.create_time desc';
//b.room_num_left 前端显示已下架,不可点击到详情 //b.room_num_left 前端显示已下架,不可点击到详情
$field = "a.id,a.house_id,b.title,b.area,b.room_area2,b.price,b.shangpu_tags,b.room_num_left"; $field = "a.id,a.house_id,b.title,b.area,b.room_area2,b.price,b.shangpu_tags,b.room_num_left,c.foreign_name";
if (!isset($params["user_id"])) { if (!isset($params["user_id"])) {
return $this->response("101", "用户id不能为空"); return $this->response("101", "用户id不能为空");
...@@ -92,6 +92,7 @@ class AttentionShop extends Basic ...@@ -92,6 +92,7 @@ class AttentionShop extends Basic
$result[$key]["images"] = $imgArr; $result[$key]["images"] = $imgArr;
} }
return $this->response("200", "request success", $result); return $this->response("200", "request success", $result);
} }
......
...@@ -37,9 +37,9 @@ class Shop extends Basic ...@@ -37,9 +37,9 @@ class Shop extends Basic
public function getShopList() public function getShopList()
{ {
/* $params = array( /* $params = array(
"site_area" => 1, //来源 1首页 2搜索 "site_area" => 2, //来源 1首页 2搜索
"title" => "尚美", "title" => "尚美",
"carefully_chosen" => 0, //精选商铺--0是1否 "carefully_chosen" => 0, //精选商铺--0是1否
"shangpu_type" => 0, //商铺类型(0商场,1街铺) "shangpu_type" => 0, //商铺类型(0商场,1街铺)
"disc" => "黄浦区", "disc" => "黄浦区",
...@@ -52,9 +52,11 @@ class Shop extends Basic ...@@ -52,9 +52,11 @@ class Shop extends Basic
"pageNo" => "1", "pageNo" => "1",
"pageSize" => 15 "pageSize" => 15
);*/ );*/
$params = $this->params; $params = $this->params;
$field = "id,agent_id,title,address,city,disc,disccircles,sales,yetai,room_area,room_area2,shangpu_type,is_test, $field = "a.id,a.agent_id,a.title,a.address,a.city,disc,a.disccircles,a.sales,a.yetai,a.room_area,a.room_area2,
room_num_left,shangpu_tags,carefully_chosen,price"; a.shangpu_type,a.is_test,a.room_num_left,a.shangpu_tags,a.carefully_chosen,a.price,b.foreign_name,b.address_detail_c,
b.foreign_advantage";
$conditions = []; $conditions = [];
if (empty($params['site_area'])) { if (empty($params['site_area'])) {
...@@ -65,65 +67,65 @@ class Shop extends Basic ...@@ -65,65 +67,65 @@ class Shop extends Basic
$pageSize = empty($params['pageSize']) ? 15 : $params['pageSize']; $pageSize = empty($params['pageSize']) ? 15 : $params['pageSize'];
if (isset($params['title'])) { if (isset($params['title'])) {
$conditions['title'] = array( "like", "%" . trim($params['title']) . "%" ); $conditions['b.foreign_name'] = array( "like", "%" . trim($params['title']) . "%" );
} }
$order_ = ""; $order_ = "";
$spTagArr = array(); $spTagArr = array();
switch ($params['site_area']) { switch ($params['site_area']) {
case 1: case 1:
if (isset($params['carefully_chosen']) && $params['carefully_chosen'] == 0) { if (isset($params['carefully_chosen']) && $params['carefully_chosen'] == 0) {
$conditions['carefully_chosen'] = array( 'eq', $params['carefully_chosen'] ); $conditions['a.carefully_chosen'] = array( 'eq', $params['carefully_chosen'] );
$order_ = "rate1 desc, id desc"; $order_ = "a.rate1 desc, a.id desc";
} }
break; break;
case 2: case 2:
if (isset($params['disc'])) { //区域 if (isset($params['disc'])) { //区域
$conditions['disc'] = array( 'eq', trim($params['disc']) ); $conditions['a.disc'] = array( 'eq', trim($params['disc']) );
} }
if (isset($params['yetai'])) { //业态 if (isset($params['yetai'])) { //业态
$conditions['yetai'] = array( 'like', "%" . trim($params['yetai']) . "%" ); $conditions['a.yetai'] = array( 'like', "%" . trim($params['yetai']) . "%" );
} }
if (isset($params['shangpu_type'])) { //商铺类型 if (isset($params['shangpu_type'])) { //商铺类型
$conditions['shangpu_type'] = array( "eq", $params['shangpu_type'] ); $conditions['a.shangpu_type'] = array( "eq", $params['shangpu_type'] );
} }
//面积 room_area最小面积 room_area2最大面积 参考老版本 //面积 room_area最小面积 room_area2最大面积 参考老版本
if (isset($params['area_start']) && isset($params['area_end'])) { if (isset($params['area_start']) && isset($params['area_end'])) {
$conditions['room_area'] = array( 'between', array( $params['area_start'], $params['area_end'] ) ); $conditions['a.room_area'] = array( 'between', array( $params['area_start'], $params['area_end'] ) );
$conditions['room_area2'] = array( 'between', array( $params['area_start'], $params['area_end'] ) ); $conditions['a.room_area2'] = array( 'between', array( $params['area_start'], $params['area_end'] ) );
} else if (isset($params['area_start']) && !isset($params['area_end'])) { //100米以上不用传结束面积 } else if (isset($params['area_start']) && !isset($params['area_end'])) { //100米以上不用传结束面积
$conditions['room_area'] = array( 'egt', $params['area_start'] ); $conditions['a.room_area'] = array( 'egt', $params['area_start'] );
$conditions['room_area2'] = array( 'egt', $params['area_start'] ); $conditions['a.room_area2'] = array( 'egt', $params['area_start'] );
} }
if (isset($params['money_start']) && isset($params['money_end'])) { //面积 if (isset($params['money_start']) && isset($params['money_end'])) { //面积
$conditions['price'] = array( 'between', array( $params['money_start'], $params['money_end'] ) ); $conditions['a.price'] = array( 'between', array( $params['money_start'], $params['money_end'] ) );
} else if (isset($params['money_start']) && !isset($params['money_end'])) { } else if (isset($params['money_start']) && !isset($params['money_end'])) {
$conditions['price'] = array( 'egt', $params['money_start'] ); $conditions['a.price'] = array( 'egt', $params['money_start'] );
} }
if (isset($params['shangpu_tags']) && $params['shangpu_tags'] != "全部") { //商铺标签 if (isset($params['shangpu_tags']) && $params['shangpu_tags'] != "全部") { //商铺标签
$shangpuTagsArr = array_filter(explode(',', $params['shangpu_tags'])); $shangpuTagsArr = array_filter(explode(',', $params['shangpu_tags']));
if (count($shangpuTagsArr) == 1) { if (count($shangpuTagsArr) == 1) {
$spTagArr['shangpu_tags'] = array( 'like', "%" . trim($shangpuTagsArr[0]) . "%" ); $spTagArr['a.shangpu_tags'] = array( 'like', "%" . trim($shangpuTagsArr[0]) . "%" );
} else { } else {
foreach ($shangpuTagsArr as $key => $val) { foreach ($shangpuTagsArr as $key => $val) {
$spTagArr['shangpu_tags'][] = array( 'like', "%" . trim($val) . "%" ); $spTagArr['a.shangpu_tags'][] = array( 'like', "%" . trim($val) . "%" );
} }
} }
} }
$order_ = "id desc"; $order_ = "a.id desc";
break; break;
default: default:
$this->response("101", "请求数据异常"); $this->response("101", "请求数据异常");
} }
if (!empty($conditions)) { if (!empty($conditions)) {
//todo 测试数据? //todo 测试数据?
$conditions['id'] = array( '<>', 16 ); $conditions['a.id'] = array( '<>', 16 );
//todo sales下架字段并没用处 根据room_num_left剩余铺数来判断 为0 表示下架 //todo sales下架字段并没用处 根据room_num_left剩余铺数来判断 为0 表示下架
$conditions['room_num_left'] = array( '<>', 0 ); $conditions['a.room_num_left'] = array( '<>', 0 );
$conditions['show_all'] = array( 'eq', 0 ); //只显示公开的楼盘 $conditions['a.show_all'] = array( 'eq', 0 ); //只显示公开的楼盘
} }
$result = $this->db->getHouseInfoList($pageNo, $pageSize, $order_, $field, $conditions, $spTagArr); $result = $this->db->getHouseInfoList($pageNo, $pageSize, $order_, $field, $conditions, $spTagArr);
...@@ -150,19 +152,21 @@ class Shop extends Basic ...@@ -150,19 +152,21 @@ class Shop extends Basic
public function getShopDetail() public function getShopDetail()
{ {
$params = $this->params; $params = $this->params;
$field = "id,management_fee,title,address,city,room_area,room_area2,business_area,disc,disccircles,sales,slotting_fee,transfer_fee, $field = "a.id,a.management_fee,a.title,a.address,a.city,a.room_area,a.room_area2,a.business_area,a.disc,a.disccircles,
yetai,room_area2,shangpu_type,is_test,sellingpoint,singn_rule,business_date,start_business_date,opentime,has_gas,traffic,has_moved, a.sales,a.slotting_fee,a.transfer_fee, a.yetai,a.room_area2,a.shangpu_type,a.is_test,a.sellingpoint,a.singn_rule,
room_num_left,room_num_total,shangpu_tags,carefully_chosen,price,dish,file_path"; a.business_date,a.start_business_date,a.opentime,a.has_gas,a.traffic,a.has_moved,a.room_num_left,a.room_num_total,
a.shangpu_tags,a.carefully_chosen,a.price,a.dish,a.file_path,b.foreign_name,b.address_detail_c,
b.foreign_advantage";
$conditions = []; $conditions = [];
if (empty($params['id'])) { if (empty($params['id'])) {
return $this->response("101", "详情id不能为空"); return $this->response("101", "详情id不能为空");
} }
$conditions['id'] = array( "eq", $params["id"] ); $conditions['a.id'] = array( "eq", $params["id"] );
$conditions['show_all'] = array( 'eq', 0 ); //只显示公开楼盘 $conditions['a.show_all'] = array( 'eq', 0 ); //只显示公开楼盘
$result = $this->db->getHouseDetail($field, $conditions); $result = $this->db->getHouseDetails($field, $conditions);
$result["api_path"] = IMG_PATH; $result["api_path"] = IMG_PATH;
$param["house_id"] = $params['id']; $param["house_id"] = $params['id'];
......
...@@ -42,7 +42,7 @@ class TradeLog extends Basic ...@@ -42,7 +42,7 @@ class TradeLog extends Basic
public function getTradeList() public function getTradeList()
{ {
$params = $this->params; $params = $this->params;
/* $params = array( /* $params = array(
"user_id" => "4", "user_id" => "4",
"phone" => "18521095110", "phone" => "18521095110",
"pageNo" => 1, "pageNo" => 1,
...@@ -66,9 +66,9 @@ class TradeLog extends Basic ...@@ -66,9 +66,9 @@ class TradeLog extends Basic
return $this->response("200", "请求数据为空"); return $this->response("200", "请求数据为空");
} }
foreach ($result as $key => $val) { foreach ($result as $key => $val) {
$houseInfo = $this->houseInfoModel->getHouseDetail("room_num_left,title", array( "id" => $val["house_id"] )); $houseInfo = $this->houseInfoModel->getHouseDetails("a.room_num_left,b.foreign_name", array( "a.id" => $val["house_id"] ));
$result[$key]["room_num_left"] = $houseInfo["room_num_left"]; $result[$key]["room_num_left"] = $houseInfo["room_num_left"];
$result[$key]["title"] = $houseInfo["title"]; $result[$key]["title"] = $houseInfo["foreign_name"];
$result[$key]["api_path"] = IMG_PATH; $result[$key]["api_path"] = IMG_PATH;
$imgParam["house_id"] = $val["house_id"]; $imgParam["house_id"] = $val["house_id"];
$imgParam["imgtype"] = 1; //默认主图 $imgParam["imgtype"] = 1; //默认主图
......
...@@ -75,19 +75,20 @@ class Index ...@@ -75,19 +75,20 @@ class Index
{ {
$id = $_POST["id"] ? $_POST["id"] : $_GET["id"]; $id = $_POST["id"] ? $_POST["id"] : $_GET["id"];
$field = "id,management_fee,title,address,city,room_area,room_area2,business_area,disc,disccircles,sales,slotting_fee,transfer_fee, $field = "a.id,a.management_fee,a.title,a.address,a.city,a.room_area,a.room_area2,a.business_area,a.disc,a.disccircles,
yetai,room_area2,shangpu_type,is_test,sellingpoint,singn_rule,business_date,start_business_date,opentime,has_gas,traffic, a.sales,a.slotting_fee,a.transfer_fee, a.yetai,a.room_area2,a.shangpu_type,a.is_test,a.sellingpoint,a.singn_rule,
room_num_left,room_num_total,shangpu_tags,carefully_chosen,price,dish,file_path"; a.business_date,a.start_business_date,a.opentime,a.has_gas,a.traffic,a.has_moved,a.room_num_left,a.room_num_total,
a.shangpu_tags,a.carefully_chosen,a.price,a.dish,a.file_path,b.foreign_name,b.address_detail_c,
b.foreign_advantage";
$conditions = []; $conditions = [];
if (empty($id)) { if (empty($id)) {
return $this->response("101", "详情id不能为空"); return $this->response("101", "详情id不能为空");
} }
$conditions['id'] = array( "eq", $id ); $conditions['a.id'] = array( "eq", $id );
$conditions['show_all'] = array( 'eq', 0 ); //只显示公开楼盘 $conditions['a.show_all'] = array( 'eq', 0 ); //只显示公开楼盘
$result = $this->db->getHouseDetail($field, $conditions); $result = $this->db->getHouseDetails($field, $conditions);
if( count($result) > 0){ if( count($result) > 0){
$result["api_path"] = IMG_PATH; $result["api_path"] = IMG_PATH;
$param["house_id"] = $id; $param["house_id"] = $id;
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
<a href="/admin.php/index/banner"> 首页轮播图</a> <a href="/admin.php/index/banner"> 首页轮播图</a>
</li> </li>
<li role="presentation" class="active"> <li role="presentation" class="active">
<a href="/admin.php/index/advertising"> 首页弹框广告</a> <a href="/admin.php/index/advertising"> 首页弹</a>
</li> </li>
<li role="presentation"> <li role="presentation">
<a href="/admin.php/index/users_list"> 用户列表</a> <a href="/admin.php/index/users_list"> 用户列表</a>
......
...@@ -14,6 +14,7 @@ class Applies extends Model ...@@ -14,6 +14,7 @@ class Applies extends Model
->field($field) ->field($field)
->alias("a") ->alias("a")
->join('houseinfos b','a.house_id = b.id' ,'LEFT') ->join('houseinfos b','a.house_id = b.id' ,'LEFT')
->join('houseinfo_exts c', 'c.house_id = b.id', 'LEFT')
->where($params) ->where($params)
->order($order_) ->order($order_)
->limit($pageSize) ->limit($pageSize)
......
...@@ -96,6 +96,7 @@ class AttentionModel extends Model ...@@ -96,6 +96,7 @@ class AttentionModel extends Model
return $this->field($field) return $this->field($field)
->alias("a") ->alias("a")
->join('houseinfos b', 'a.house_id = b.id', 'LEFT') ->join('houseinfos b', 'a.house_id = b.id', 'LEFT')
->join('houseinfo_exts c', 'c.house_id = b.id', 'LEFT')
->where($params) ->where($params)
->order($order_) ->order($order_)
->limit($pageSize) ->limit($pageSize)
......
...@@ -25,11 +25,12 @@ class HouseInfos extends Model ...@@ -25,11 +25,12 @@ class HouseInfos extends Model
* @param $params * @param $params
* @return false|\PDOStatement|string|\think\Collection * @return false|\PDOStatement|string|\think\Collection
*/ */
function getHouseInfoList($pageNo = 1, $pageSize = 15, $order_ = 'id desc', $field, $params,$spTagsArr) function getHouseInfoList($pageNo = 1, $pageSize = 15, $order_ = 'id desc', $field, $params, $spTagsArr)
{ {
return $this->dbHouseInfo return $this->dbHouseInfo
->field($field) ->field($field)
->alias("a")
->join('houseinfo_exts b', 'a.id = b.house_id', 'LEFT')
->where($params) ->where($params)
->where(function ($query) use ($spTagsArr) { ->where(function ($query) use ($spTagsArr) {
$query->whereOr($spTagsArr); $query->whereOr($spTagsArr);
...@@ -47,14 +48,14 @@ class HouseInfos extends Model ...@@ -47,14 +48,14 @@ class HouseInfos extends Model
function getAveragePrice() function getAveragePrice()
{ {
//price //price
$params['rent_type'] = array( "eq", 3 ); //1.月租金 2.营业额扣点 3.每平方米租金 $params['rent_type'] = array( "eq", 3 ); //1.月租金 2.营业额扣点 3.每平方米租金
$params['room_num_left'] = array( "<>", 0 );//剩余店铺为0的不算 $params['room_num_left'] = array( "<>", 0 );//剩余店铺为0的不算
$sumPrice = $this->dbHouseInfo $sumPrice = $this->dbHouseInfo
->where($params) ->where($params)
->sum("price"); ->sum("price");
$count_ = $this->dbHouseInfo $count_ = $this->dbHouseInfo
->field("id") ->field("id")
->where($params) ->where($params)
->count("id"); ->count("id");
...@@ -75,6 +76,21 @@ class HouseInfos extends Model ...@@ -75,6 +76,21 @@ class HouseInfos extends Model
->where($params) ->where($params)
->find($params["id"]); ->find($params["id"]);
} }
/**
* 获取商铺详情 关联表
* @param $field
* @param $params
* @return mixed
*/
function getHouseDetails($field, $params)
{
return $data = $this->dbHouseInfo
->field($field)
->alias("a")
->join('houseinfo_exts b', 'a.id = b.house_id', 'LEFT')
->where($params)
->find($params["a.id"]);
}
function getCityList($field, $params, $group) function getCityList($field, $params, $group)
......
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