UserController.php 818 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. /**
  3. * Created by IntelliJ IDEA.
  4. * User: solu
  5. * Date: 2019/3/8
  6. * Time: 3:08 PM
  7. */
  8. class UserController extends BaseController {
  9. /**
  10. * 获取授权地址
  11. * @author solu
  12. * @param $args
  13. * @return string
  14. */
  15. public function actionGetAuthUrl($args) {
  16. $rules = [];
  17. Param::checkParam2($rules, $args);
  18. return ThirdApi::getAuthUrl(SITE_URL . 'user/authCallback');
  19. }
  20. /**
  21. * 用户授权回调
  22. * @author solu
  23. * @param $args
  24. * @return array
  25. */
  26. public function actionAuthCallback($args) {
  27. $rules = [
  28. 'user_id' => ['int', 'desc' => '用户id'],
  29. 'access_token' => ['string', 'desc' => 'access_token'],
  30. ];
  31. Param::checkParam2($rules, $args);
  32. return User::getInfo();
  33. }
  34. }