Commit fe4a24a0 authored by zhuwei's avatar zhuwei

关注的办公楼

parent 6d7ea626
......@@ -3,6 +3,7 @@
namespace app\api\controller;
use app\api\extend\Basic;
use app\api\service\OfficeRoomApiService;
use app\model\AttentionModel;
use app\model\GHousesImgs;
use app\model\GImageDepot;
......@@ -77,6 +78,8 @@ class AttentionShop extends Basic
$pageSize = empty($params['pageSize']) ? 15 : $params['pageSize'];
$order_ = 'a.create_time desc';
//b.room_num_left 前端显示已下架,不可点击到详情
$field = "a.id,a.house_id,b.external_title as title,b.shop_area_start as room_area,b.shop_area_end as room_area2,
......@@ -87,6 +90,7 @@ class AttentionShop extends Basic
return $this->response("101", "用户id不能为空");
}
$params["is_del"] = 0; //关注中的商铺
$params["type"] = 0;
$result = $this->attentionModel->myAttentionList($pageNo, $pageSize, $order_, $field, $params);
if (count($result) <= 0) {
......@@ -121,5 +125,33 @@ class AttentionShop extends Basic
return $this->response("200", "request success", $result);
}
/**
* 关注的办公楼
* @return \think\Response
*/
public function attentionOfficeList()
{
$params = $this->params;
/*
AuthToken:eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJkYXRhIjp7ImlkIjoiMTM1NjMwIiwidXNlck5pY2siOiIiLCJwaG9uZSI6IjE1NjIyMjMyMjExIn0sInRpbWVTdGFtcF8iOjE1NjU3NTAyMzV9.yiyHfGFHB8se7TJhJ2Enq4EcxrnzHFo7uxdTGgr0_HI
user_id:135630
pageSize:10
pageNo:1
*/
if (!isset($params["user_id"])) {
return $this->response("101", "用户id不能为空");
}
$s_office_room = new OfficeRoomApiService();
$result = $s_office_room->attentionOfficeList($this->params);
if ($result['status'] == 'successful') {
return $this->response("200", "success",$result['data']);
} else {
return $this->response("101", $result['msg']);
}
}
}
\ No newline at end of file
......@@ -2,6 +2,7 @@
namespace app\api\service;
use app\model\AttentionModel;
use app\model\OfficeGBuildingStations;
use app\model\OfficeGImg;
use app\model\OfficeGRoom;
......@@ -203,5 +204,53 @@ class OfficeRoomApiService
}
return $ids;
}
/**
* 关注的办公楼
* @param $params
* @return false|\PDOStatement|string|\think\Collection
*/
public function attentionOfficeList($params)
{
$pageNo = empty($params['pageNo']) ? 1 : $params['pageNo'];
$pageSize = empty($params['pageSize']) ? 15 : $params['pageSize'];
$m_attention = new AttentionModel();
$field = "b.id,c.disc,c.title,c.address,d.name as business_name,b.building_id,b.price,b.price_total,c.status,b.is_rent";
$params["a.type"] = 0;
$order_ = 'a.create_time desc';
try {
$result = $m_attention->myOfficeAttentionList($pageNo, $pageSize, $order_, $field, $params);
} catch (\Exception $e) {
$result['status'] = 'fail';
$result['msg'] = $e->getMessage();
return $result;
}
$result_data = [];
$gRoomImgModel = new OfficeGImg();
foreach ($result as $k => $v) {
$tmp['id'] = $v['id'];
$tmp['price'] = empty($v['price']) ? 0 : $v['price'] / 100;
$tmp['price_total'] = empty($v['price_total']) ? 0 : $v['price_total'] / 100;
$tmp['shop_sign'] = $this->getBuildingSign($v['building_id']);
$tmp['status'] = $v['status'];
$tmp['is_rent'] = $v['is_rent'];
$area = $this->MinField($v['building_id'], 'area');
$tmp['title'] = $v['disc'] . ' ' . $v['business_name'] . ' ' . $v['title'] . ' ' . $area . '㎡';
$tmp['api_path'] = CK_IMG_URL . 'images/';
$house_img_where["house_id"] = $v["id"];
$house_img_where["img_type"] = 2;
$tmp["images"] = $gRoomImgModel->getCoverImage('id,img_name', $house_img_where);
$result_data[] = $tmp;
}
$result['status'] = 'successful';
$result['data'] = $result_data;
return $result;
}
}
......@@ -111,6 +111,30 @@ class AttentionModel extends Model
->select();
}
/**
* 关注的办公楼
* @param int $pageNo
* @param int $pageSize
* @param string $order_
* @param $field
* @param $param
* @return false|\PDOStatement|string|\think\Collection
*/
public function myOfficeAttentionList($pageNo = 1, $pageSize = 15, $order_ = 'a.id desc', $field, $param)
{
$params["a.is_del"] = 0;
return $this->field($field)
->alias("a")
->join('office_g_room b', 'a.house_id = b.id', 'left')
->join('office_g_building c', 'b.building_id = c.id', 'left')
->join('g_business_district d', 'c.business_district_id = d.id', 'left')
->where($params)
->order($order_)
->limit($pageSize)
->page($pageNo)
->select();
}
/**
*根据userId和楼盘id获取是否关注此商铺
* @param $params
......
......@@ -634,8 +634,9 @@ Route::group('api', [
'getTradeList' => ['api/TradeLog/getTradeList', ['method' => 'post|get']],
//AttentionShop
'addOrUpdateAttention' => ['api/AttentionShop/addOrUpdateAttention', ['method' => 'post|get']],
'attentionList' => ['api/AttentionShop/attentionList', ['method' => 'post | get']],
'addOrUpdateAttention' => [ 'api/AttentionShop/addOrUpdateAttention', [ 'method' => 'post|get' ] ],
'attentionList' => [ 'api/AttentionShop/attentionList', [ 'method' => 'post | get' ] ],
'attentionOfficeList' => [ 'api/AttentionShop/attentionOfficeList', [ 'method' => 'post | get' ] ],//关注的办公楼
'addSublet' => ['api/Sublet/addSublet', ['method' => 'post|get']],
......
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