// +---------------------------------------------------------------------- // +---------------------------------------------------------------------- // | 会员组模型 // +---------------------------------------------------------------------- namespace app\admin\model\member; use think\Model; class MemberGroup extends Model { protected $auto = ['allowvisit' => 1, 'status' => 1]; protected $insert = ['issystem' => 0]; protected static function init() { self::afterWrite(function ($row) { cache('Member_Group', null); }); self::beforeDelete(function ($row) { if ($row['issystem']) { throw new \Exception('系统用户组[' . $row['name'] . ']不能删除!'); } }); self::afterDelete(function ($row) { cache('Member_Group', null); }); } }