Commit 19581628 authored by hujun's avatar hujun

批量修改独家方

parent ec0a2596
...@@ -160,4 +160,25 @@ class OfficeRoom extends Basic ...@@ -160,4 +160,25 @@ class OfficeRoom extends Basic
} }
return $this->response($code, $msg, $data); return $this->response($code, $msg, $data);
} }
/**
* 批量修改独家方
*
* @return \think\Response
*/
public function batchChangDish()
{
$code = 200;
$msg = '';
$data = [];
$result = $this->service->batchChangDish($this->params['old_agents_id'], $this->params['agents_id'], $this->userId);
if ($result['status'] == 'successful') {
$data = $result['data'];
} else {
$code = 101;
$msg = $result['msg'];
}
return $this->response($code, $msg, $data);
}
} }
\ No newline at end of file
...@@ -35,6 +35,7 @@ class OfficeRoomService ...@@ -35,6 +35,7 @@ class OfficeRoomService
private $landlord_phone; private $landlord_phone;
private $internet_path; private $internet_path;
private $m_building_stations; private $m_building_stations;
private $redis_service;
public function __construct() public function __construct()
...@@ -47,7 +48,7 @@ class OfficeRoomService ...@@ -47,7 +48,7 @@ class OfficeRoomService
$this->agent_room = new OfficeGRoomToAgent(); $this->agent_room = new OfficeGRoomToAgent();
$this->landlord_phone = new OfficeGLandlordPhone(); $this->landlord_phone = new OfficeGLandlordPhone();
$this->m_building_stations = new OfficeGBuildingStations(); $this->m_building_stations = new OfficeGBuildingStations();
$this->redis_service = new RedisCacheService();
if (CURRENT_URL == 'https://api.tonglianjituan.com/') { if (CURRENT_URL == 'https://api.tonglianjituan.com/') {
$this->internet_path = IMAGES_URL.'/resource/lib/Attachments/images/'; $this->internet_path = IMAGES_URL.'/resource/lib/Attachments/images/';
...@@ -747,8 +748,7 @@ class OfficeRoomService ...@@ -747,8 +748,7 @@ class OfficeRoomService
//获取上传人信息 //获取上传人信息
public function getUploadInfo($agent_id){ public function getUploadInfo($agent_id){
$agent = []; $agent = [];
$redis_service = new RedisCacheService(); $res = $this->redis_service->getRedisCache(2, $agent_id);
$res = $redis_service->getRedisCache(2, $agent_id);
if($res){ if($res){
$agent['name'] = $res['name']; $agent['name'] = $res['name'];
$agent['phone'] = $res['phone']; $agent['phone'] = $res['phone'];
...@@ -1052,4 +1052,53 @@ class OfficeRoomService ...@@ -1052,4 +1052,53 @@ class OfficeRoomService
return $result; return $result;
} }
/**
* 批量修改独家方
*
* @param $old_agents_id
* @param $agents_id
* @param $operation_id
* @return mixed
*/
public function batchChangDish($old_agents_id, $agents_id, $operation_id)
{
$result['status'] = 'fail';
$result['msg'] = '盘方信息错误';
if (empty($old_agents_id) || empty($agents_id)) {
return $result;
}
$where['type'] = 2;
$where['b.id'] = $old_agents_id;
try {
$agent_house = $this->agent_room->getAgentsByRoomId('a.id,a.house_id', $where);
if ($agent_house) {
$agent_data_arr = [];
foreach ($agent_house as $k => $v) {
$agent_data_arr[$k]['id'] = $v['id'];
$agent_data_arr[$k]['agents_id'] = $agents_id;
}
}
if (isset($agent_data_arr)) {
$total = $this->agent_room->updateDataAll($agent_data_arr);
$m_operating = new OfficeGOperatingRecord();
foreach ($agent_house as $k => $v) {
$agent_data = $this->redis_service->getRedisCache(2, $agents_id);
$remark = '批量修改盘方方为' . $agent_data['name'] . '-' . $agent_data['phone'];
$m_operating->record($operation_id, 2, $remark, $v['houses_id'], $v['id']);
}
$result['msg'] = '修改' . $total . '条记录';
$result['status'] = 'successful';
} else {
$result['msg'] = '无修改内容';
}
} catch (\Exception $e) {
$result['msg'] = $e->getMessage();
}
return $result;
}
} }
\ No newline at end of file
...@@ -1001,7 +1001,7 @@ Route::group('office_index', [ ...@@ -1001,7 +1001,7 @@ Route::group('office_index', [
'houseEdit' => ['index/OfficeRoom/edit', ['method' => 'POST|GET']],//楼盘字典新增和编辑 'houseEdit' => ['index/OfficeRoom/edit', ['method' => 'POST|GET']],//楼盘字典新增和编辑
'houseAdd' => ['index/OfficeRoom/edit', ['method' => 'POST|GET']],//楼盘字典新增和编辑 'houseAdd' => ['index/OfficeRoom/edit', ['method' => 'POST|GET']],//楼盘字典新增和编辑
'getRecords' => ['index/OfficeRoom/getRecords', ['method' => 'GET']],//盘方操作记录 'getRecords' => ['index/OfficeRoom/getRecords', ['method' => 'GET']],//盘方操作记录
'batchChangDish' => ['index/OfficeRoom/batchChangDish', ['method' => 'post']],//批量修改盘方
]); ]);
Route::group('office_api', [ 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