Commit 01cda0d3 authored by clone's avatar clone

房东手机号搜索

parent 898e330e
......@@ -183,6 +183,7 @@ class Shop extends Basic
foreach ($result as $key => $val) {
$result[$key]["api_path"] = CK_IMG_URL . 'images/';
$result[$key]["rent_price"] = $val["rent_price"] * 0.01;
$result[$key]["title"] = $val["city"] . $result[$key]["title"];
$param["house_id"] = $val["id"];
$param["img_type"] = 1; //默认主图
......
......@@ -10,6 +10,7 @@ use app\model\AAgents;
use app\model\ACollectHouse;
use app\model\AttentionModel;
use app\model\GHouses;
use app\model\GHousesExt;
use app\model\GHousesFollowUp;
use app\model\GHousesImgs;
use app\model\GHousesToAgents;
......@@ -53,7 +54,7 @@ class Shop extends Basic
header('Access-Control-Allow-Origin:*');
$params = $this->params;
/*$params = array(
/* $params = array(
"site_area" => 4, //来源 1c首页 2c搜索 3b首页 4b搜索 5b报备
// "title" => "vv", //1,2 external_title ,3,4internal_title
"house_id" => 4,
......@@ -71,6 +72,7 @@ class Shop extends Basic
"status" => 1, //1上架or2下架
"start_time" => "2018-05-25",
"end_time" => "2018-05-30",
"landlord_phone" => "17621970093",
"pageNo" => 1,
"pageSize" => 15
);*/
......@@ -84,7 +86,7 @@ class Shop extends Basic
,shop_area_start,shop_area_end,shop_type,residue_num,shop_sign,is_carefully_chosen,rent_type,rent_price";
} 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
,shop_area_start,shop_area_end,shop_type,residue_num,shop_sign,is_carefully_chosen,rent_type,rent_price";
$conditions["city"] = trim($this->city);
......@@ -108,8 +110,18 @@ class Shop extends Basic
$conditions['internal_address'] = array( "like", "%" . trim($params['address']) . "%" );
}
$houseIds = "";
if (isset($params['landlord_phone'])) {
$houseIds = $this->returnHouseId($params['landlord_phone']);
if (empty($houseIds)) {
return $this->response("200", "此条件没有找到数据");
}
}
if (isset($params['house_id'])) {
$conditions['id'] = array( "eq", $params['house_id'] );
$houseIds = $params['house_id'];
}
if (!empty($houseIds)) {
$conditions['id'] = array( "in", $houseIds );
}
if (isset($params['start_time']) && isset($params['end_time'])) {
......@@ -204,6 +216,7 @@ class Shop extends Basic
foreach ($result as $key => $val) {
$result[$key]["api_path"] = CK_IMG_URL . 'images/';
$result[$key]["rent_price"] = $val["rent_price"] * 0.01;
$result[$key]["title"] = $val["city"] . $result[$key]["title"];
$param["house_id"] = $val["id"];
$param["img_type"] = 1; //默认主图
......@@ -222,6 +235,20 @@ class Shop extends Basic
return $this->response("200", 'request success', $result);
}
private function returnHouseId($landlord_phone)
{
$houseExtModel = new GHousesExt();
$houseIds = $houseExtModel->getHouseId($landlord_phone);
$ids = "";
if (count($houseIds) > 0) {
foreach ($houseIds as $item) {
$ids .= $item["house_id"] . ",";
}
$ids = rtrim($ids, ",");
}
return $ids;
}
/**
* 楼盘详情
......@@ -406,9 +433,9 @@ class Shop extends Basic
if ($this->request->isPost()) {
$validate = new HouseValidate();
$check = $validate->check($this->params);
$check = $validate->check($this->params);
if(true !== $check){
if (true !== $check) {
return $this->response(101, $validate->getError());
}
......@@ -449,9 +476,9 @@ class Shop extends Basic
if ($this->request->isPost()) {
$validate = new HouseValidate();
$check = $validate->check($this->params);
$check = $validate->check($this->params);
if(true !== $check){
if (true !== $check) {
return $this->response(101, $validate->getError());
}
$house_id = $this->gHousesModel->app_addV2($this->params, $this->agentId); //添加或编辑商铺
......
......@@ -9,7 +9,25 @@
namespace app\model;
use Think\Db;
class GHousesExt extends BaseModel
{
protected $table = 'g_houses_ext';
private $db_;
public function __construct($data = [])
{
parent::__construct($data);
$this->db_ = Db::table($this->table);
}
public function getHouseId($landlord_phone)
{
$params["landlord_phone"] = array( "like", '%' . $landlord_phone . '%' );
return $this->db_
->field("house_id")
->where($params)
->select();
}
}
\ No newline at end of file
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