32 lines
978 B
Go
32 lines
978 B
Go
package response
|
|
|
|
import "psi/models"
|
|
|
|
// ConfigListResponse 配置列表响应
|
|
type ConfigListResponse struct {
|
|
List []ConfigItem `json:"list"` // 列表
|
|
Total int64 `json:"total"` // 总数
|
|
Page int `json:"page"` // 当前页
|
|
PageSize int `json:"pageSize"` // 每页数量
|
|
}
|
|
|
|
// ConfigItem 配置列表项
|
|
type ConfigItem struct {
|
|
ID int64 `json:"id"` // ID
|
|
Key string `json:"key"` // 键
|
|
Value string `json:"value"` // 值
|
|
CreatedAt int64 `json:"created_at"` // 创建时间
|
|
UpdatedAt int64 `json:"updated_at"` // 更新时间
|
|
}
|
|
|
|
// ConvertConfigToItem 将配置模型转换为响应项
|
|
func ConvertConfigToItem(config models.Config) ConfigItem {
|
|
return ConfigItem{
|
|
ID: config.ID, // ID
|
|
Key: config.Key, // 键
|
|
Value: config.Value, // 值
|
|
CreatedAt: config.CreatedAt, // 创建时间
|
|
UpdatedAt: config.UpdatedAt, // 更新时间
|
|
}
|
|
}
|