mirror of
https://gitee.com/dromara/mayfly-go
synced 2025-11-04 00:10:25 +08:00
feat: 新增系统全局配置&修改账号密码
This commit is contained in:
29
server/internal/sys/domain/entity/config.go
Normal file
29
server/internal/sys/domain/entity/config.go
Normal file
@@ -0,0 +1,29 @@
|
||||
package entity
|
||||
|
||||
import "mayfly-go/pkg/model"
|
||||
|
||||
const (
|
||||
ConfigKeyUseLoginCaptcha string = "UseLoginCaptcha" // 是否使用登录验证码
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
model.Model
|
||||
Name string `json:"name"` // 配置名
|
||||
Key string `json:"key"` // 配置key
|
||||
Value string `json:"value"`
|
||||
Remark string `json:"remark"`
|
||||
}
|
||||
|
||||
func (a *Config) TableName() string {
|
||||
return "t_sys_config"
|
||||
}
|
||||
|
||||
// 若配置信息不存在, 则返回传递的默认值.
|
||||
// 否则只有value == "1"为true,其他为false
|
||||
func (c *Config) BoolValue(defaultValue bool) bool {
|
||||
// 如果值不存在,则返回默认值
|
||||
if c.Id == 0 {
|
||||
return defaultValue
|
||||
}
|
||||
return c.Value == "1"
|
||||
}
|
||||
18
server/internal/sys/domain/repository/config.go
Normal file
18
server/internal/sys/domain/repository/config.go
Normal file
@@ -0,0 +1,18 @@
|
||||
package repository
|
||||
|
||||
import (
|
||||
"mayfly-go/internal/sys/domain/entity"
|
||||
"mayfly-go/pkg/model"
|
||||
)
|
||||
|
||||
type Config interface {
|
||||
GetPageList(condition *entity.Config, pageParam *model.PageParam, toEntity interface{}, orderBy ...string) *model.PageResult
|
||||
|
||||
Insert(config *entity.Config)
|
||||
|
||||
Update(config *entity.Config)
|
||||
|
||||
GetConfig(config *entity.Config, cols ...string) error
|
||||
|
||||
GetByCondition(condition *entity.Config, cols ...string) error
|
||||
}
|
||||
Reference in New Issue
Block a user