Commit 88945735 authored by clone's avatar clone

查询商铺列表

parent 9aceacd3
...@@ -8,19 +8,61 @@ namespace app\api\controller; ...@@ -8,19 +8,61 @@ namespace app\api\controller;
* Intro: 获取商铺list * Intro: 获取商铺list
*/ */
use app\common\Basic; use app\common\Basic;
use app\model\HouseInfos;
class Shop extends Basic{ class Shop extends Basic{
/** 获取商铺列表 /** 获取商铺列表
* @param $params * @param $params
*/ */
public function getShopList($params){ public function getShopList()
$params['carefully_chosen']; //是否精选 0是1否 {
$params['shangpu_type']; //0商场,1街铺 /* $params['carefully_chosen']; //是否精选 0是1否
$params['disc']; //区域 如 黄埔区 $params['shangpu_type']; //商铺类型 0商场,1街铺
$params['yetai']; //业态 $params['yetai']; //业态
$params['area_start'];//面积起始范围 $params['area_start'];//面积起始范围 room_area2
$params['area_end'];//面积结束范围 $params['area_end'];//面积结束范围
$params['sales'];//0上2下架
$params['money_start'];//price2 租金
$params['money_end'];//price2 租金 范围
$params['shangpu_tags'];//商铺标签
//-------
$params['show_all'];//是否公开0是1否
$params['title'];//商铺名 模糊查询
$params['city'];//市
$params['disc']; //区域 如 黄埔区
$params['site_area'];//来源1app首页 2搜索*/
$params = array(
"site_area" => 1,
"carefully_chosen" =>1
);
$conditions = array();
if (empty($params['site_area'])) {
return $this->response("101", "请求来源不能为空");
}
switch ($params['site_area']) {
case 1:
if (!empty($params['carefully_chosen']) && $params['carefully_chosen'] == 0) {
$conditions['carefully_chosen'] = $params['carefully_chosen'];
}
break;
case 2:
break;
default:
return $this->response("101", "请求数据异常");
}
if (!empty($conditions)) {
$conditions['sales'] = 0; //排除下架的店铺
}
$HouseInfos = new HouseInfos();
$result = $HouseInfos->getHouseInfoList(1,15,$conditions);
if (empty($result)) {
return $this->response("200", "此条件没有找到数据");
}
$this->response(); return $this->response("200", '', $result);
} }
} }
\ No newline at end of file
...@@ -13,15 +13,15 @@ return [ ...@@ -13,15 +13,15 @@ return [
// 数据库类型 // 数据库类型
'type' => 'mysql', 'type' => 'mysql',
// 服务器地址 // 服务器地址
'hostname' => '127.0.0.1', 'hostname' => '101.132.186.250',
// 数据库名 // 数据库名
'database' => '', 'database' => 'db_tongliandichan',
// 用户名 // 用户名
'username' => 'root', 'username' => 'tldc_online',
// 密码 // 密码
'password' => '', 'password' => 'Fujuhaofang123',
// 端口 // 端口
'hostport' => '', 'hostport' => '3308',
// 连接dsn // 连接dsn
'dsn' => '', 'dsn' => '',
// 数据库连接参数 // 数据库连接参数
......
...@@ -2,9 +2,29 @@ ...@@ -2,9 +2,29 @@
namespace app\model; namespace app\model;
use think\Db;
use think\Model; use think\Model;
class HouseInfos extends Model class HouseInfos extends Model
{ {
protected $table = 'houseinfos'; protected $table = 'houseinfos';
protected $dbHouseInfo;
function __construct()
{
$this->dbHouseInfo = Db::table($this->table);
}
function getHouseInfoList($pageNo = 1, $pageSize = 15, $params)
{
/* $where_ = "";
if (!empty($params['carefully_chosen'])) {
$where_ .= "carefully_chosen = :carefully_chosen";
}*/
return $this->dbHouseInfo
->where("carefully_chosen =: id")
->bind(["id" => '0'])
->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