attributes = all_params(); $form->store_id = get_store_id(); return $this->asJson($form->platformPhoneAuth()); } /** * 登录 * @return \yii\web\Response * @throws \yii\base\Exception */ public function actionLogin() { $form = new \app\modules\client\models\v1\LoginForm(); $form->scenario = get_params('_platform') ?: post_params('_platform'); $form->attributes = all_params(); $form->store_id = get_store_id(); return $this->asJson($form->login()); } public function actionEditPassword() { $form = new AuthLoginForm(); $form->attributes = all_params(); $form->store_id = get_store_id(); return $this->asJson($form->editPassword()); } public function actionCode() { $form = new AuthLoginForm(); $form->attributes = all_params(); $form->store_id = get_store_id(); return $this->asJson($form->code()); } /** * 发送验证码 * @return \yii\web\Response */ public function actionSendCode() { $form = new LoginForm(); $form->phone = post_params('phone'); $form->store_id = get_store_id(); if (trim(post_params('code_type')) == LoginForm::TYPE_VERIFY_CODE_LOGIN) { return $this->asJson($form->sendCode(LoginForm::CACHE_KEY_SMS_LOGIN)); } else if (trim(post_params('code_type')) == LoginForm::TYPE_VERIFY_CODE_BIND) { return $this->asJson($form->sendCode(LoginForm::CACHE_KEY_BIND_PHONE)); } else { return $this->asJson(['code' => 1, 'msg' => '参数不正确']); } } }