TriggerService.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | EasyAdmin
  4. // +----------------------------------------------------------------------
  5. // | PHP交流群: 763822524
  6. // +----------------------------------------------------------------------
  7. // | 开源协议 https://mit-license.org
  8. // +----------------------------------------------------------------------
  9. // | github开源项目:https://github.com/zhongshaofa/EasyAdmin
  10. // +----------------------------------------------------------------------
  11. namespace app\admin\service;
  12. use think\facade\Cache;
  13. class TriggerService
  14. {
  15. /**
  16. * 更新菜单缓存
  17. * @param null $adminId
  18. * @return bool
  19. */
  20. public static function updateMenu($adminId = null)
  21. {
  22. if(empty($adminId)){
  23. Cache::tag('initAdmin')->clear();
  24. }else{
  25. Cache::delete('initAdmin_' . $adminId);
  26. }
  27. return true;
  28. }
  29. /**
  30. * 更新节点缓存
  31. * @param null $adminId
  32. * @return bool
  33. */
  34. public static function updateNode($adminId = null)
  35. {
  36. if(empty($adminId)){
  37. Cache::tag('authNode')->clear();
  38. }else{
  39. Cache::delete('allAuthNode_' . $adminId);
  40. }
  41. return true;
  42. }
  43. /**
  44. * 更新系统设置缓存
  45. * @return bool
  46. */
  47. public static function updateSysconfig()
  48. {
  49. Cache::tag('sysconfig')->clear();
  50. return true;
  51. }
  52. }