ApiBaseController.php 730 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. /**
  3. * @Created by PhpStorm
  4. * @author: Kirin
  5. * @day: 2024/11/20
  6. * @time: 11:24
  7. */
  8. namespace app\common;
  9. use app\Request;
  10. use qiniu\basic\BaseController;
  11. abstract class ApiBaseController extends BaseController
  12. {
  13. /**
  14. * 当前登陆用户信息
  15. * @var
  16. */
  17. protected $userInfo;
  18. /**
  19. * 当前登陆用户ID
  20. * @var
  21. */
  22. protected $uid;
  23. protected $service = null;
  24. /**
  25. * 初始化
  26. */
  27. public function __construct(Request $request)
  28. {
  29. parent::__construct($request);
  30. $this->initialize();
  31. }
  32. protected function initialize()
  33. {
  34. $this->uid = $this->request->uid();
  35. $this->userInfo = $this->request->user();
  36. }
  37. }