Commit 1e4ef520 authored by hujun's avatar hujun

修改转勤

parent 71996dc8
...@@ -63,11 +63,13 @@ class BrokerService ...@@ -63,11 +63,13 @@ class BrokerService
$agent_data = $this->m_agent->verifyUser('id,phone,password,site_id,district_id', '', $where); $agent_data = $this->m_agent->verifyUser('id,phone,password,site_id,district_id', '', $where);
if (empty($data['id'])) { if (empty($data['id'])) {
if (!empty($agent_data['status']) && $agent_data['status'] == 3) {
$result['msg'] = '该用户已转勤';
}
if (!empty($agent_data)) { if (!empty($agent_data)) {
$result['msg'] = '该用户已存在'; $result['msg'] = '该用户已存在';
return $result; return $result;
} }
$agent_old = $this->m_agent->getAgentById('id', ['phone' => $data['phone'], 'status' => 0]); $agent_old = $this->m_agent->getAgentById('id', ['phone' => $data['phone'], 'status' => 0]);
if (empty($data['confirm_old'])) { if (empty($data['confirm_old'])) {
if (!empty($agent_old[0]['id'])) { if (!empty($agent_old[0]['id'])) {
...@@ -109,7 +111,6 @@ class BrokerService ...@@ -109,7 +111,6 @@ class BrokerService
} }
$id = $this->m_agent->saveAgent($data); $id = $this->m_agent->saveAgent($data);
if ($id > 0) { if ($id > 0) {
$result['status'] = 'successful'; $result['status'] = 'successful';
$result['data'] = ['id' => $id]; $result['data'] = ['id' => $id];
...@@ -124,24 +125,24 @@ class BrokerService ...@@ -124,24 +125,24 @@ class BrokerService
$update_user[$k]['agent_id'] = $id; $update_user[$k]['agent_id'] = $id;
} }
$record_data['user_id'] = empty($user_id_arr) ? "" : explode(',', $user_id_arr); $record_data['user_id'] = empty($user_id_arr) ? "" : implode(',', $user_id_arr);
$m_house = new GHousesToAgents(); $m_house = new GHousesToAgents();
$house_where['is_del'] = 0; $house_where['is_del'] = 0;
$house_where['agents_id'] = $change_old_id; $house_where['agents_id'] = $change_old_id;
$house_where['type'] = ['in', '2,3']; $house_where['type'] = ['in', '2,3'];
$house_id_arr = $m_house->getAgentHouseOne('houses_id', $house_where); $house_id_arr = $m_house->getAgentHouseOne('id', $house_where);
foreach ($house_id_arr as $k=>$v) { foreach ($house_id_arr as $k=>$v) {
$update_house[$k]['houses_id'] = $v; $update_house[$k]['id'] = $v;
$update_house[$k]['agents_id'] = $id; $update_house[$k]['agents_id'] = $id;
} }
$house_id_arr = array_unique($house_id_arr); $house_id_arr = array_unique($house_id_arr);
$record_data['house_id'] = empty($user_id_arr) ? "" : explode(',', $house_id_arr); $record_data['house_id'] = empty($house_id_arr) ? "" : implode(',', $house_id_arr);
$m_records = new AOperatingRecords(); $m_records = new AOperatingRecords();
$record_data['remark'] = '经纪人转勤操作'; $record_data['remark'] = '转勤,旧id:'.$change_old_id;
$record_data['type'] = 0; $record_data['type'] = 0;
$record_data['operation_id'] = $operation_id; $record_data['operation_id'] = $operation_id;
$record_data['agent_id'] = $id; $record_data['agent_id'] = $id;
......
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