BaseAdminDataLists.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | likeadmin快速开发前后端分离管理后台(PHP版)
  4. // +----------------------------------------------------------------------
  5. // | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
  6. // | 开源版本可自由商用,可去除界面版权logo
  7. // | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
  8. // | github下载:https://github.com/likeshop-github/likeadmin
  9. // | 访问官网:https://www.likeadmin.cn
  10. // | likeadmin团队 版权所有 拥有最终解释权
  11. // +----------------------------------------------------------------------
  12. // | author: likeadminTeam
  13. // +----------------------------------------------------------------------
  14. namespace app\adminapi\lists;
  15. use app\common\lists\BaseDataLists;
  16. /**
  17. * 管理员模块数据列表基类
  18. * Class BaseAdminDataLists
  19. * @package app\adminapi\lists
  20. */
  21. abstract class BaseAdminDataLists extends BaseDataLists
  22. {
  23. /**
  24. * 错误信息
  25. * @var string
  26. */
  27. protected static $error;
  28. protected array $adminInfo;
  29. protected int $adminId;
  30. public function __construct()
  31. {
  32. parent::__construct();
  33. $this->adminInfo = $this->request->adminInfo;
  34. $this->adminId = $this->request->adminId;
  35. }
  36. /**
  37. * @notes 获取错误信息
  38. * @return string
  39. * @author 段誉
  40. * @date 2021/7/21 18:23
  41. */
  42. public static function getError() : string
  43. {
  44. if (false === self::hasError()) {
  45. return '系统错误';
  46. }
  47. return self::$error;
  48. }
  49. /**
  50. * @notes 设置错误信息
  51. * @param $error
  52. * @author 段誉
  53. * @date 2021/7/21 18:20
  54. */
  55. public static function setError($error) : void
  56. {
  57. !empty($error) && self::$error = $error;
  58. }
  59. /**
  60. * @notes 是否存在错误
  61. * @return bool
  62. * @author 段誉
  63. * @date 2021/7/21 18:32
  64. */
  65. public static function hasError() : bool
  66. {
  67. return !empty(self::$error);
  68. }
  69. }