AccountAction::doBindingMobile PHP Method

doBindingMobile() public method

手机绑定设置
Author: Medz Seven ([email protected])
public doBindingMobile ( )
    public function doBindingMobile()
    {
        $phone = floatval($_POST['mobile']);
        $code = intval($_POST['mobile_code']);
        /* # 检查用户是否不可以更改为当前手机号码 */
        if (!model('User')->isChangePhone($phone, $this->mid)) {
            $this->ajaxReturn(null, '当前手机号码不能用于绑定', 0);
            /* # 检查验证码是否不正确 */
        } elseif ($sms = model('Sms') and !$sms->CheckCaptcha($phone, $code)) {
            $this->ajaxReturn(null, $sms->getMessage(), 0);
            /* # 验证是否修改成功 */
        } elseif (model('User')->where('`uid` = ' . $this->mid)->setField('phone', $phone)) {
            model('User')->cleanCache($this->mid);
            $this->ajaxReturn(null, '设置成功', 1);
        }
        $this->ajaxReturn(null, '设置失败', 0);
    }