Commit 5c097a4a authored by hujun's avatar hujun

经纪人转勤2

parent 2b304c21
...@@ -35,6 +35,9 @@ class BrokerService ...@@ -35,6 +35,9 @@ class BrokerService
* @param array $data * @param array $data
* @param int $operation_id * @param int $operation_id
* @return mixed * @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/ */
public function saveAgentData(array $data, int $operation_id) public function saveAgentData(array $data, int $operation_id)
{ {
...@@ -67,14 +70,14 @@ class BrokerService ...@@ -67,14 +70,14 @@ class BrokerService
$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)) { if (!empty($agent_old[0]['id'])) {
$result['msg'] = '转勤'; $result['msg'] = '转勤';
return $result; return $result;
} }
} else { } else {
$num = $this->m_agent->updateData($agent_old['id'], ['status' => 3]); //更新原始账号状态 $num = $this->m_agent->updateData($agent_old[0]['id'], ['status' => 3]); //更新原始账号状态
if ($num > 0) { if ($num > 0) {
$change_old_id = $agent_old['id']; $change_old_id = $agent_old[0]['id'];
} }
} }
...@@ -136,7 +139,7 @@ class BrokerService ...@@ -136,7 +139,7 @@ class BrokerService
$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;
$m_records->insertData($data); $m_records->insertData($record_data);
if (!empty($update_user)) { if (!empty($update_user)) {
$m_user->updateUserAll($update_user); $m_user->updateUserAll($update_user);
......
...@@ -33,6 +33,6 @@ class AOperatingRecords extends BaseModel ...@@ -33,6 +33,6 @@ class AOperatingRecords extends BaseModel
$save_data['user_id'] = $data['user_id']; $save_data['user_id'] = $data['user_id'];
$save_data['type'] = $data['type']; $save_data['type'] = $data['type'];
$save_data['operation_id'] = $data['operation_id']; $save_data['operation_id'] = $data['operation_id'];
return $this->inset($save_data); return $this->insert($save_data);
} }
} }
\ No newline at end of file
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