This commit is contained in:
2025-05-27 16:32:52 +08:00
parent 231e2350a1
commit ab50cf0dfe
5 changed files with 18 additions and 13 deletions

View File

@ -12,6 +12,7 @@ type MmRiskLogGetPageReq struct {
dto.Pagination `search:"-"`
Content string `form:"content" search:"type:contains;column:content;table:mm_risk_log" comment:"关键字"`
GroupId int `form:"groupId" search:"-"`
Type *int `form:"type" search:"-"`
MmRiskLogOrder
}

View File

@ -128,7 +128,7 @@ func (e *MmKeyword) ReloadMachineCache(isAll bool) {
for _, machineId := range machineIds {
key := fmt.Sprintf(enums.MachineKeywords, machineId)
helper.DefaultRedis.SetStringExpire(key, string(bytes), time.Hour*24)
helper.DefaultRedis.SetStringExpire(key, string(bytes), time.Hour*24*3)
}
}
}

View File

@ -152,8 +152,8 @@ func (e *MmMachine) Insert(c *dto.MmMachineInsertReq) error {
}
}
helper.DefaultRedis.SetStringExpire(key, content, time.Hour*24)
helper.DefaultRedis.SetStringExpire(key2, groupItems, time.Hour*24)
helper.DefaultRedis.SetStringExpire(key, content, time.Hour*24*3)
helper.DefaultRedis.SetStringExpire(key2, groupItems, time.Hour*24*3)
}
return nil
}
@ -217,8 +217,8 @@ func (e *MmMachine) Update(c *dto.MmMachineUpdateReq, p *actions.DataPermission)
}
}
helper.DefaultRedis.SetStringExpire(key, content, time.Hour*24)
helper.DefaultRedis.SetStringExpire(key2, groupItems, time.Hour*24)
helper.DefaultRedis.SetStringExpire(key, content, time.Hour*24*3)
helper.DefaultRedis.SetStringExpire(key2, groupItems, time.Hour*24*3)
}
return err
@ -286,9 +286,9 @@ func (e *MmMachine) UpdateBatch(req *dto.MmMachineUpdateBatchReq, p *actions.Dat
for _, item := range machineIds {
key := fmt.Sprintf(enums.MachineContentKey, item)
if content != "" {
helper.DefaultRedis.SetStringExpire(key, content, time.Hour*24)
helper.DefaultRedis.SetStringExpire(key, content, time.Hour*24*3)
} else {
helper.DefaultRedis.SetStringExpire(key, req.Content, time.Hour*24)
helper.DefaultRedis.SetStringExpire(key, req.Content, time.Hour*24*3)
}
}
case req.Type == 1:
@ -303,9 +303,9 @@ func (e *MmMachine) UpdateBatch(req *dto.MmMachineUpdateBatchReq, p *actions.Dat
key := fmt.Sprintf(enums.MachineContentKey, item)
if content != "" {
helper.DefaultRedis.SetStringExpire(key, content, time.Hour*24)
helper.DefaultRedis.SetStringExpire(key, content, time.Hour*24*3)
} else {
helper.DefaultRedis.SetStringExpire(key, req.Content, time.Hour*24)
helper.DefaultRedis.SetStringExpire(key, req.Content, time.Hour*24*3)
}
}
}
@ -732,14 +732,14 @@ func (e *MmMachine) RebootMachine(req *dto.MmMachineRebootReq) error {
for _, machineId := range machineIds {
key := fmt.Sprintf(enums.RebootMachine, machineId)
if err := helper.DefaultRedis.SetStringExpire(key, "1", time.Hour*24); err != nil {
if err := helper.DefaultRedis.SetStringExpire(key, "1", time.Hour*24*3); err != nil {
e.Log.Errorf("Service RebootMachine error:%s \r\n", err)
}
}
} else {
for _, machineId := range req.MachineIds {
key := fmt.Sprintf(enums.RebootMachine, machineId)
if err := helper.DefaultRedis.SetStringExpire(key, "1", time.Hour*24); err != nil {
if err := helper.DefaultRedis.SetStringExpire(key, "1", time.Hour*24*3); err != nil {
e.Log.Errorf("Service RebootMachine error:%s \r\n", err)
}
}

View File

@ -33,6 +33,10 @@ func (e *MmRiskLog) GetPage(c *dto.MmRiskLogGetPageReq, p *actions.DataPermissio
query.Where("mm_machine.group_id = ?", c.GroupId)
}
if c.Type != nil {
query.Where("mm_risk_log.type = ?", c.Type)
}
if role.RoleKey != "admin" {
groups := ""
e.Orm.Model(models.MmUserGroup{}).Where("user_id = ?", p.UserId).Pluck("group_ids", &groups)

View File

@ -101,14 +101,14 @@ func (e *MmWhiteTemplate) Update(c *dto.MmWhiteTemplateUpdateReq, p *actions.Dat
for _, machineId := range machineIds {
key := fmt.Sprintf(enums.MachineContentKey, machineId)
helper.DefaultRedis.SetStringExpire(key, c.Content, time.Hour*24)
helper.DefaultRedis.SetStringExpire(key, c.Content, time.Hour*24*3)
}
} else {
e.Orm.Model(models.MmMachine{}).Where(" group_items='' and bios_id!=''").Select("machine_id").Find(&machineIds)
for _, machineId := range machineIds {
key := fmt.Sprintf(enums.MachineGroupKey, machineId)
helper.DefaultRedis.SetStringExpire(key, c.Content, time.Hour*24)
helper.DefaultRedis.SetStringExpire(key, c.Content, time.Hour*24*3)
}
}