hasMany(User::class,'group_id','id'); } /** * 获取用户组 * * @param integer $id * @param boolean $mark * @return void|array * @throws DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException */ public static function ToObtain(int $id = 0, bool $mark = true) { $groupList = system_cache('groupList'); if (empty($groupList)) { $groupList = self::select()->toArray(); system_cache('groupList',$groupList,86400); } return $groupList; } }