Merge commit 'acd428f57bceb73ddc770cc6b59f8be7a237af90'

This commit is contained in:
mzl
2025-07-14 10:08:29 +08:00
parent 925c5501f7
commit 72878f49ea
9 changed files with 159 additions and 6 deletions
+1 -1
View File
@@ -53,6 +53,6 @@ class Role extends Model
// 角色拥有的资源(权限点、菜单)
public function resources()
{
return $this->belongsToMany(Resource::class, 'role_resources', 'role_id', 'resource_id');
return $this->belongsToMany(Resource::class, 'role_resources', 'role_id', 'resource_id')->orderBy('sort', 'asc');
}
}
+1 -1
View File
@@ -75,7 +75,7 @@ class User extends Model
// 用户直接拥有的资源(用于特殊补权)
public function resources()
{
return $this->belongsToMany(Resource::class, 'user_resources', 'user_id', 'resource_id');
return $this->belongsToMany(Resource::class, 'user_resources', 'user_id', 'resource_id')->orderBy('sort', 'asc');
}
// 用户可访问的系统
+47
View File
@@ -0,0 +1,47 @@
<?php
namespace app\common\model;
use support\Model;
/**
* user_roles 用户-角色关联
* @property integer $user_id 用户ID(主键)
* @property integer $role_id 角色ID(主键)
*/
class UserRoles extends Model
{
/**
* The connection name for the model.
*
* @var string|null
*/
protected $connection = 'mysql';
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'user_roles';
/**
* The primary key associated with the table.
*
* @var string
*/
protected $primaryKey = null;
/**
* Indicates if the model should be timestamped.
*
* @var bool
*/
public $timestamps = false;
protected $fillable = [
'user_id',
'role_id'
];
}
+53
View File
@@ -0,0 +1,53 @@
<?php
namespace app\common\model;
use support\Model;
/**
* user_systems 用户-系统关联表:描述用户可访问哪些系统
* @property integer $user_id 用户ID(主键)
* @property integer $system_id 系统ID(主键)
* @property integer $created_at 创建时间
*/
class UserSystems extends Model
{
/**
* The connection name for the model.
*
* @var string|null
*/
protected $connection = 'mysql';
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'user_systems';
/**
* The primary key associated with the table.
*
* @var string
*/
protected $primaryKey = null;
/**
* Indicates if the model should be timestamped.
*
* @var bool
*/
public $timestamps = false;
// protected $dateFormat = 'U';
// const UPDATED_AT = false;
protected $fillable = [
'user_id',
'system_id',
'created_at'
];
}