Commit fdf9309a authored by hujun's avatar hujun

经纪人与楼盘关系优化

parent ece4eafb
...@@ -535,7 +535,7 @@ class Houses extends Basic ...@@ -535,7 +535,7 @@ class Houses extends Basic
*/ */
public function editExclusive() public function editExclusive()
{ {
if (empty($this->params['house_id']) || empty($this->params['exclusive_id'])) { if (empty($this->params['houses_id']) || empty($this->params['exclusive_id'])) {
return $this->response(101, '参数错误'); return $this->response(101, '参数错误');
} }
......
...@@ -436,7 +436,6 @@ class HouseService ...@@ -436,7 +436,6 @@ class HouseService
try { try {
$records = new GOperatingRecords(); $records = new GOperatingRecords();
$sum = new ResultsSummaryNewTask();
$count = 0; $count = 0;
$save_data = $del_agent_name = $del_agent_id = []; $save_data = $del_agent_name = $del_agent_id = [];
$agent_id_arr = array_unique(explode(',', $agent_id_string)); $agent_id_arr = array_unique(explode(',', $agent_id_string));
...@@ -471,6 +470,7 @@ class HouseService ...@@ -471,6 +470,7 @@ class HouseService
$this->agent_house->updateUserAll($save_data); $this->agent_house->updateUserAll($save_data);
if ($type == 2) { if ($type == 2) {
$sum = new ResultsSummaryNewTask();
//记录 //记录
$remark = ''; $remark = '';
if ($del_agent_name) { if ($del_agent_name) {
......
...@@ -821,10 +821,12 @@ class GHouses extends BaseModel ...@@ -821,10 +821,12 @@ class GHouses extends BaseModel
$ext_result = $ext->save($update_data, [ 'house_id' => $data['houses_id'] ]); $ext_result = $ext->save($update_data, [ 'house_id' => $data['houses_id'] ]);
$house_img = new GHousesImgs(); $house_img = new GHousesImgs();
$house_img->editExclusiveImg($data, $house_id); // $house_img->editExclusiveImg($data, $house_id);
$house_img->editV2($data['exclusive_img'], $house_id, 4);
$agents = new GHousesToAgents(); $agents = new GHousesToAgents();
$agents->addAgents($data['exclusive_id'], $house_id, 3, $operation_id, $site_id); // $agents->addAgents($data['exclusive_id'], $house_id, 3, $operation_id, $site_id);
$agents->addAgentV2($data['exclusive_id'], $house_id, 3);
$m_house_file = new GHouseFile(); $m_house_file = new GHouseFile();
......
...@@ -137,6 +137,54 @@ class GHousesToAgents extends BaseModel ...@@ -137,6 +137,54 @@ class GHousesToAgents extends BaseModel
return $res; return $res;
} }
/**
* 处理经纪人与楼盘关系
* $type 类型:"场权限人:1,盘方:2,独家:3
*
* @param $agent_id_string
* @param $house_id
* @param $type
* @return bool
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function addAgentV2($agent_id_string, $house_id, $type) {
if (empty($agent_id_string)) {
return false;
}
$agent_id_arr = array_unique(explode(',', $agent_id_string));
$save_data = [];
$agent_house_where['a.is_del'] = 0;
$agent_house_where['a.houses_id'] = $house_id;
$agent_house_where['a.type'] = $type;
$agent_data_old = $this->getAgentsByHouseId('a.id,a.agents_id,a.houses_id,b.name', $agent_house_where);
$count = 0;
foreach ($agent_data_old as $v) {
if (in_array($v['agents_id'], $agent_id_arr)) {
$key = array_search($v['agents_id'], $agent_id_arr);
if ($key !== false) {
unset($agent_id_arr[$key]);
}
} else {
$save_data[$count]['id'] = $v['id'];
$save_data[$count]['is_del'] = 1;
$count++;
}
}
foreach ($agent_id_arr as $val) {
$save_data[$count]['agents_id'] = $val;
$save_data[$count]['houses_id'] = $house_id;
$save_data[$count]['type'] = $type;
$count++;
}
$this->saveAll($save_data);
}
/** /**
* 新增经纪人和楼盘关系 * 新增经纪人和楼盘关系
* *
......
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