Commit 616b73b4 authored by hujun's avatar hujun

房东手机号修改记录

parent 4a41b079
...@@ -105,7 +105,7 @@ class HouseService ...@@ -105,7 +105,7 @@ class HouseService
} }
if (!empty($data['id'])) { if (!empty($data['id'])) {
$house_data = $this->m_house->getHouseInfo('id,internal_address,internal_title', ['id' => $data['id']]); $house_data = $this->m_house->getHouseInfo('id,internal_address,internal_title,shop_area_start', ['id' => $data['id']]);
if (empty($house_data[0]['id'])) { if (empty($house_data[0]['id'])) {
$result['status'] = 'fail'; $result['status'] = 'fail';
$result['msg'] = '没有该商铺信息'; $result['msg'] = '没有该商铺信息';
...@@ -131,15 +131,19 @@ class HouseService ...@@ -131,15 +131,19 @@ class HouseService
} }
if (!empty($landlord_phone_new)) { if (!empty($landlord_phone_new)) {
$landlord_phone_old = $this->landlordPhoneEdit($landlord_phone_new, $data['id']); $landlord_phone_old = $this->landlordPhoneEditV2($landlord_phone_new, $data['id']);
if (!empty($landlord_phone_old)) { if (!empty($landlord_phone_old)) {
$remark .= ',删除房东手机号:' . implode(',', $landlord_phone_old); $remark .= implode(',', $landlord_phone_old);
} }
} }
if (!empty($data['shop_area_start']) && $data['shop_area_start'] != $house_data[0]['shop_area_start']) {
$remark .= ',街铺面积:'.$house_data[0]['shop_area_start'].'修改为'.$data['shop_area_start'];
}
var_dump($landlord_phone_old);die;
$m_operating->record($agent_id, 6, $remark, $data['id']); $m_operating->record($agent_id, 6, $remark, $data['id']);
die('11111');
if (empty($data['is_exclusive_type'])) { if (empty($data['is_exclusive_type'])) {
$this->delAgentHouse(3, $data['id'], 0); $this->delAgentHouse(3, $data['id'], 0);
unset($data['exclusive_ids']); unset($data['exclusive_ids']);
...@@ -224,18 +228,6 @@ class HouseService ...@@ -224,18 +228,6 @@ class HouseService
} }
} }
// if (empty($data['id'])) {
// $house_img->add($data, $house_id); //只记录新增图片
// } else {
// $image_result = $house_img->edit($data, $house_id); //编辑图片
//
// if ($image_result['status'] == 'fail') {
// $result['status'] = 'fail';
// $result['msg'] = '编辑图片失败,' . $validate->getError();
// return $result;
// }
// }
//案场权限人 //案场权限人
if (!empty($data['agent_data'])) { if (!empty($data['agent_data'])) {
$result_agent_data = $this->releaseRelationshipV2($data['agent_data'], $house_id, 1, $agent_id, $data['internal_title'], $site_id); $result_agent_data = $this->releaseRelationshipV2($data['agent_data'], $house_id, 1, $agent_id, $data['internal_title'], $site_id);
...@@ -691,6 +683,89 @@ class HouseService ...@@ -691,6 +683,89 @@ class HouseService
return $del_phone; return $del_phone;
} }
/**
* 房东手机号处理
*
* @param array $data
* @param $house_id
* @return array 删除的手机号
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public function landlordPhoneEditV2(array $data, $house_id) {
$m_landlord = new GLandlordPhone();
$update_data = $insert_data = $new_phone = $del_phone = $edit_phone = [];
$key = 0;
$old_landlord = $m_landlord->getColumn('id,phone', ['house_id'=>$house_id, 'status'=>0]);
if (empty($old_landlord)) {
//新增
foreach ($data as $k=>$v) {
$insert_data[$k]['name'] = $v['name'];
$insert_data[$k]['phone'] = $v['phone'];
$insert_data[$k]['house_id'] = $house_id;
$edit_phone[] = '新增房东手机号:'. substr_replace($v['phone'], '****', 3, 4);
}
} else {
//新增与编辑
foreach ($data as $k=>$v) {
if ($v['id']) {
$phone = $old_landlord[$v['id']];
$update_data[$key]['id'] = $v['id'];
$update_data[$key]['name'] = $v['name'];
if ($phone != $v['phone']) {
$update_data[$k]['phone'] = $v['phone'];
$edit_phone[] = substr_replace($phone, '****', 3, 4) . '修改为;' . substr_replace($v['phone'], '****', 3, 4);
$new_phone[] = $phone;
}
} else {
//v3.2.1 之后去除update_data
$id = array_search($v['phone'], $old_landlord);
if ($id) {
$update_data[$key]['id'] = $id;
$update_data[$key]['phone'] = $v['phone'];
$update_data[$key]['house_id'] = $house_id;
$update_data[$key]['name'] = $v['name'];
$phone = $old_landlord[$v['id']];
if ($phone != $v['phone']) {
$update_data[$k]['phone'] = $v['phone'];
$edit_phone[] = substr_replace($phone, '****', 3, 4) . '修改为;' . substr_replace($v['phone'], '****', 3, 4);
$new_phone[] = $phone;
$new_phone[] = $old_landlord[$v['id']];
}
} else {
$insert_data[$key]['phone'] = $v['phone'];
$insert_data[$key]['house_id'] = $house_id;
$insert_data[$key]['name'] = $v['name'];
$new_phone[] = $old_landlord[$v['id']];
}
}
$new_phone[] = $v['phone'];
$key++;
}
foreach ($old_landlord as $k2=>$v2) {
if (!in_array($v2, $new_phone)) {
$update_data[$key]['id'] = $k2;
$update_data[$key]['status'] = 1;
$key++;
$edit_phone[] = '删除房东手机号:'.substr_replace($v2, '****', 3, 4) ;
}
}
}
if ($update_data) {
$m_landlord->updateData($update_data);
}
if ($insert_data) {
$m_landlord->insertData($insert_data);
}
return $edit_phone;
}
/** /**
* 获取商铺信息 * 获取商铺信息
* *
......
...@@ -61,6 +61,16 @@ class GLandlordPhone extends BaseModel ...@@ -61,6 +61,16 @@ class GLandlordPhone extends BaseModel
->column($field); ->column($field);
} }
/**
* @param $field
* @param $where
* @return array
*/
public function getValue($field, $where) {
return $this->db_->where($where)
->value($field);
}
/** /**
* @param $data * @param $data
* @return int|string * @return int|string
......
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