Commit e598f971 authored by zhuwei's avatar zhuwei

获取房源详情

parent f33d88af
......@@ -81,4 +81,24 @@ class OfficeRoom extends Basic
return $this->response($result['code'], $result['msg'], $result_data);
}
/**
* 房源详情
* @return \think\Response
*/
public function getOfficeRoomInfo()
{
$params = $this->params;
$checkResult = $this->validate($params, "OfficeRoomValidate.modifyAgentPassword");
if (true !== $checkResult) {
return $this->response("101", $checkResult);
}
$broker_service = new OfficeRoomService();
$result = $broker_service->getOfficeRoomInfo($params);
return $this->response($result['status'],$result['msg'], $result['data']);
}
}
\ No newline at end of file
<?php
namespace app\api_broker\validate;
use think\Validate;
class OfficeRoomValidate extends Validate{
protected $rule = [
'id' => 'require|number|gt:0',
];
protected $message = [
'id.require' => 'id为必填字段',
'id.number' => 'id只能为数字',
'id.gt' => 'id必须大于0',
];
protected $scene = [
'getOfficeRoomInfo' => [ 'id' ],
];
}
......@@ -548,4 +548,31 @@ class OfficeRoomService
}
return $edit_phone;
}
/**
* 获取房源详情
* @return array
*/
public function getOfficeRoomInfo($params){
$conditions = [];
if (!isset($params['id']) or !$params['id'])
return ['status'=>101,'msg'=>'房源ID不能为空'];
$conditions['a.id'] = $params["id"];
$field = 'a.id';
$result = $this->m_office_room->getOfficeRoomInfo($field, $conditions);
if (!$result) {
return ['status'=>101,'msg'=>'此房源不存在'];
}
return ['status'=>200,'msg'=>'success','data'=>$result];
}
}
\ No newline at end of file
......@@ -201,4 +201,14 @@ class OfficeGRoom extends BaseModel
->where($where)
->find();
}
public function getOfficeRoomInfo($field, $params)
{
$result = $this->field($field)
->alias("a")
->where($params)
->find();
return $result;
}
}
......@@ -963,14 +963,17 @@ Route::group('office', [
'getCommission' => ['api_broker/OfficeOrderLog/getCommission', ['method' => 'GET|POST']],
'isShowAdjustment' => ['api_broker/OfficeOrderLog/isShowAdjustment', ['method' => 'GET|POST']],
'addBargain' => ['api_broker/OfficeOrderLog/addBargain', ['method' => 'post']], //新增成交报告佣金(分佣提成)
'houseEdit' => ['api_broker/OfficeRoom/edit', ['method' => 'POST|GET']],//楼盘字典新增和编辑
'delHouseFile' => ['index/OfficeRoom/delHouseFile', ['method' => 'POST']],//删除楼盘图片
'houseEdit' => ['api_broker/OfficeRoom/edit', ['method' => 'POST']],//楼盘字典新增和编辑
'getOfficeRoomInfo' => [ 'api_broker/OfficeRoom/getOfficeRoomInfo', [ 'method' => 'POST' ] ],//获取房源详情
]);
Route::group('office_index', [
'houseDictionaryAdd' => ['index/OfficeManage/add', ['method' => 'GET|POST']],//楼盘字典新增
'houseDictionaryEdit' => ['index/OfficeManage/edit', ['method' => 'GET|POST']],//楼盘字典编辑
'delHouseFile' => ['index/OfficeManage/delHouseFile', ['method' => 'POST']],//删除楼盘图片
'houseAdd' => [ 'index/OfficeManage/add', [ 'method' => 'GET|POST' ] ],//楼盘字典新增
'houseEdit' => [ 'index/OfficeManage/edit', [ 'method' => 'GET|POST' ] ],//楼盘字典编辑
'delHouseFile' => [ 'index/OfficeManage/delHouseFile', [ 'method' => 'POST' ] ],//删除楼盘图片
]);
//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