BaseAuthorized.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. namespace app\admin\controller;
  3. use app\middleware\AutoResult;
  4. use app\common\service\IoService;
  5. use app\common\middleware\WriteLog;
  6. use app\common\service\GoodService;
  7. use app\common\service\RepoService;
  8. use app\common\service\StockService;
  9. use app\common\service\IoDetailService;
  10. use app\common\exception\CatchException;
  11. use app\common\service\GoodClassService;
  12. use app\common\service\AllocationService;
  13. use app\admin\middleware\CheckPermissionAttr;
  14. /**
  15. * 需要登录 的基类
  16. * Class AuthBase
  17. * @package app\api\controller
  18. */
  19. class BaseAuthorized extends Base
  20. {
  21. protected $middleware = [CheckPermissionAttr::class, AutoResult::class, WriteLog::class];
  22. protected $checkTokenOpen = true;
  23. public function IoService(): IoService
  24. {
  25. return (new IoService($this->app))->exceptionClass(CatchException::class);
  26. }
  27. public function IoDetailService(): IoDetailService
  28. {
  29. return (new IoDetailService($this->app))->exceptionClass(CatchException::class);
  30. }
  31. public function GoodClassService(): GoodClassService
  32. {
  33. return (new GoodClassService($this->app))->exceptionClass(CatchException::class);
  34. }
  35. public function GoodService(): GoodService
  36. {
  37. return (new GoodService($this->app))->exceptionClass(CatchException::class);
  38. }
  39. public function RepoService(): RepoService
  40. {
  41. return (new RepoService($this->app))->exceptionClass(CatchException::class);
  42. }
  43. public function StockService(): StockService
  44. {
  45. return (new StockService($this->app))->exceptionClass(CatchException::class);
  46. }
  47. public function AllocationService(): AllocationService
  48. {
  49. return (new AllocationService($this->app))->exceptionClass(CatchException::class);
  50. }
  51. }