Commit 51e52250 authored by hujun's avatar hujun

是否精选

parent bf004a68
...@@ -17,6 +17,9 @@ use app\model\OfficeACollectHouse; ...@@ -17,6 +17,9 @@ use app\model\OfficeACollectHouse;
class OfficeRoom extends Basic class OfficeRoom extends Basic
{ {
private $service; private $service;
private $code = 200;
private $msg = '';
private $data = [];
public function __construct() public function __construct()
{ {
...@@ -31,36 +34,32 @@ class OfficeRoom extends Basic ...@@ -31,36 +34,32 @@ class OfficeRoom extends Basic
*/ */
public function edit() public function edit()
{ {
$result['code'] = 200;
$result['msg'] = '';
$result_data = [];
if ($this->request->isPost()) { if ($this->request->isPost()) {
$data = $this->service->edit($this->params, $this->userId, $this->siteId); $data = $this->service->edit($this->params, $this->userId, $this->siteId);
if ($data['status'] == 'successful') { if ($data['status'] == 'successful') {
$result_data['house_id'] = $data['data']['house_id']; $this->data['house_id'] = $data['data']['house_id'];
$result['msg'] = '新增或编辑成功'; $this->msg = '新增或编辑成功';
} else { } else {
$result['code'] = 101; $this->code = 101;
$result['msg'] = $data['msg']; $this->msg = $data['msg'];
} }
} else { } else {
if (empty($this->params['id'])) { if (empty($this->params['id'])) {
$result['code'] = 101; $this->code = 101;
$result['msg'] = 'Id is null'; $this->msg = 'Id is null';
} else { } else {
//获取商铺详情 //获取商铺详情
$data = $this->service->getOfficeRoomDetail($this->params['id']); $data = $this->service->getOfficeRoomDetail($this->params['id']);
if ($data['status'] == 'successful') { if ($data['status'] == 'successful') {
$result_data = $data['data']; $this->data = $data['data'];
} else { } else {
$result['msg'] = $data['msg']; $this->msg = $data['msg'];
$result['code'] = 101; $this->code = 101;
} }
} }
} }
return $this->response($result['code'], $result['msg'], $result_data); return $this->response($this->code, $this->msg, $this->data);
} }
...@@ -74,22 +73,19 @@ class OfficeRoom extends Basic ...@@ -74,22 +73,19 @@ class OfficeRoom extends Basic
*/ */
public function getBuildingSearch() public function getBuildingSearch()
{ {
$msg = '';
$data = [];
$code = 200;
$pageNo = empty($params['pageNo']) ? 1 : $params['pageNo']; $pageNo = empty($params['pageNo']) ? 1 : $params['pageNo'];
$pageSize = empty($params['pageSize']) ? 15 : $params['pageSize']; $pageSize = empty($params['pageSize']) ? 15 : $params['pageSize'];
$building_service = new OfficeService(); $building_service = new OfficeService();
$result = $building_service->BuildingSearch($pageNo, $pageSize, $this->params); $result = $building_service->BuildingSearch($pageNo, $pageSize, $this->params);
if ($result['status'] == 'fail') { if ($result['status'] == 'fail') {
$code = 101; $this->code = 101;
$msg = $result['msg']; $this->msg = $result['msg'];
} else { } else {
$data = $result['data']; $this->data = $result['data'];
} }
return $this->response($code, $msg, $data); return $this->response($this->code, $this->msg, $this->data);
} }
...@@ -100,20 +96,16 @@ class OfficeRoom extends Basic ...@@ -100,20 +96,16 @@ class OfficeRoom extends Basic
*/ */
public function getBuildingDetail() public function getBuildingDetail()
{ {
$msg = '';
$data = [];
$code = 200;
$building_service = new OfficeService(); $building_service = new OfficeService();
$result = $building_service->getOfficeDetail($this->params['id']); $result = $building_service->getOfficeDetail($this->params['id']);
if ($result['status'] == 'fail') { if ($result['status'] == 'fail') {
$code = 101; $this->code = 101;
$msg = $result['msg']; $this->msg = $result['msg'];
} else { } else {
$data = $result['data']; $this->data = $result['data'];
} }
return $this->response($code, $msg, $data); return $this->response($this->code, $this->msg, $this->data);
} }
/** /**
...@@ -126,11 +118,7 @@ class OfficeRoom extends Basic ...@@ -126,11 +118,7 @@ class OfficeRoom extends Basic
if (!$this->request->isAjax()) { if (!$this->request->isAjax()) {
return view('office/officeBuildingList'); return view('office/officeBuildingList');
} }
$code = 200;
$data = [];
$msg = '';
$result = $this->service->getRoomList($this->params, 1); $result = $this->service->getRoomList($this->params, 1);
if ($result['status'] == 'successful') { if ($result['status'] == 'successful') {
$m_collect = new OfficeACollectHouse(); $m_collect = new OfficeACollectHouse();
foreach ($result['data'] as $k=>$v) { foreach ($result['data'] as $k=>$v) {
...@@ -138,15 +126,15 @@ class OfficeRoom extends Basic ...@@ -138,15 +126,15 @@ class OfficeRoom extends Basic
$where['house_id'] = $v['id']; $where['house_id'] = $v['id'];
$where['status'] = 1; $where['status'] = 1;
$is_collect = $m_collect->getFieldOneValue('id', $where); $is_collect = $m_collect->getFieldOneValue('id', $where);
$result['data'][$k]['is_collect'] = $is_collect ? $is_collect : 0; $result['data'][$k]['is_collect'] = $is_collect ? 1 : 2;
} }
$data['list'] = $result['data']; $this->data['list'] = $result['data'];
$data['total'] = $result['total']; $this->data['total'] = $result['total'];
} else { } else {
$code = 101; $this->code = 101;
$msg = $result['msg']; $this->msg = $result['msg'];
} }
return $this->response($code, $msg, $data); return $this->response($this->code, $this->msg, $this->data);
} }
/** /**
...@@ -156,18 +144,17 @@ class OfficeRoom extends Basic ...@@ -156,18 +144,17 @@ class OfficeRoom extends Basic
*/ */
public function getRecords() public function getRecords()
{ {
$data = [];
$this->params['type'] = 1; $this->params['type'] = 1;
$result = $this->service->getRecords($this->params); $result = $this->service->getRecords($this->params);
if ($result['status'] == 'successful') { if ($result['status'] == 'successful') {
$data = $result['data']; $this->data = $result['data'];
$code = 200; $this->code = 200;
$msg = ''; $this->msg = '';
} else { } else {
$code = 101; $this->code = 101;
$msg = $result['msg']; $this->msg = $result['msg'];
} }
return $this->response($code, $msg, $data); return $this->response($this->code, $this->msg, $this->data);
} }
/** /**
...@@ -177,17 +164,31 @@ class OfficeRoom extends Basic ...@@ -177,17 +164,31 @@ class OfficeRoom extends Basic
*/ */
public function batchChangDish() public function batchChangDish()
{ {
$code = 200;
$msg = '';
$data = [];
$result = $this->service->batchChangDish($this->params['old_agents_id'], $this->params['agents_id'], $this->userId); $result = $this->service->batchChangDish($this->params['old_agents_id'], $this->params['agents_id'], $this->userId);
if ($result['status'] == 'successful') { if ($result['status'] == 'successful') {
$data = $result['data']; $this->data = $result['data'];
} else { } else {
$code = 101; $this->code = 101;
$msg = $result['msg']; $this->msg = $result['msg'];
} }
return $this->response($code, $msg, $data); return $this->response($this->code, $this->msg, $this->data);
}
/**
* 是否精选商铺
*
* @return \think\Response
*/
public function carefullyChosen()
{
$data['id'] = $this->params['houses_id'];
$data['is_carefully_chosen'] = $this->params['is_carefully_chosen'];
$result = $this->service->edit($data, $this->userId, $this->siteId, 'is_carefully_chosen');
if ($result['status'] == 'fail') {
$this->code = 101;
$this->msg = $result['msg'];
}
return $this->response($this->code, $this->msg, $this->data);
} }
} }
\ No newline at end of file
...@@ -63,38 +63,45 @@ class OfficeRoomService ...@@ -63,38 +63,45 @@ class OfficeRoomService
* @param array $data * @param array $data
* @param int $agent_id 上传人id * @param int $agent_id 上传人id
* @param int $site_id * @param int $site_id
* @param string $scene
* @return mixed * @return mixed
*/ */
public function edit(array $data, int $agent_id, $site_id) public function edit(array $data, int $agent_id, $site_id, $scene = '')
{ {
$result['status'] = 'fail'; $result['status'] = 'fail';
$result['msg'] = ''; $result['msg'] = '';
$result['data'] = []; $result['data'] = [];
if (empty($scene)) {
if (isset($data['id'])) { if (isset($data['id'])) {
$scene = 'edit'; $scene = 'edit';
} else { } else {
$scene = 'add'; $scene = 'add';
} }
}
$check = $this->validate->scene($scene)->check($data); $check = $this->validate->scene($scene)->check($data);
if (false === $check) { if (false === $check) {
$result['msg'] = $this->validate->getError(); $result['msg'] = $this->validate->getError();
return $result; return $result;
} }
$id = $this->m_office_room->addRoom($data, $agent_id); $id = $this->m_office_room->addRoom($data, $agent_id);
if ($id > 0) { if ($id > 0) {
$remark = ''; $remark = '';
/*房东手机号处理 start*/ /*房东手机号处理 start*/
if (!empty($data['landlord_phone'])) { if (!empty($data['landlord_phone'])) {
try {
$landlord_phone_new = json_decode($data['landlord_phone'], true); $landlord_phone_new = json_decode($data['landlord_phone'], true);
$landlord_phone_old = $this->landlordPhoneEditV2($landlord_phone_new, $id); $landlord_phone_old = $this->landlordPhoneEditV2($landlord_phone_new, $id);
if (!empty($landlord_phone_old)) { if (!empty($landlord_phone_old)) {
$remark .= implode(',', $landlord_phone_old).','; $remark .= implode(',', $landlord_phone_old).',';
} }
} catch (\Exception $e) {
$result['msg'] = '房东手机号处理失败'.$e->getMessage();
return $result;
}
} }
/*房东手机号处理 end*/ /*房东手机号处理 end*/
...@@ -121,8 +128,13 @@ class OfficeRoomService ...@@ -121,8 +128,13 @@ class OfficeRoomService
//独家方 //独家方
if (empty($data['exclusive_ids'])) { if (empty($data['exclusive_ids'])) {
try {
$this->delAgentHouse(3, $id, 0); $this->delAgentHouse(3, $id, 0);
unset($data['exclusive_ids']); unset($data['exclusive_ids']);
} catch (\Exception $e) {
}
} else { } else {
$result_exclusive_ids = $this->releaseRelationshipV2($data['exclusive_ids'], $id, 3, $agent_id, $data['title'], $site_id); $result_exclusive_ids = $this->releaseRelationshipV2($data['exclusive_ids'], $id, 3, $agent_id, $data['title'], $site_id);
if ($result_exclusive_ids['status'] == 'fail') { if ($result_exclusive_ids['status'] == 'fail') {
...@@ -878,6 +890,7 @@ class OfficeRoomService ...@@ -878,6 +890,7 @@ class OfficeRoomService
} }
if ($is_total) { if ($is_total) {
$result['total'] = $this->m_office_room->getRoomAgentTotal($where); $result['total'] = $this->m_office_room->getRoomAgentTotal($where);
$result['total'] = $result['total'] ? $result['total'] : 0;
} }
$result['data'] = $room_data; $result['data'] = $room_data;
$result['status'] = 'successful'; $result['status'] = 'successful';
......
...@@ -41,7 +41,8 @@ class OfficeBuildingRoomValidate extends Validate ...@@ -41,7 +41,8 @@ class OfficeBuildingRoomValidate extends Validate
'decoration' => 'require|in:1,2,3,4', 'decoration' => 'require|in:1,2,3,4',
'shop_sign' => 'require|length:1,255', 'shop_sign' => 'require|length:1,255',
'landlord_phone'=>'require', 'landlord_phone'=>'require',
'agent_dish'=>'require' 'agent_dish'=>'require',
'is_carefully_chosen'=>'require|in:0,1'
]; ];
protected $message = [ protected $message = [
...@@ -95,7 +96,9 @@ class OfficeBuildingRoomValidate extends Validate ...@@ -95,7 +96,9 @@ class OfficeBuildingRoomValidate extends Validate
'landlord_phone.require' => '房东手机号必填', 'landlord_phone.require' => '房东手机号必填',
'agent_dish.require' => '盘方必填', 'agent_dish.require' => '盘方必填',
'building_id.require'=>'办公楼必选', 'building_id.require'=>'办公楼必选',
'building_id.between'=>'办公楼参数错误' 'building_id.between'=>'办公楼参数错误',
'is_carefully_chosen.require'=>'是否精选参数必选提交',
'is_carefully_chosen.in'=>'是否精选参数错误'
]; ];
protected $scene = [ protected $scene = [
...@@ -105,6 +108,7 @@ class OfficeBuildingRoomValidate extends Validate ...@@ -105,6 +108,7 @@ class OfficeBuildingRoomValidate extends Validate
'edit' => ['id','floor','room_number','is_rent','is_exclusive_type','price_total','price','slotting_fee','management_fee', 'edit' => ['id','floor','room_number','is_rent','is_exclusive_type','price_total','price','slotting_fee','management_fee',
'station_start','station_end','area','floor_tag','enter_time','payment_month','deposit_month','age_limit_start', 'station_start','station_end','area','floor_tag','enter_time','payment_month','deposit_month','age_limit_start',
'age_limit_end','is_partition','carport','rent_free','source','decoration','shop_sign'], 'age_limit_end','is_partition','carport','rent_free','source','decoration','shop_sign'],
'detail' => ['id'] 'detail' => ['id'],
'is_carefully_chosen'=>['id','is_carefully_chosen']
]; ];
} }
\ No newline at end of file
...@@ -193,6 +193,11 @@ class OfficeGRoom extends BaseModel ...@@ -193,6 +193,11 @@ class OfficeGRoom extends BaseModel
$save_data['landlord_remark'] = $data['landlord_remark']; $save_data['landlord_remark'] = $data['landlord_remark'];
} }
//精选商铺--0否1是
if (isset($data['is_carefully_chosen'])) {
$save_data['is_carefully_chosen'] = $data['is_carefully_chosen'];
}
if (empty($data['id'])) { if (empty($data['id'])) {
$save_data['operation_id'] = $agent_id; //上传人 $save_data['operation_id'] = $agent_id; //上传人
$save_data['create_time'] = date('Y-m-d H:i:s'); $save_data['create_time'] = date('Y-m-d H:i:s');
......
...@@ -1014,7 +1014,7 @@ Route::group('office_index', [ ...@@ -1014,7 +1014,7 @@ Route::group('office_index', [
'houseDictionaryAdd' => ['index/OfficeManage/add', ['method' => 'GET|POST']],//楼盘字典新增 'houseDictionaryAdd' => ['index/OfficeManage/add', ['method' => 'GET|POST']],//楼盘字典新增
'houseDictionaryEdit' => ['index/OfficeManage/edit', ['method' => 'GET|POST']],//楼盘字典编辑 'houseDictionaryEdit' => ['index/OfficeManage/edit', ['method' => 'GET|POST']],//楼盘字典编辑
'delHouseFile' => ['index/OfficeManage/delHouseFile', ['method' => 'POST']],//删除房源图片 'delHouseFile' => ['index/OfficeManage/delHouseFile', ['method' => 'POST']],//删除房源图片
'delBuildingFile' => ['index/OfficeBuilding/delBuildingFile', ['method' => 'POST']],//删除楼盘图片 'delBuildingFile' => ['index/OfficeManage/delBuildingFile', ['method' => 'POST']],//删除楼盘图片
'getBuildingSearch' => ['index/OfficeRoom/getBuildingSearch', ['method' => 'GET']],//搜索楼盘 'getBuildingSearch' => ['index/OfficeRoom/getBuildingSearch', ['method' => 'GET']],//搜索楼盘
'getBuildingDetail' => ['index/OfficeRoom/getBuildingDetail', ['method' => 'GET']],//楼盘详情 'getBuildingDetail' => ['index/OfficeRoom/getBuildingDetail', ['method' => 'GET']],//楼盘详情
'getBuildingList' => ['index/OfficeManage/getBuildingList', ['method' => 'GET']],//楼盘列表 'getBuildingList' => ['index/OfficeManage/getBuildingList', ['method' => 'GET']],//楼盘列表
...@@ -1031,6 +1031,7 @@ Route::group('office_index', [ ...@@ -1031,6 +1031,7 @@ Route::group('office_index', [
'adjustment' => ['index/OfficePayLog/adjustment', ['method' => 'get']],//导出收款记录 'adjustment' => ['index/OfficePayLog/adjustment', ['method' => 'get']],//导出收款记录
'getCollectionDetail' => ['index/OfficePayLog/getCollectionDetail', ['method' => 'get']],//收款详情 'getCollectionDetail' => ['index/OfficePayLog/getCollectionDetail', ['method' => 'get']],//收款详情
'getAdjustmentDetail' => ['index/OfficePayLog/getAdjustmentDetail', ['method' => 'get']],//调整收款详情 'getAdjustmentDetail' => ['index/OfficePayLog/getAdjustmentDetail', ['method' => 'get']],//调整收款详情
'carefullyChosen' => ['index/OfficeRoom/carefullyChosen', ['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