UserController.php 847 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. namespace addons\SmartForm\api\modules\v1\controllers\user;
  3. use addons\SmartForm\common\models\Region;
  4. use api\controllers\OnAuthController;
  5. /**
  6. * 用户控制器
  7. *
  8. * Class UserController
  9. * @package addons\SmartForm\api\modules\v1\controllers\user
  10. */
  11. class UserController extends OnAuthController
  12. {
  13. public $modelClass = '';
  14. /**
  15. * 不用进行登录验证的方法
  16. * 例如: ['index', 'update', 'create', 'view', 'delete']
  17. * 默认全部需要验证
  18. *
  19. * @var array
  20. */
  21. protected $authOptional = ['address-info'];
  22. /**
  23. * 获取省市区数据
  24. * @return \yii\web\Response
  25. */
  26. public function actionAddressInfo()
  27. {
  28. $list = Region::getRegionList([['<>', 'parent_id', -1]], 'id,name,parent_id,level', [], 1);
  29. return $this->success('ok', $list);
  30. }
  31. }