更新管理后台布局,优化菜单项标签,新增支付配置项。同时,调整API响应字段命名,确保一致性,提升代码可读性和维护性。
This commit is contained in:
35
soul-api/internal/model/system_config.go
Normal file
35
soul-api/internal/model/system_config.go
Normal file
@@ -0,0 +1,35 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"database/sql/driver"
|
||||
"time"
|
||||
)
|
||||
|
||||
// ConfigValue 存 system_config.config_value(JSON 列,可为 object 或 array)
|
||||
type ConfigValue []byte
|
||||
|
||||
func (c ConfigValue) Value() (driver.Value, error) { return []byte(c), nil }
|
||||
func (c *ConfigValue) Scan(value interface{}) error {
|
||||
if value == nil {
|
||||
*c = nil
|
||||
return nil
|
||||
}
|
||||
b, ok := value.([]byte)
|
||||
if !ok {
|
||||
return nil
|
||||
}
|
||||
*c = append((*c)[0:0], b...)
|
||||
return nil
|
||||
}
|
||||
|
||||
// SystemConfig 对应表 system_config,JSON 输出与现网 1:1(小写驼峰)
|
||||
type SystemConfig struct {
|
||||
ID int `gorm:"column:id;primaryKey;autoIncrement" json:"id"`
|
||||
ConfigKey string `gorm:"column:config_key;uniqueIndex;size:100" json:"configKey"`
|
||||
ConfigValue ConfigValue `gorm:"column:config_value;type:json" json:"configValue"`
|
||||
Description *string `gorm:"column:description;size:200" json:"description,omitempty"`
|
||||
CreatedAt time.Time `gorm:"column:created_at" json:"createdAt"`
|
||||
UpdatedAt time.Time `gorm:"column:updated_at" json:"updatedAt"`
|
||||
}
|
||||
|
||||
func (SystemConfig) TableName() string { return "system_config" }
|
||||
Reference in New Issue
Block a user