| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- <?php
- namespace addons\AvoidTax\api\modules\v1\controllers;
- use addons\AvoidTax\common\service\AuthService;
- use addons\AvoidTax\common\service\UserService;
- use api\controllers\OnAuthController;
- use Yii;
- /**
- * 认证控制器
- *
- * Class AuthController
- * @package addons\AvoidTax\api\modules\v1\controllers
- */
- class AuthController extends OnAuthController
- {
- public $modelClass = '';
- /**
- * 提交认证
- *
- * @return void
- */
- public function actionSubmit()
- {
- if ($this->request->isPost) {
- $post = $this->request->post();
- if (Yii::$app->services->validate->validate($post, [
- [['name', 'id_card', 'mobile'], 'required'],
- ], [
- 'name' => '真实姓名',
- 'id_card' => '身份证',
- 'mobile' => '手机号码',
- ]) === false) {
- return $this->error(Yii::$app->services->validate->getErrorMessage());
- }
- $service = new UserService(['mall_id' => $this->mall_id]);
- return $service->silentSign($this->user_id, $post['name'], $post['mobile'], $post['id_card'])
- ? $this->success('ok')
- : $this->error($service->getError());
- }
- }
- }
|