Commit 0f7e2590 authored by 梅玉龙's avatar 梅玉龙

对接用户中心登录修改手机号码

parent 265ddf76
......@@ -30,7 +30,8 @@ class zsb_api_model extends MY_Model{
'user_by_qr_code' => '/zsbapinj/qr-code-login/login-qr-code-data', // 校验是否确认登录
'scan_login' => '/zsbapi/qr-code-login/uc-scan-login', // 扫码登录校验
'uc_login' => '/zsbapi/broker/uc-login', // 登录
'uc_update' => '/zsbapi/broker/uc-update', // 更新
'uc_update' => '/zsbapi/broker/uc-update', // 更新经纪人信息
'change_uc_phone' => '/zsbapi/broker/change-uc-phone', // 更改经纪人手机号码
);
......
......@@ -422,70 +422,84 @@ class ucenter_information extends MY_Controller{
//手机信息保存
public function save_phone(){
public function save_phone()
{
$session_info = $this->broker_model->get_user_session();
$newphone = trim($this->input->post('newphone'));
$oldphone = trim($this->input->post('oldphone'));
$phonecode = trim($this->input->post('phonecode'));
if($newphone == ""){
$oldphone = trim($this->input->post('oldphone'));
$phonecode = trim($this->input->post('phonecode'));
if ($newphone == "") {
echo "0";
exit;
}
exit;
}
if($newphone == $oldphone){
if ($newphone == $oldphone) {
echo "2";
exit;
}
exit;
}
if(!$phonecode || !preg_match("/^\\d{6}$/", $phonecode)) {
echo "3";exit;
} else {
if (!$phonecode || !preg_match("/^\\d{6}$/", $phonecode)) {
echo "3";
exit;
} else {
$result = $this->broker_model->change_phone_num($session_info['uid']);
if($result>0){
if ($result > 0) {
echo "4";//一天只能修改一次
exit;
}
$row = $this->broker_model->get_certifycode($session_info['uid'],$newphone);
if(empty($row)){
exit;
}
$row = $this->broker_model->get_certifycode($session_info['uid'], $newphone);
if (empty($row)) {
echo "5";//验证码过期
exit;
}
if($phonecode != $row["validcode"]){
//echo "验证码输入错误";
echo "3";exit;
}elseif($newphone!=$row["mobile"]){
echo "5";exit;
}else{
$flag = $this->broker_model->set_broker_info($session_info['uid'],array("telno"=>$newphone));
if($flag){
exit;
}
if ($phonecode != $row["validcode"]) {
//echo "验证码输入错误";
echo "3";
exit;
} else if ($newphone != $row["mobile"]) {
echo "5";
exit;
} else {
// 调用用户中心修改手机号码
$ucRes = $this->broker_model->changeUcPhone($session_info['uid'], $newphone);
if ($ucRes['result'] == 0) {
echo "6";
exit;
}
$flag = $this->broker_model->set_broker_info($session_info['uid'], array("telno" => $newphone));
if ($flag) {
//修改房源联系号码
$this->load->model('sell_model');
$this->sell_model->update_sell_mobile($session_info['uid'],$newphone);
$this->sell_model->update_sell_mobile($session_info['uid'], $newphone);
$this->load->model('rent_model');
$this->rent_model->update_rent_mobile($session_info['uid'],$newphone);
$this->rent_model->update_rent_mobile($session_info['uid'], $newphone);
//修改验证码状态
$this->broker_model->update_certifycode($row['id']);
$this->broker_model->update_certifycode($row['id']);
//失效名片认证
$this->broker_model->check_certificate($session_info['uid'],'p_3',1,2,'修改手机号码,名片认证失效');
$this->broker_model->set_broker_info($session_info['uid'],array("p_3_pic"=>""));
$this->broker_model->check_certificate($session_info['uid'], 'p_3', 1, 2, '修改手机号码,名片认证失效');
$this->broker_model->set_broker_info($session_info['uid'], array("p_3_pic" => ""));
//$session_info['telno'] = $newphone;
$this->del_broker_cache($session_info['uid']);
// $this->broker_model->reset_user_session(); //可能没用
//$session_key = $this->broker_model->get_appkey();
//$this->session->set_userdata(array($session_key => $session_info));//修改session信息
$this->update_session_info($session_info,'telno',$newphone);
echo "1";exit;
}else{
echo "6";exit;
// $this->broker_model->reset_user_session(); //可能没用
//$session_key = $this->broker_model->get_appkey();
//$this->session->set_userdata(array($session_key => $session_info));//修改session信息
$this->update_session_info($session_info, 'telno', $newphone);
echo "1";
exit;
} else {
echo "6";
exit;
}
}
}
exit;
}
}
exit;
}
//修改登录密码
......
......@@ -1470,6 +1470,24 @@ class Broker_model extends Broker_base_model {
return $this->zsb_api_model->getRequrstData('uc_update', $ucParams);
}
/**
* 更改用户中心手机号码
* @param $uid
* @param $newPhone
* @return mixed
* @author mellon
*/
public function changeUcPhone($uid, $newPhone)
{
// 调用用户中心更新
$this->load->model('zsb_api_model');// 租售宝API调用类
$ucParams = array(
'uid' => $uid,
'phone' => $newPhone,
'city' => GB_CITY,
);
return $this->zsb_api_model->getRequrstData('change_uc_phone', $ucParams);
}
}
/* End of file Broker_model.php */
......
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