Commit 044f9c4b authored by esf's avatar esf

合并分支 'uc_08' 到 'master'

Uc 08

查看合并请求 !7
parents 294e467d 0f7e2590
......@@ -8,6 +8,7 @@ class zsb_api_model extends MY_Model{
private $apiVersion = '1.0.1';// 访问API使用的公用版本号
private $token = 'ZSB_API';
private $host_preview = 'http://newrenttest.house365.com';
private $signKey = '63DBC5C8E29B1D75AC8CE2676FE7C5F3AABED64B';
private $apiUrl = array(
......@@ -27,6 +28,10 @@ class zsb_api_model extends MY_Model{
'uploadPic' => '/ajax-action/upload-file', // 上传图片接口
'login_qr_code' => '/zsbapinj/qr-code-login/login-qr-code', // 登录二维码
'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', // 更新经纪人信息
'change_uc_phone' => '/zsbapi/broker/change-uc-phone', // 更改经纪人手机号码
);
......@@ -167,5 +172,27 @@ class zsb_api_model extends MY_Model{
return $token;
}
/**
* 生成sign
* @param array $param
* @return string
* @author mellon
*/
public function getSign($param = array())
{
if (!is_array($param)) {
return '';
}
ksort($param);
foreach ($param as $key => $item) {
if (!empty($item) && !is_array($item)) {
$newArr[] = $key.'='.$item;
}
}
$stringA = implode("&", $newArr);
$stringSignTemp = $stringA."&key=".$this->signKey;
$stringSignTemp = md5($stringSignTemp);
$sign = sha1($stringSignTemp);
return $sign;
}
}
\ No newline at end of file
......@@ -1319,10 +1319,16 @@ class Ajax extends MY_Controller {
if(!$is_expire){
$message_flag = 2;
}else{
// 调用用户中心更新密码
$ucRes = $this->broker_model->updateUcPwd($lastst_sms['rowid'], '111111');
if ($ucRes['result'] != 1) {
$message_flag = 1;
} else {
$this->broker_model->update_broker_pwd($lastst_sms['rowid']);
$this->broker_model->update_sms_flag($lastst_sms['id']);
$message_flag = 3;
}
}
}else{
$message_flag = 1;
}
......
......@@ -403,6 +403,17 @@ class Login extends MY_Controller {
}
$username = addslashes($username);
// 调用用户中心校验用户名和密码
$this->load->model('zsb_api_model');// 租售宝API调用类
$ucParams = array(
'username' => $username,
'password' => $password,
'city' => GB_CITY,
);
$ucRes = $this->zsb_api_model->getRequrstData('uc_login', $ucParams);
if ($ucRes['result'] == 0) {
die($ucRes['msg']);
}
//判断账号密码正确性
$uid = $this->broker_model->login($username, $password);
......@@ -500,6 +511,12 @@ class Login extends MY_Controller {
} else {
// 如果APP已确认登录
if ($data['login_check'] && $data['username']) {
// 用户中心扫码校验
$scanRes = $this->zsb_api_model->getRequrstData('scan_login', $params);
if($scanRes['result'] == 0){
$response = array('msg' => 'expired');
echo json_encode($response);exit;
}
$sellUserName = isset($sessionUserData['sell']['username']) ? $sessionUserData['sell']['username'] : '';
$rentUserName = isset($sessionUserData['rent']['username']) ? $sessionUserData['rent']['username'] : '';
// 已经写入session
......
......@@ -422,66 +422,80 @@ 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 == ""){
if ($newphone == "") {
echo "0";
exit;
}
if($newphone == $oldphone){
if ($newphone == $oldphone) {
echo "2";
exit;
}
if(!$phonecode || !preg_match("/^\\d{6}$/", $phonecode)) {
echo "3";exit;
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);
$row = $this->broker_model->get_certifycode($session_info['uid'], $newphone);
if(empty($row)){
if (empty($row)) {
echo "5";//验证码过期
exit;
}
if($phonecode != $row["validcode"]){
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));
echo "3";
exit;
} else if ($newphone != $row["mobile"]) {
echo "5";
exit;
} else {
if($flag){
// 调用用户中心修改手机号码
$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->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->update_session_info($session_info, 'telno', $newphone);
echo "1";
exit;
} else {
echo "6";
exit;
}
}
}
......@@ -489,23 +503,24 @@ class ucenter_information extends MY_Controller{
}
//修改登录密码
public function save_pwd(){
public function save_pwd()
{
$session_info = $this->broker_model->get_user_session();
$oldpwd = $this->input->post('oldpwd',TRUE);
$newpwd = $this->input->post('newpwd',TRUE);
$newpwd2 = $this->input->post('newpwd2',TRUE);
$oldpwd = $this->input->post('oldpwd', true);
$newpwd = $this->input->post('newpwd', true);
$newpwd2 = $this->input->post('newpwd2', true);
if($oldpwd == ""){
if ($oldpwd == "") {
echo "2";
exit;
}
if($newpwd == ""){
if ($newpwd == "") {
echo "3";
exit;
}
if($newpwd != $newpwd2){
if ($newpwd != $newpwd2) {
echo "4";
exit;
}
......@@ -516,22 +531,22 @@ class ucenter_information extends MY_Controller{
$broker_info = $this->broker_model->get_broker_detail(false);
$oldpwd = $broker_info['password'];
if($oldpassword == $oldpwd){
$flag = $this->broker_model->set_broker_info($session_info['uid'],array("password"=>$newpassword));
if($flag){
if ($oldpassword == $oldpwd) {
// 调用用户中心更新
$flag = false;
$ucRes = $this->broker_model->updateUcPwd($session_info['uid'], $newpwd);
if ($ucRes['result'] == 1) {
$flag = $this->broker_model->set_broker_info($session_info['uid'], array("password" => $newpassword));
}
if ($flag) {
echo "1";
$this->broker_model->saveChangePasswordLog($newpassword, $broker_info['uid'], $broker_info['username']);
}else{
} else {
echo "2";
}
}
else{
} else {
echo "2";
}
exit;
}
......
......@@ -1450,6 +1450,44 @@ class Broker_model extends Broker_base_model {
return 'success';
}
/**
* 更新用户中心的密码
* @param $uid
* @param $password
* @return mixed
* @author mellon
*/
public function updateUcPwd($uid, $password)
{
// 调用用户中心更新
$this->load->model('zsb_api_model');// 租售宝API调用类
$ucParams = array(
'brokerId' => $uid,
'password' => $password,
'city' => GB_CITY,
);
$ucParams['sign'] = $this->zsb_api_model->getSign($ucParams);
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