Commit bdcf7b1e authored by clone's avatar clone

看铺记录

parent b43d4e39
<?php <?php
//配置文件 //配置文件
define('IMG_PATH','https://admin.tonglianjituan.com/houseImg/');
return [ return [
'jwt_key' => 'tonglian+123' 'jwt_key' => 'tonglian+123'
]; ];
\ No newline at end of file
...@@ -35,15 +35,15 @@ class AppointmentTime extends Basic ...@@ -35,15 +35,15 @@ class AppointmentTime extends Basic
public function addAppointmentSeeShop() public function addAppointmentSeeShop()
{ {
$params = $this->params; $params = $this->params;
/* $params = array( /* $params = array(
"user_id" => 1, "user_id" => 1,
"house_id" => 1, "house_id" => 1,
"house_title" => "楼盘1", "house_title" => "楼盘1",
"appellation" => "张三", "appellation" => "张三",
"phone" => "13817616312", "phone" => "13817616312",
"expect_time" => time(), "expect_time" => time(),
"other_require" => "没有其他要求" "other_require" => "没有其他要求"
);*/ );*/
//todo 验证楼盘信息 //todo 验证楼盘信息
if (isset($params["house_id"]) && isset($params["house_title"])) { if (isset($params["house_id"]) && isset($params["house_title"])) {
$where_["house_id"] = $params["house_id"]; $where_["house_id"] = $params["house_id"];
...@@ -72,8 +72,40 @@ class AppointmentTime extends Basic ...@@ -72,8 +72,40 @@ class AppointmentTime extends Basic
} }
public function getAppointmentSeeShopList(){ public function getAppointmentSeeShopList()
{
/* $params = array(
"status" => 2, //看铺状态 0待经纪人确认(确认后存agents_id) 1:待看 2:已看' 如果是待看 0,1 已看是2
"user_id" => "1",//对应u_users表
"pageNo" => "1",
"pageSize" => 15
);*/
$params = $this->params;
$field = "id,user_id,agent_id,house_id,house_title,appellation,phone,expect_time,other_require,status,
is_cancel,is_evaluate,create_time";
$where_ = [];
if (!isset($params["status"])) {
return $this->response("101", "请求状态不能为空");
}
if (!isset($params["user_id"])) {
return $this->response("101", "请求用户不能为空");
}
$pageNo = empty($params['pageNo']) ? 1 : $params['pageNo'];
$pageSize = empty($params['pageSize']) ? 15 : $params['pageSize'];
$where_["status"] = array( "in", $params["status"] );
$where_["user_id"] = array( "eq", $params["user_id"] );
$result = $this->appointmentTimeModel->getAppointWatchShopList($pageNo, $pageSize, "id desc", $field, $where_);
if(count($result) > 0 ){
return $this->response("200","request success" ,$result);
}else{
return $this->response("200","此条件没有找到数据" );
}
} }
......
...@@ -10,16 +10,19 @@ namespace app\api\controller; ...@@ -10,16 +10,19 @@ namespace app\api\controller;
* Intro: 获取商铺list * Intro: 获取商铺list
*/ */
use app\api\extend\Basic; use app\api\extend\Basic;
use app\model\HouseImgs;
use app\model\HouseInfos; use app\model\HouseInfos;
class Shop extends Basic class Shop extends Basic
{ {
protected $db; protected $db;
protected $dbImg;
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();
} }
/** /**
...@@ -27,6 +30,7 @@ class Shop extends Basic ...@@ -27,6 +30,7 @@ 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" => "尚美",
...@@ -41,7 +45,7 @@ class Shop extends Basic ...@@ -41,7 +45,7 @@ class Shop extends Basic
"pageSize" => 15 "pageSize" => 15
);*/ );*/
$params = $this->params; $params = $this->params;
$field = "id,agent_id,title,address,city,disc,disccircles,sales,yetai,room_area2,shangpu_type,is_test, $field = "id,agent_id,title,address,city,disc,disccircles,sales,yetai,room_area,room_area2,shangpu_type,is_test,
room_num_left,shangpu_tags,carefully_chosen,price"; room_num_left,shangpu_tags,carefully_chosen,price";
$conditions = []; $conditions = [];
...@@ -110,6 +114,15 @@ class Shop extends Basic ...@@ -110,6 +114,15 @@ class Shop extends Basic
} }
$result = $this->db->getHouseInfoList($pageNo, $pageSize, $order_, $field, $conditions); $result = $this->db->getHouseInfoList($pageNo, $pageSize, $order_, $field, $conditions);
//获取图片信息
foreach ($result as $key => $val) {
$result[$key]["api_path"] = IMG_PATH;
$param["house_id"] = $val["id"];
$param["imgtype"] = 1; //默认主图
$result[$key]["images"] = $this->dbImg->getHouseImages($param, 1);
}
if (empty($result)) { if (empty($result)) {
return $this->response("200", "此条件没有找到数据"); return $this->response("200", "此条件没有找到数据");
} }
......
...@@ -32,4 +32,23 @@ class AppointWatchShop extends Model ...@@ -32,4 +32,23 @@ class AppointWatchShop extends Model
} }
return [ "code" => "101", "msg" => "数据保存异常,rollback" ]; return [ "code" => "101", "msg" => "数据保存异常,rollback" ];
} }
/**
* @param int $pageNo
* @param int $pageSize
* @param string $order_
* @param $field
* @param $params
* @return mixed
*/
public function getAppointWatchShopList($pageNo = 1, $pageSize = 15, $order_ = 'id desc', $field, $params)
{
return $data = $this->db
->field($field)
->where($params)
->order($order_)
->limit($pageSize)
->page($pageNo)
->select();
}
} }
...@@ -6,5 +6,29 @@ use think\Model; ...@@ -6,5 +6,29 @@ use think\Model;
class HouseImgs extends Model class HouseImgs extends Model
{ {
protected $table = 'houseimgs'; protected $table = 'houseimgs';
protected $db;
function __construct()
{
$this->db = Db($this->table);
}
/**
* 批量查询商铺图片
* @param $param
* @return mixed
*/
public function getHouseImages($param,$limit_)
{
//rank
return $this->db
->field("id,house_id,img_title,imgtype,imagename")
->where($param)
->order("rank desc")
->limit($limit_)
->select();
}
} }
...@@ -34,7 +34,6 @@ class HouseInfos extends Model ...@@ -34,7 +34,6 @@ class HouseInfos extends Model
->limit($pageSize) ->limit($pageSize)
->page($pageNo) ->page($pageNo)
->select(); ->select();
} }
/** /**
......
...@@ -61,6 +61,15 @@ Route::group('api',[ ...@@ -61,6 +61,15 @@ Route::group('api',[
'shopList' => ['api/shop/getShopList', ['method' => 'post']], 'shopList' => ['api/shop/getShopList', ['method' => 'post']],
'shopDetail' => ['api/shop/getShopDetail', ['method' => 'get']], 'shopDetail' => ['api/shop/getShopDetail', ['method' => 'get']],
//get banner
'bannerList' => ['api/banner/getBannerList', ['method' => 'get']],
//get averagePriceAndTurnover
'averagePriceAndTurnover' => ['api/index/averagePriceAndTurnover',['method' => 'get']]
]); ]);
Route::miss('api/index/miss');//处理错误的url Route::miss('api/index/miss');//处理错误的url
\ 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