Commit 149977ed authored by hujun's avatar hujun

是否对C端显示

parent 23388a39
......@@ -279,4 +279,18 @@ class OfficeRoom extends Basic
return $this->response($this->code, $this->msg, $this->data);
}
/**
* 是否对C端显示
*
* @return \think\Response
*/
public function isShow() {
$result = $this->service->isShow($this->params);
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
......@@ -1418,4 +1418,35 @@ class OfficeRoomService
return $result;
}
/**
* 是否对C端显示
*
* @param $data
* @return mixed
*/
public function isShow($data) {
$result['status'] = 'fail';
$result['msg'] = '';
$result['data'] = [];
$check = $this->validate->scene('is_show')->check($data);
if (false === $check) {
$result['msg'] = $this->validate->getError();
return $result;
}
try {
$house_data = $this->m_office_room->getFindData('id,is_show', ['id'=>$data['id']]);
if (empty($house_data['id'])) {
$result['msg'] = '没有该房源';
return $result;
} else {
if ($house_data['is_show'] != $data['is_show']) {
$this->m_office_room->editData(['is_show'=> $data['is_show']], $data['id']);
}
}
} catch (\Exception $e) {
$result['msg'] = $e->getMessage();
}
return $result;
}
}
\ No newline at end of file
......@@ -37,7 +37,7 @@ class OfficeBuildingRoomValidate extends Validate
'carport' => 'require|length:1,255',
'rent_free' => 'require|length:-1,99',
'source' => 'require|in:0,1,2,3,4,5,6,7',
// 'is_show' => 'require|in:0,1',
'is_show' => 'require|in:0,1',
'decoration' => 'require|in:1,2,3,4',
'shop_sign' => 'require|length:1,255',
'landlord_phone' => 'require',
......@@ -90,8 +90,8 @@ class OfficeBuildingRoomValidate extends Validate
'rent_free.length' => '免租时间要在1至99个字',
'source.require' => '来源为必填',
'source.length' => '来源参数错误',
// 'is_show.require'=>'是否对客户展示必填',
// 'is_show.between'=>'是否对客户展示参数错误',
'is_show.require'=>'是否对客户展示必填',
'is_show.between'=>'是否对客户展示参数错误',
'decoration.require' => '交付装修必填',
'decoration.between' => '交付装修参数错误',
'shop_sign.require' => '商铺标签为必填',
......@@ -117,6 +117,7 @@ class OfficeBuildingRoomValidate extends Validate
'detail' => ['id'],
'is_carefully_chosen' => ['id', 'is_carefully_chosen'],
'exclusive' => ['agent_start_time,agent_end_time,is_exclusive_type,id'],
'del'=>['id']
'del'=>['id'],
'show' => 'id,is_show'
];
}
\ No newline at end of file
......@@ -1041,6 +1041,7 @@ Route::group('office_index', [
'addExclusive' => ['index/OfficeRoom/editExclusive', ['method' => 'POST']], //添加楼盘独家
'getExclusive' => ['index/OfficeRoom/getExclusive', ['method' => 'get']], //获取楼盘独家
'del' => ['index/OfficeRoom/del', ['method' => 'POST']], //设置无效房源
'isShow' => ['index/OfficeRoom/isShow', ['method' => 'POST']],//是否对C端显示
]);
Route::group('office_api', [
......
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