This commit is contained in:
2026-04-28 17:55:09 +08:00
parent 83a1c5ca8a
commit 0817e73dc4
3 changed files with 41 additions and 0 deletions
+20
View File
@@ -85,7 +85,27 @@ var (
)
func updateSysAdminsCash() {
// 查询 admins 用户组的 ID
var adminGroup TabUserGroups
if models.DB.Where("name = ?", "admins").First(&adminGroup).Error != nil {
// admins 组不存在,清空缓存
sysAdmins = []uint{}
return
}
// 查询 admins 组的所有成员
var binds []TabUserGroupBinds
if models.DB.Where("group_id = ?", adminGroup.ID).Find(&binds).Error != nil {
sysAdmins = []uint{}
return
}
// 更新缓存
newAdmins := make([]uint, 0, len(binds))
for _, bind := range binds {
newAdmins = append(newAdmins, bind.UserID)
}
sysAdmins = newAdmins
}
// recordLoginFail 记录登录失败日志,更新连续失败次数
+8
View File
@@ -210,6 +210,14 @@ func ApiWarehouse(r *gin.RouterGroup) {
}
}
// 查重:同层级下 Title 不能重复
// var dupContainer TabWarehouseContainer
// dupQuery := models.DB.Where("title = ? AND parent_id = ? AND deleted_at IS NULL", from.Title, from.ParentID)
// if dupQuery.First(&dupContainer).Error == nil {
// ReturnJson(ctx, "container_title_exist", nil)
// return
// }
color := from.Color
if color == "" {
color = "#3788d9"