| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- <?php
- /**
- * 重庆赤晓店信息科技有限公司
- * https://www.chixiaodian.com
- * Copyright (c) 2023 赤店商城 All rights reserved.
- */
- namespace app\modules\alliance\controllers;
- use app\modules\alliance\controllers\BaseController;
- use app\modules\alliance\models\AuthLoginForm;
- use app\modules\alliance\models\LoginForm;
- use yii\base\BaseObject;
- class PassportController extends BaseController
- {
- /**
- * 平台小程序手机号登录(平台个人中心,店铺个人中心)
- */
- public function actionPlatformAuthPhone()
- {
- $form = new AuthLoginForm();
- $form->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' => '参数不正确']);
- }
- }
- }
|