m\modules\v1\controllers\IController::actionMobile PHP Method

actionMobile() public method

更换手机号
public actionMobile ( $step = '1' ) : array
return array
    public function actionMobile($step = '1')
    {
        if ($step === '1') {
            $model = new ChangeMobileSendRequestForm();
            if ($model->load(Yii::$app->request->post(), '') && $model->sendMsg()) {
                return ['status' => 'success', 'data' => []];
            } else {
                return ['status' => 'fail', 'data' => ['errors' => $model->getErrors('mobile') ?: [Yii::$app->smser->message]]];
            }
        } elseif ($step === '2') {
            $model = new ChangeMobileForm();
            $model->mobile = Yii::$app->session['mobileChange'];
            // TODO
            if ($model->load(Yii::$app->request->post(), '') && $model->change()) {
                return ['status' => 'success', 'data' => ['mobile' => Yii::$app->user->identity->mobile]];
            } else {
                return ['status' => 'fail', 'data' => ['errors' => $model->getErrors()]];
            }
        } else {
            throw new BadRequestHttpException('参数错误!');
        }
    }