控制台应用,yzncms本身基于tp5.1框架,里面的队列用不了,bug,坑
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

MemberGroup.php 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | Yzncms [ 御宅男工作室 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2018 http://yzncms.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
  8. // +----------------------------------------------------------------------
  9. // | Author: 御宅男 <530765310@qq.com>
  10. // +----------------------------------------------------------------------
  11. // +----------------------------------------------------------------------
  12. // | 会员组模型
  13. // +----------------------------------------------------------------------
  14. namespace app\admin\model\member;
  15. use think\Model;
  16. class MemberGroup extends Model
  17. {
  18. protected $auto = ['allowvisit' => 1, 'status' => 1];
  19. protected $insert = ['issystem' => 0];
  20. protected static function init()
  21. {
  22. self::afterWrite(function ($row) {
  23. cache('Member_Group', null);
  24. });
  25. self::beforeDelete(function ($row) {
  26. if ($row['issystem']) {
  27. throw new \Exception('系统用户组[' . $row['name'] . ']不能删除!');
  28. }
  29. });
  30. self::afterDelete(function ($row) {
  31. cache('Member_Group', null);
  32. });
  33. }
  34. }