mirror of
https://gitee.com/dromara/mayfly-go
synced 2025-11-03 16:00:25 +08:00
feat: 机器定时删除终端操作记录
This commit is contained in:
@@ -3,7 +3,7 @@ package entity
|
||||
import (
|
||||
"encoding/json"
|
||||
"mayfly-go/pkg/model"
|
||||
"strconv"
|
||||
"mayfly-go/pkg/utils/stringx"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -49,7 +49,7 @@ func (c *Config) IntValue(defaultValue int) int {
|
||||
if c.Id == 0 {
|
||||
return defaultValue
|
||||
}
|
||||
return c.ConvInt(c.Value, defaultValue)
|
||||
return stringx.ConvInt(c.Value, defaultValue)
|
||||
}
|
||||
|
||||
// 转换配置中的值为bool类型(默认"1"或"true"为true,其他为false)
|
||||
@@ -59,15 +59,3 @@ func (c *Config) ConvBool(value string, defaultValue bool) bool {
|
||||
}
|
||||
return value == "1" || value == "true"
|
||||
}
|
||||
|
||||
// 转换配置值中的值为int
|
||||
func (c *Config) ConvInt(value string, defaultValue int) int {
|
||||
if value == "" {
|
||||
return defaultValue
|
||||
}
|
||||
if intV, err := strconv.Atoi(value); err != nil {
|
||||
return defaultValue
|
||||
} else {
|
||||
return intV
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user