Commit 383b0933 authored by clone's avatar clone

c端已看

parent 9032fce2
......@@ -34,10 +34,10 @@ class AppointmentTime extends Basic
parent::__construct($request);
$this->appointmentTimeModel = new AppointWatchShop();
//$this->houseInfoModel = new HouseInfos();
$this->houseInfoModel = new GHouses();
$this->dbImg = new GHousesImgs();
$this->appliesModel = new Applies();
$this->evaluateMode = new Evaluate();
$this->houseInfoModel = new GHouses();
$this->dbImg = new GHousesImgs();
$this->appliesModel = new Applies();
$this->evaluateMode = new Evaluate();
}
/**
......@@ -47,15 +47,15 @@ class AppointmentTime extends Basic
public function addAppointmentSeeShop()
{
$params = $this->params;
/* $params = array(
"user_id" => 116,
"house_id" => 49,
"house_title" => "楼盘1",
"appellation" => "张三",
"phone" => "13817616312",
"expect_time" => time() + 1000,
"other_require" => "没有其他要求"
);*/
/* $params = array(
"user_id" => 116,
"house_id" => 49,
"house_title" => "楼盘1",
"appellation" => "张三",
"phone" => "13817616312",
"expect_time" => time() + 1000,
"other_require" => "没有其他要求"
);*/
//todo 验证楼盘信息
if (isset($params["house_id"]) && isset($params["house_title"])) {
......@@ -76,15 +76,15 @@ class AppointmentTime extends Basic
return $this->response("101", "预约时间为空,或者小于当前时间");
}
$addPrams = array(
'expect_time' => date("Y-m-d H:i:s", $params["expect_time"] / 1000),
'phone' => $params["phone"],
'house_title' => $params["house_title"],
'house_id' => $params["house_id"],
'appellation' => $params["appellation"],
'user_id' => $params["user_id"],
'expect_time' => date("Y-m-d H:i:s", $params["expect_time"] / 1000),
'phone' => $params["phone"],
'house_title' => $params["house_title"],
'house_id' => $params["house_id"],
'appellation' => $params["appellation"],
'user_id' => $params["user_id"],
'other_require' => $params["other_require"],
'create_time' => date("Y-m-d H:i:s", time()),
'update_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())
);
$result = $this->appointmentTimeModel->insertAppointWatchShop($addPrams);
if ($result["code"] == 200) {
......@@ -102,13 +102,13 @@ class AppointmentTime extends Basic
*/
public function getAppointmentSeeShopList()
{
/* $params = array(
"status" => 2, //看铺状态 0待经纪人确认(确认后存agents_id) 1:待看 2:已看' 如果是待看 0,1 已看是2
"user_id" => "1",//对应u_users表
"phone" => "18112347151",//phone
"pageNo" => "1",
"pageSize" => 15
);*/
/* $params = array(
"status" => 2, //看铺状态 0待经纪人确认(确认后存agents_id) 1:待看 2:已看' 如果是待看 0,1 已看是2
"user_id" => "122",//对应u_users表
"phone" => "17717536290",//phone
"pageNo" => "1",
"pageSize" => 15
);*/
$params = $this->params;
......@@ -124,11 +124,11 @@ class AppointmentTime extends Basic
$pageNo = empty($params['pageNo']) ? 1 : $params['pageNo'];
$pageSize = empty($params['pageSize']) ? 15 : $params['pageSize'];
$result = [];
$result = [];
if ($params["status"] == 1) {
$result = $this->getWaitList($pageNo, $pageSize, $params);
} elseif ($params["status"] == 2) {
$result = $this->getYetList($pageNo, $pageSize, $params);
$result = $this->getYetListV2($pageNo, $pageSize, $params);
}
if (count($result) > 0) {
......@@ -159,7 +159,7 @@ class AppointmentTime extends Basic
foreach ($result as $key => $val) {
$result[$key]["api_path"] = IMG_PATH;
$param["house_id"] = $val["house_id"];
$param["img_type"] = 1; //默认主图
$param["img_type"] = 1; //默认主图
$result[$key]["images"] = $this->dbImg->getHouseImages($param, 1);
$houseInfo = $this->houseInfoModel->getHouseDetail("residue_num as room_num_left,external_title as foreign_name", array( "id" => $val["house_id"] ));
......@@ -190,7 +190,35 @@ class AppointmentTime extends Basic
foreach ($result as $key => $val) {
$result[$key]["api_path"] = IMG_PATH;
$param["house_id"] = $val["house_id"];
$param["img_type"] = 1; //默认主图
$param["img_type"] = 1; //默认主图
$result[$key]["images"] = $this->dbImg->getHouseImages($param, 1);
//todo 是否评价
$evaluateResult = $this->evaluateMode->getIsEvaluate(10, $val["id"], $params["user_id"]);
$result[$key]["is_evaluate"] = count($evaluateResult) > 0 ? 1 : 0;
}
return $result;
}
/**
* 已看列表
* @param $pageNo
* @param $pageSize
* @param $params
* @return false|\PDOStatement|string|\think\Collection
*/
public function getYetListV2($pageNo, $pageSize, $params)
{
$field = "a.id,a.phone,c.reception_id as agents_id,c.create_time as expect_time,a.house_id,
d.external_title as house_title,d.residue_num as room_num_left";
$where_["a.user_id"] = $params["user_id"];
$result = $this->appointmentTimeModel->getHaveToSeeList($pageNo, $pageSize, "id desc", $field, $where_);
//获取图片信息
foreach ($result as $key => $val) {
$result[$key]["api_path"] = IMG_PATH;
$param["house_id"] = $val["house_id"];
$param["img_type"] = 1; //默认主图
$result[$key]["images"] = $this->dbImg->getHouseImages($param, 1);
//todo 是否评价
$evaluateResult = $this->evaluateMode->getIsEvaluate(10, $val["id"], $params["user_id"]);
......
......@@ -53,7 +53,7 @@ class AppointWatchShop extends BaseModel
*/
public function getAppointWatchShopList($pageNo = 1, $pageSize = 15, $order_ = 'id desc', $field, $params)
{
return $this
return $this
->field($field)
->where($params)
->order($order_)
......@@ -62,6 +62,34 @@ class AppointWatchShop extends BaseModel
->select();
}
/**
* 预约看铺列表 已看列表
*
* @param int $pageNo
* @param int $pageSize
* @param string $order_
* @param $field
* @param $params
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getHaveToSeeList($pageNo = 1, $pageSize = 15, $order_ = 'id desc', $field, $params)
{
return $this
->field($field)
->alias("a")
->join("o_report b","a.applies_id = b.id","left")
->join("o_march_in c","c.report_id = b.id","right")
->join("g_houses d","d.id = a.house_id","left")
->where($params)
->order($order_)
->limit($pageSize)
->page($pageNo)
->select();
}
/**
* 预约看铺总数
*
......@@ -70,7 +98,7 @@ class AppointWatchShop extends BaseModel
*/
public function getAppointWatchShopListTotal($params)
{
return $this->where($params)->count();
return $this->where($params)->count();
}
/**
......@@ -81,7 +109,8 @@ class AppointWatchShop extends BaseModel
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getAppointInfo($field, $params) {
public function getAppointInfo($field, $params)
{
return $this->field($field)
->where($params)
->find();
......
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