Commit 8598fafc authored by hujun's avatar hujun

修改盘方推送

parent a5391e52
......@@ -31,6 +31,7 @@ class HouseService
$this->house = new GHouses();
$this->agent = new AAgents();
$this->agetn_house = new GHousesToAgents();
$this->push = new PushMessageService();
}
/**
......@@ -88,7 +89,7 @@ class HouseService
//案场权限人
if (isset($data['agent_data'])) {
$result_agent_data = $this->releaseRelationship($data['agent_data'], $house_id, 1);
$result_agent_data = $this->releaseRelationship($data['agent_data'], $house_id, 1, $agent_id);
if ($result_agent_data['status'] == 'fail') {
$result['status'] = 'fail';
......@@ -98,7 +99,7 @@ class HouseService
//盘方
if (isset($data['agent_dish'])) {
$result_agent_dish = $this->releaseRelationship($data['agent_dish'], $house_id, 2);
$result_agent_dish = $this->releaseRelationship($data['agent_dish'], $house_id, 2, $agent_id);
if ($result_agent_dish['status'] == 'fail') {
$result['status'] = 'fail';
$result['msg'] = '新增或编辑盘方失败,' . $result_agent_dish['msg'];
......@@ -107,7 +108,7 @@ class HouseService
//独家方
if (isset($data['exclusive_ids'])) {
$result_exclusive_ids = $this->releaseRelationship($data['exclusive_ids'], $house_id, 3);
$result_exclusive_ids = $this->releaseRelationship($data['exclusive_ids'], $house_id, 3, $agent_id);
if ($result_exclusive_ids['status'] == 'fail') {
$result['status'] = 'fail';
$result['msg'] = '新增或编辑独家方失败,' . $result_exclusive_ids['msg'];
......@@ -117,8 +118,7 @@ class HouseService
if (!empty($data['id'])) {
//剩余商铺为0下架
if (empty($data['residue_num']) || empty($data['total'])) {
$push = new PushMessageService();
$push->record(1, [ 0 => $house_id ], 0, $agent_id); //记录推送信息
$this->push->record(1, [ 0 => $house_id ], 0, $agent_id); //记录推送信息
}
}
......@@ -159,13 +159,16 @@ class HouseService
}
/**
* 处理楼盘与经纪人关系
*
* @param $agent_data
* @param $house_id
* @param $type
* @param $operation_id
* @return bool
* @throws \think\exception\PDOException
*/
public function releaseRelationship($agent_data, $house_id, $type)
public function releaseRelationship($agent_data, $house_id, $type, $operation_id)
{
if (empty($agent_data)) {
return false;
......@@ -219,21 +222,7 @@ class HouseService
//处理盘方
if ($type == 2) {
$records = new GOperatingRecords();
if (!empty($del_agent_id)) {
$del_agent_name = $this->agent->getAgentById('name', [ 'in_id' => implode(',', $del_agent_id) ]);
if (!empty($del_agent_name)) {
//记录删除盘方
foreach ($del_agent_name as $k=>$v) {
$agent_name[] = $v['name'];
}
$remark = '删除盘方:' . implode(',', $agent_name);
$records->record('', 2, $remark, $house_id);
}
}
$agent_name = $del_agent_arr = [];
if (!empty($add_agent_id)) {
//更新业绩统计
$sum = new ResultsSummaryNewTask();
......@@ -246,7 +235,23 @@ class HouseService
}
$remark = '新增盘方:' . implode(',', $agent_name);
$records->record('', 2, $remark, $house_id);
}
if (!empty($del_agent_id)) {
$del_agent_name = $this->agent->getAgentById('name', [ 'in_id' => implode(',', $del_agent_id) ]);
if (!empty($del_agent_name)) {
//记录删除盘方
foreach ($del_agent_name as $k=>$v) {
$del_agent_arr[] = $v['name'];
}
$remark = '删除盘方:' . implode(',', $del_agent_arr);
$records->record('', 2, $remark, $house_id);
$data['message'] = '盘方修改为:'. implode(',', $agent_name);
$this->push->record(2, $house_id, $del_agent_id, $operation_id, $data);
}
}
}
$this->agetn_house->commit();
......
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