AuthRule.php 911 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // |
  4. // +----------------------------------------------------------------------
  5. // |
  6. // +----------------------------------------------------------------------
  7. // |
  8. // +----------------------------------------------------------------------
  9. // |
  10. // +----------------------------------------------------------------------
  11. // +----------------------------------------------------------------------
  12. // | 权限规则模型
  13. // +----------------------------------------------------------------------
  14. namespace app\admin\Model;
  15. use think\facade\Cache;
  16. use think\Model;
  17. class AuthRule extends Model
  18. {
  19. const RULE_URL = 1;
  20. const RULE_MAIN = 2; //主菜单
  21. // 自动写入时间戳
  22. protected $autoWriteTimestamp = true;
  23. public static function onAfterWrite($row)
  24. {
  25. Cache::delete('__menu__');
  26. }
  27. }