Commit f0da3e36 authored by clone's avatar clone

格式

parent a28747f1
...@@ -31,10 +31,10 @@ class AppointmentTime extends Basic ...@@ -31,10 +31,10 @@ class AppointmentTime extends Basic
{ {
parent::__construct($request); parent::__construct($request);
$this->appointmentTimeModel = new AppointWatchShop(); $this->appointmentTimeModel = new AppointWatchShop();
$this->houseInfoModel = new HouseInfos(); $this->houseInfoModel = new HouseInfos();
$this->dbImg = new HouseImgs(); $this->dbImg = new HouseImgs();
$this->appliesModel = new Applies(); $this->appliesModel = new Applies();
$this->evaluateMode = new Evaluate(); $this->evaluateMode = new Evaluate();
} }
/** /**
...@@ -57,7 +57,7 @@ class AppointmentTime extends Basic ...@@ -57,7 +57,7 @@ class AppointmentTime extends Basic
//todo 验证楼盘信息 //todo 验证楼盘信息
if (isset($params["house_id"]) && isset($params["house_title"])) { if (isset($params["house_id"]) && isset($params["house_title"])) {
$where_["id"] = $params["house_id"]; $where_["id"] = $params["house_id"];
$houseInfo = $this->houseInfoModel->getHouseDetail("id", $where_); $houseInfo = $this->houseInfoModel->getHouseDetail("id", $where_);
if (count($houseInfo) <= 0) { if (count($houseInfo) <= 0) {
return $this->response("101", "楼盘ID或楼盘名错误"); return $this->response("101", "楼盘ID或楼盘名错误");
} }
...@@ -82,7 +82,7 @@ class AppointmentTime extends Basic ...@@ -82,7 +82,7 @@ class AppointmentTime extends Basic
'create_time' => date("Y-m-d H:i:s", time()), 'create_time' => date("Y-m-d H:i:s", time()),
'update_time' => date("Y-m-d H:i:s", time()) 'update_time' => date("Y-m-d H:i:s", time())
); );
$result = $this->appointmentTimeModel->insertAppointWatchShop($addPrams); $result = $this->appointmentTimeModel->insertAppointWatchShop($addPrams);
if ($result["code"] == 200) { if ($result["code"] == 200) {
return $this->response("200", "数据保存成功", $result["msg"]); return $this->response("200", "数据保存成功", $result["msg"]);
} else { } else {
...@@ -98,13 +98,13 @@ class AppointmentTime extends Basic ...@@ -98,13 +98,13 @@ class AppointmentTime extends Basic
*/ */
public function getAppointmentSeeShopList() public function getAppointmentSeeShopList()
{ {
/* $params = array( /* $params = array(
"status" => 2, //看铺状态 0待经纪人确认(确认后存agents_id) 1:待看 2:已看' 如果是待看 0,1 已看是2 "status" => 2, //看铺状态 0待经纪人确认(确认后存agents_id) 1:待看 2:已看' 如果是待看 0,1 已看是2
"user_id" => "1",//对应u_users表 "user_id" => "1",//对应u_users表
"phone" => "18112347151",//phone "phone" => "18112347151",//phone
"pageNo" => "1", "pageNo" => "1",
"pageSize" => 15 "pageSize" => 15
);*/ );*/
$params = $this->params; $params = $this->params;
...@@ -118,10 +118,10 @@ class AppointmentTime extends Basic ...@@ -118,10 +118,10 @@ class AppointmentTime extends Basic
return $this->response("101", "请求用户手机号不能为空"); return $this->response("101", "请求用户手机号不能为空");
} }
$pageNo = empty($params['pageNo']) ? 1 : $params['pageNo']; $pageNo = empty($params['pageNo']) ? 1 : $params['pageNo'];
$pageSize = empty($params['pageSize']) ? 15 : $params['pageSize']; $pageSize = empty($params['pageSize']) ? 15 : $params['pageSize'];
if ($params["status"] == 1) { if ($params["status"] == 1) {
$result = $this->getWaitList($pageNo, $pageSize, $params); $result = $this->getWaitList($pageNo, $pageSize, $params);
} elseif ($params["status"] == 2) { } elseif ($params["status"] == 2) {
$result = $this->getYetList($pageNo, $pageSize, $params); $result = $this->getYetList($pageNo, $pageSize, $params);
} }
...@@ -146,20 +146,20 @@ class AppointmentTime extends Basic ...@@ -146,20 +146,20 @@ class AppointmentTime extends Basic
{ {
$field = "id,agents_id,house_id,house_title,phone,expect_time,is_evaluate"; $field = "id,agents_id,house_id,house_title,phone,expect_time,is_evaluate";
$where_["status"] = array( "in", array( "0,1" ) ); $where_["status"] = array( "in", array( "0,1" ) );
$where_["user_id"] = array( "eq", $params["user_id"] ); $where_["user_id"] = array( "eq", $params["user_id"] );
$result = $this->appointmentTimeModel->getAppointWatchShopList($pageNo, $pageSize, "id desc", $field, $where_); $result = $this->appointmentTimeModel->getAppointWatchShopList($pageNo, $pageSize, "id desc", $field, $where_);
//获取图片信息 //获取图片信息
foreach ($result as $key => $val) { foreach ($result as $key => $val) {
$result[$key]["api_path"] = IMG_PATH; $result[$key]["api_path"] = IMG_PATH;
$param["house_id"] = $val["house_id"]; $param["house_id"] = $val["house_id"];
$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->getHouseDetails("a.room_num_left,b.foreign_name", array( "a.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"]; $result[$key]["foreign_name"] = $houseInfo["foreign_name"];
} }
return $result; return $result;
...@@ -179,16 +179,16 @@ class AppointmentTime extends Basic ...@@ -179,16 +179,16 @@ class AppointmentTime extends Basic
b.title as house_title,b.room_num_left,c.foreign_name"; 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"] );
$result = $this->appliesModel->getAppliesList($pageNo, $pageSize, "a.id desc", $field, $where_); $result = $this->appliesModel->getAppliesList($pageNo, $pageSize, "a.id desc", $field, $where_);
//获取图片信息 //获取图片信息
foreach ($result as $key => $val) { foreach ($result as $key => $val) {
$result[$key]["api_path"] = IMG_PATH; $result[$key]["api_path"] = IMG_PATH;
$param["house_id"] = $val["house_id"]; $param["house_id"] = $val["house_id"];
$param["imgtype"] = 1; //默认主图 $param["imgtype"] = 1; //默认主图
$result[$key]["images"] = $this->dbImg->getHouseImages($param, 1); $result[$key]["images"] = $this->dbImg->getHouseImages($param, 1);
//todo 是否评价 //todo 是否评价
$evaluateResult = $this->evaluateMode->getIsEvaluate(10, $val["id"], $params["user_id"]); $evaluateResult = $this->evaluateMode->getIsEvaluate(10, $val["id"], $params["user_id"]);
$result[$key]["is_evaluate"] = count($evaluateResult) > 0 ? 1 : 0; $result[$key]["is_evaluate"] = count($evaluateResult) > 0 ? 1 : 0;
} }
return $result; return $result;
......
...@@ -24,7 +24,7 @@ class AttentionShop extends Basic ...@@ -24,7 +24,7 @@ class AttentionShop extends Basic
{ {
parent::__construct($request); parent::__construct($request);
$this->attentionModel = new AttentionModel(); $this->attentionModel = new AttentionModel();
$this->dbImg = new HouseImgs(); $this->dbImg = new HouseImgs();
} }
/** /**
...@@ -34,19 +34,19 @@ class AttentionShop extends Basic ...@@ -34,19 +34,19 @@ class AttentionShop extends Basic
public function addOrUpdateAttention() public function addOrUpdateAttention()
{ {
$params = $this->params; $params = $this->params;
/* $params = array( /* $params = array(
// "id" => 2, // "id" => 2,
"user_id" => 4, "user_id" => 4,
"house_id" => 2, "house_id" => 2,
// "is_del" => 0 // "is_del" => 0
);*/ );*/
$msg = isset($params['id']) ? "修改" : "新增"; $msg = isset($params['id']) ? "修改" : "新增";
$result = $this->attentionModel->addOrUpdateAttentionShop($params); $result = $this->attentionModel->addOrUpdateAttentionShop($params);
if ($result['code'] == 200) { if ($result['code'] == 200) {
$arr = array( $arr = array(
"isAdd" => isset($params['id']) ? false : true, "isAdd" => isset($params['id']) ? false : true,
"id" => $result["msg"] "id" => $result["msg"]
); );
return $this->response("200", $msg . "成功", $arr); return $this->response("200", $msg . "成功", $arr);
} else { } else {
...@@ -67,7 +67,7 @@ class AttentionShop extends Basic ...@@ -67,7 +67,7 @@ class AttentionShop extends Basic
"pageNo" => 1, "pageNo" => 1,
"pageSize" => 15, "pageSize" => 15,
);*/ );*/
$pageNo = empty($params['pageNo']) ? 1 : $params['pageNo']; $pageNo = empty($params['pageNo']) ? 1 : $params['pageNo'];
$pageSize = empty($params['pageSize']) ? 15 : $params['pageSize']; $pageSize = empty($params['pageSize']) ? 15 : $params['pageSize'];
...@@ -86,11 +86,10 @@ class AttentionShop extends Basic ...@@ -86,11 +86,10 @@ class AttentionShop extends Basic
} }
foreach ($result as $key => $val) { foreach ($result as $key => $val) {
$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; //默认主图
$imgArr = $this->dbImg->getHouseImages($imgParam, 1); $imgArr = $this->dbImg->getHouseImages($imgParam, 1);
$result[$key]["images"] = $imgArr; $result[$key]["images"] = $imgArr;
} }
......
...@@ -25,9 +25,9 @@ class Shop extends Basic ...@@ -25,9 +25,9 @@ class Shop extends Basic
function __construct($request = null) function __construct($request = null)
{ {
parent::__construct($request); parent::__construct($request);
$this->db = new HouseInfos(); $this->db = new HouseInfos();
$this->dbImg = new HouseImgs(); $this->dbImg = new HouseImgs();
$this->labels = new Labels(); $this->labels = new Labels();
$this->attentionModel = new AttentionModel(); $this->attentionModel = new AttentionModel();
} }
...@@ -37,24 +37,24 @@ class Shop extends Basic ...@@ -37,24 +37,24 @@ class Shop extends Basic
public function getShopList() public function getShopList()
{ {
/* $params = array( /* $params = array(
"site_area" => 2, //来源 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" => "黄浦区",
"yetai" => "休闲娱乐", "yetai" => "休闲娱乐",
"area_start" => 45,//面积起始范围 room_area2 "area_start" => 45,//面积起始范围 room_area2
"area_end" => 65,//面积结束范围 "area_end" => 65,//面积结束范围
"money_start" => 1000,//租金 price2 "money_start" => 1000,//租金 price2
"money_end" => 10000,//租金 "money_end" => 10000,//租金
"shangpu_tags" => "临近地铁,临近地铁2", "shangpu_tags" => "临近地铁,临近地铁2",
"pageNo" => "1", "pageNo" => "1",
"pageSize" => 15 "pageSize" => 15
);*/ );*/
$params = $this->params; $params = $this->params;
$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, $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,
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, 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"; b.foreign_advantage";
...@@ -63,19 +63,19 @@ class Shop extends Basic ...@@ -63,19 +63,19 @@ class Shop extends Basic
return $this->response("101", "请求来源不能为空"); return $this->response("101", "请求来源不能为空");
} }
$pageNo = empty($params['pageNo']) ? 1 : $params['pageNo']; $pageNo = empty($params['pageNo']) ? 1 : $params['pageNo'];
$pageSize = empty($params['pageSize']) ? 15 : $params['pageSize']; $pageSize = empty($params['pageSize']) ? 15 : $params['pageSize'];
if (isset($params['title'])) { if (isset($params['title'])) {
$conditions['b.foreign_name'] = 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['a.carefully_chosen'] = array( 'eq', $params['carefully_chosen'] ); $conditions['a.carefully_chosen'] = array( 'eq', $params['carefully_chosen'] );
$order_ = "a.rate1 desc, a.id desc"; $order_ = "a.rate1 desc, a.id desc";
} }
break; break;
case 2: case 2:
...@@ -92,10 +92,10 @@ class Shop extends Basic ...@@ -92,10 +92,10 @@ class Shop extends Basic
//面积 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['a.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['a.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['a.room_area'] = array( 'egt', $params['area_start'] ); $conditions['a.room_area'] = array( 'egt', $params['area_start'] );
$conditions['a.room_area2'] = array( 'egt', $params['area_start'] ); $conditions['a.room_area2'] = array( 'egt', $params['area_start'] );
} }
...@@ -125,7 +125,7 @@ class Shop extends Basic ...@@ -125,7 +125,7 @@ class Shop extends Basic
$conditions['a.id'] = array( '<>', 16 ); $conditions['a.id'] = array( '<>', 16 );
//todo sales下架字段并没用处 根据room_num_left剩余铺数来判断 为0 表示下架 //todo sales下架字段并没用处 根据room_num_left剩余铺数来判断 为0 表示下架
$conditions['a.room_num_left'] = array( '<>', 0 ); $conditions['a.room_num_left'] = array( '<>', 0 );
$conditions['a.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);
...@@ -133,9 +133,9 @@ class Shop extends Basic ...@@ -133,9 +133,9 @@ class Shop extends Basic
//获取图片信息 //获取图片信息
foreach ($result as $key => $val) { foreach ($result as $key => $val) {
$result[$key]["api_path"] = IMG_PATH; $result[$key]["api_path"] = IMG_PATH;
$param["house_id"] = $val["id"]; $param["house_id"] = $val["id"];
$param["imgtype"] = 1; //默认主图 $param["imgtype"] = 1; //默认主图
$result[$key]["images"] = $this->dbImg->getHouseImages($param, 1); $result[$key]["images"] = $this->dbImg->getHouseImages($param, 1);
} }
if (empty($result)) { if (empty($result)) {
...@@ -152,7 +152,7 @@ class Shop extends Basic ...@@ -152,7 +152,7 @@ class Shop extends Basic
public function getShopDetail() public function getShopDetail()
{ {
$params = $this->params; $params = $this->params;
$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, $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,
a.sales,a.slotting_fee,a.transfer_fee, a.yetai,a.room_area2,a.shangpu_type,a.is_test,a.sellingpoint,a.singn_rule, a.sales,a.slotting_fee,a.transfer_fee, a.yetai,a.room_area2,a.shangpu_type,a.is_test,a.sellingpoint,a.singn_rule,
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.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, a.shangpu_tags,a.carefully_chosen,a.price,a.dish,a.file_path,b.foreign_name,b.address_detail_c,
...@@ -163,17 +163,17 @@ class Shop extends Basic ...@@ -163,17 +163,17 @@ class Shop extends Basic
return $this->response("101", "详情id不能为空"); return $this->response("101", "详情id不能为空");
} }
$conditions['a.id'] = array( "eq", $params["id"] ); $conditions['a.id'] = array( "eq", $params["id"] );
$conditions['a.show_all'] = array( 'eq', 0 ); //只显示公开楼盘 $conditions['a.show_all'] = array( 'eq', 0 ); //只显示公开楼盘
$result = $this->db->getHouseDetails($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'];
//todo 这里的是否要更改成b端后台上传的类型 //todo 这里的是否要更改成b端后台上传的类型
//$param["imgtype"] = 2; //$param["imgtype"] = 2;
$result["images"] = $this->dbImg->getHouseImages($param, 15); $result["images"] = $this->dbImg->getHouseImages($param, 15);
$param["imgtype"] = 4;//图片类型:1效果图,2实景图,3样板图,4户型图,5交通图 $param["imgtype"] = 4;//图片类型:1效果图,2实景图,3样板图,4户型图,5交通图
$result["plan_images"] = $this->dbImg->getHouseImages($param, 4); $result["plan_images"] = $this->dbImg->getHouseImages($param, 4);
if ($result['room_num_left'] == 0) { if ($result['room_num_left'] == 0) {
...@@ -181,9 +181,9 @@ class Shop extends Basic ...@@ -181,9 +181,9 @@ class Shop extends Basic
} }
//todo 查询关注门店 //todo 查询关注门店
if (isset($this->userId)) { if (isset($this->userId)) {
$attention["user_id"] = array( "eq", $this->userId ); $attention["user_id"] = array( "eq", $this->userId );
$attention["house_id"] = array( "eq", $params["id"] ); $attention["house_id"] = array( "eq", $params["id"] );
$attention["is_del"] = array( "eq", 0 );; $attention["is_del"] = array( "eq", 0 );;
$attResult = $this->attentionModel->getAttentionByUserIdAndHouseId($attention); $attResult = $this->attentionModel->getAttentionByUserIdAndHouseId($attention);
if (count($attResult) > 0) if (count($attResult) > 0)
$result ["attention"] = $attResult["id"]; $result ["attention"] = $attResult["id"];
...@@ -200,11 +200,11 @@ class Shop extends Basic ...@@ -200,11 +200,11 @@ class Shop extends Basic
*/ */
public function filtrateCondition() public function filtrateCondition()
{ {
$field = "city,disc"; $field = "city,disc";
$param['id'] = array( '<>', 16 ); $param['id'] = array( '<>', 16 );
$param['room_num_left'] = array( '<>', 0 ); $param['room_num_left'] = array( '<>', 0 );
$group_ = "disc"; $group_ = "disc";
$cityList = $this->db->getCityList($field, $param, $group_); $cityList = $this->db->getCityList($field, $param, $group_);
foreach ($cityList as $k => $v) { foreach ($cityList as $k => $v) {
if (!empty($v["city"])) { if (!empty($v["city"])) {
...@@ -212,13 +212,13 @@ class Shop extends Basic ...@@ -212,13 +212,13 @@ class Shop extends Basic
} }
} }
$cityArr = array_unique($cityArr); $cityArr = array_unique($cityArr);
$i = 0; $i = 0;
$result["area"][$i]["city"] = "全部"; $result["area"][$i]["city"] = "全部";
$result["area"][$i]["disc"][] = "全部"; $result["area"][$i]["disc"][] = "全部";
foreach ($cityArr as $key => $val) { foreach ($cityArr as $key => $val) {
$i++; $i++;
$result["area"][$i]["city"] = $val; $result["area"][$i]["city"] = $val;
$result["area"][$i]["disc"][] = "全" . $val; $result["area"][$i]["disc"][] = "全" . $val;
foreach ($cityList as $k => $v) { foreach ($cityList as $k => $v) {
if ($val == $v["city"]) { if ($val == $v["city"]) {
...@@ -237,7 +237,7 @@ class Shop extends Basic ...@@ -237,7 +237,7 @@ class Shop extends Basic
array( 'id' => '1', 'value' => '30-60m²' ), array( 'id' => '2', 'value' => '60-100m²' ), array( 'id' => '3', 'value' => '100m²以上' ) ); array( 'id' => '1', 'value' => '30-60m²' ), array( 'id' => '2', 'value' => '60-100m²' ), array( 'id' => '3', 'value' => '100m²以上' ) );
$result['more'][] = "全部"; $result['more'][] = "全部";
$labelsResult = $this->labels->getLabels(); $labelsResult = $this->labels->getLabels();
if (count($labelsResult) > 0) { if (count($labelsResult) > 0) {
foreach ($labelsResult as $labelsKey => $labelsVal) { foreach ($labelsResult as $labelsKey => $labelsVal) {
if ($labelsVal['name']) { if ($labelsVal['name']) {
......
...@@ -29,10 +29,10 @@ class TradeLog extends Basic ...@@ -29,10 +29,10 @@ class TradeLog extends Basic
{ {
parent::__construct($request); parent::__construct($request);
$this->journalAccountsMode = new JournalAccounts(); $this->journalAccountsMode = new JournalAccounts();
$this->dbImg = new HouseImgs(); $this->dbImg = new HouseImgs();
$this->houseInfoModel = new HouseInfos(); $this->houseInfoModel = new HouseInfos();
$this->evaluateMode = new Evaluate(); $this->evaluateMode = new Evaluate();
$this->subletModel = new SubletModel(); $this->subletModel = new SubletModel();
} }
/** /**
...@@ -42,14 +42,14 @@ class TradeLog extends Basic ...@@ -42,14 +42,14 @@ 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,
"pageSize" => 15, "pageSize" => 15,
);*/ );*/
$pageNo = empty($params['pageNo']) ? 1 : $params['pageNo']; $pageNo = empty($params['pageNo']) ? 1 : $params['pageNo'];
$pageSize = empty($params['pageSize']) ? 15 : $params['pageSize']; $pageSize = empty($params['pageSize']) ? 15 : $params['pageSize'];
if (!isset($params["user_id"])) { if (!isset($params["user_id"])) {
return $this->response("101", "userId不能为空"); return $this->response("101", "userId不能为空");
...@@ -66,19 +66,19 @@ class TradeLog extends Basic ...@@ -66,19 +66,19 @@ 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->getHouseDetails("a.room_num_left,b.foreign_name", array( "a.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"]; $result[$key]["foreign_name"] = $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; //默认主图
$result[$key]["images"] = $this->dbImg->getHouseImages($imgParam, 1); $result[$key]["images"] = $this->dbImg->getHouseImages($imgParam, 1);
$evaluateResult = $this->evaluateMode->getIsEvaluate(20, $val["id"], $params["user_id"]); $evaluateResult = $this->evaluateMode->getIsEvaluate(20, $val["id"], $params["user_id"]);
$result[$key]["is_evaluate"] = count($evaluateResult) > 0 ? 1 : 0; $result[$key]["is_evaluate"] = count($evaluateResult) > 0 ? 1 : 0;
//todo 是否以上架 //todo 是否以上架
$subParam["user_id"] = $params["user_id"]; $subParam["user_id"] = $params["user_id"];
$subParam["house_id"] = $val["house_id"]; $subParam["house_id"] = $val["house_id"];
$subletResult = $this->subletModel->getSubletByHoseId($subParam); $subletResult = $this->subletModel->getSubletByHoseId($subParam);
if (count($subletResult) > 0) { if (count($subletResult) > 0) {
$result[$key]["is_added"] = $subletResult[0]["status"]; $result[$key]["is_added"] = $subletResult[0]["status"];
} else { } else {
......
...@@ -8,12 +8,13 @@ class Applies extends Model ...@@ -8,12 +8,13 @@ class Applies extends Model
{ {
protected $table = 'applies'; protected $table = 'applies';
public function getAppliesList($pageNo, $pageSize, $order_, $field,$params){ public function getAppliesList($pageNo, $pageSize, $order_, $field, $params)
{
return $this return $this
->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') ->join('houseinfo_exts c', 'c.house_id = b.id', 'LEFT')
->where($params) ->where($params)
->order($order_) ->order($order_)
......
...@@ -40,22 +40,22 @@ class AttentionModel extends Model ...@@ -40,22 +40,22 @@ class AttentionModel extends Model
->select(); ->select();
if (count($result) > 0) { if (count($result) > 0) {
$saveWhere["id"] = $params["id"]; $saveWhere["id"] = $params["id"];
$arr["is_del"] = 1; $arr["is_del"] = 1;
} else { } else {
return [ "code" => "101", "msg" => "数据不存在" ]; return [ "code" => "101", "msg" => "数据不存在" ];
} }
} else {//关注 } else {//关注
//保存的时候可能是上次取消关注过的所以改遍状态就行了 //保存的时候可能是上次取消关注过的所以改遍状态就行了
$where_["user_id"] = $params['user_id']; $where_["user_id"] = $params['user_id'];
$where_["house_id"] = $params['house_id']; $where_["house_id"] = $params['house_id'];
$res = $this $res = $this
->where($where_) ->where($where_)
->select(); ->select();
if (count($res) > 0) { if (count($res) > 0) {
$saveWhere["id"] = $res[0]["id"]; $saveWhere["id"] = $res[0]["id"];
$arr["is_del"] = 0; $arr["is_del"] = 0;
$id = $res[0]["id"]; $id = $res[0]["id"];
} else { } else {
$arr["create_time"] = date("Y-m-d H:i:s", time()); $arr["create_time"] = date("Y-m-d H:i:s", time());
$arr["update_time"] = date("Y-m-d H:i:s", time()); $arr["update_time"] = date("Y-m-d H:i:s", time());
...@@ -90,7 +90,7 @@ class AttentionModel extends Model ...@@ -90,7 +90,7 @@ class AttentionModel extends Model
public function myAttentionList($pageNo = 1, $pageSize = 15, $order_ = 'id desc', $field, $param) public function myAttentionList($pageNo = 1, $pageSize = 15, $order_ = 'id desc', $field, $param)
{ {
$params["a.user_id"] = $param["user_id"]; $params["a.user_id"] = $param["user_id"];
$params["a.is_del"] = $param["is_del"]; $params["a.is_del"] = $param["is_del"];
//$params["b.room_num_left"] = array( "<>", 0 ); //剩余数为0 的商品不显示 //$params["b.room_num_left"] = array( "<>", 0 ); //剩余数为0 的商品不显示
$params["b.show_all"] = array( "eq", 0 ); //只显示公开的楼盘 $params["b.show_all"] = array( "eq", 0 ); //只显示公开的楼盘
return $this->field($field) return $this->field($field)
......
...@@ -44,7 +44,8 @@ class SubletModel extends Model ...@@ -44,7 +44,8 @@ class SubletModel extends Model
* @throws \think\db\exception\ModelNotFoundException * @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException * @throws \think\exception\DbException
*/ */
public function getSublet($pageNo = 1, $pageSize = 15, $order_ = '', $fields = '*', $params = '') { public function getSublet($pageNo = 1, $pageSize = 15, $order_ = '', $fields = '*', $params = '')
{
$result = $this->field($fields) $result = $this->field($fields)
->where($params) ->where($params)
->order($order_) ->order($order_)
...@@ -60,7 +61,8 @@ class SubletModel extends Model ...@@ -60,7 +61,8 @@ class SubletModel extends Model
* @param $params * @param $params
* @return int|string * @return int|string
*/ */
public function getSubletTotal($params) { public function getSubletTotal($params)
{
$result = $this->where($params)->count(); $result = $this->where($params)->count();
return $result; return $result;
} }
...@@ -70,7 +72,8 @@ class SubletModel extends Model ...@@ -70,7 +72,8 @@ class SubletModel extends Model
* @param $params * @param $params
* @return false|\PDOStatement|string|\think\Collection * @return false|\PDOStatement|string|\think\Collection
*/ */
public function getSubletByHoseId( $params ) { public function getSubletByHoseId($params)
{
return $this->field("id,status") return $this->field("id,status")
->where($params) ->where($params)
->select(); ->select();
......
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