BaseApiController.php 1.3 KB

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | whitef快速开发前后端分离管理后台(PHP版)
  4. // +----------------------------------------------------------------------
  5. // | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
  6. // | 开源版本可自由商用,可去除界面版权logo
  7. // | gitee下载:https://gitee.com/likeshop_gitee/whitef
  8. // | github下载:https://github.com/likeshop-github/whitef
  9. // | 访问官网:https://www.whitef.cn
  10. // | whitef团队 版权所有 拥有最终解释权
  11. // +----------------------------------------------------------------------
  12. // | author: whitefTeam
  13. // +----------------------------------------------------------------------
  14. namespace app\workerapi\controller;
  15. use app\common\controller\BaseLikeAdminController;
  16. use app\common\enum\AdminTerminalEnum;
  17. class BaseApiController extends BaseLikeAdminController
  18. {
  19. protected int $userId = 0;
  20. protected array $userInfo = [];
  21. public function initialize()
  22. {
  23. $this->request->source = AdminTerminalEnum::Worker;
  24. if (isset($this->request->userInfo) && $this->request->userInfo) {
  25. $this->userInfo = $this->request->userInfo;
  26. $this->userId = $this->request->userInfo['user_id'];
  27. }
  28. }
  29. }