public function do_bind_phone()
{
$phone = t($this->data['phone']);
$userPhone = model('User')->where('`uid` = ' . intval($this->mid))->field('phone')->getField('phone');
if (!model('Register')->isValidPhone($phone, $userPhone)) {
return array('status' => 0, 'msg' => model('Register')->getLastError());
}
$smsDao = model('Sms');
$code = t($this->data['code']);
if (!$smsDao->CheckCaptcha($phone, $code)) {
return array('status' => 0, 'msg' => $smsDao->getMessage());
}
$map['uid'] = $this->mid;
$result = model('User')->where($map)->setField('phone', $phone);
if ($result !== false) {
model('User')->cleanCache($this->mid);
return array('status' => 1, 'msg' => '绑定成功');
} else {
return array('status' => 0, 'msg' => '绑定失败');
}
}