update setting files

This commit is contained in:
fcl 2025-07-22 18:28:40 +08:00
parent aea76b919d
commit ad43d206e1
2 changed files with 8 additions and 4 deletions

View File

@ -16,12 +16,12 @@ message Setting {
table: "settings"
};
int64 id = 1 [(aeus.field) = {gorm:"primaryKey",comment:"ID"}];
int64 created_at = 2 [(aeus.field)={scenarios:"search;view;export",comment:"创建时间"}];
int64 updated_at = 3 [(aeus.field)={scenarios:"search;view;export",comment:"更新时间"}];
int64 created_at = 2 [(aeus.field)={scenarios:"view;export",comment:"创建时间"}];
int64 updated_at = 3 [(aeus.field)={scenarios:"view;export",comment:"更新时间"}];
string name = 4 [(aeus.field)={gorm:"size:60",rule:"required",props:"readonly:update",comment: "配置项"},(validate.rules).string = {max_len: 20}];
string type = 5 [(aeus.field)={gorm:"size:20",rule:"required",enum:"text:文本;number:数字;json:JSON",comment: "数据类型"},(validate.rules).string = {max_len: 20}];
string value = 6 [(aeus.field)={gorm:"size:1024",rule:"required",format:"textarea",comment: "配置值"},(validate.rules).string = {max_len: 1024}];
string description = 7 [(aeus.field)={gorm:"size:1024",format:"textarea",scenarios:"create;update;view;export",comment: "备注说明"},(validate.rules).string = {max_len: 1024}];
string description = 7 [(aeus.field)={gorm:"size:1024",format:"textarea",scenarios:"list;create;update;view;export",comment: "备注说明"},(validate.rules).string = {max_len: 1024}];
}

View File

@ -46,15 +46,19 @@ func (s *SettingService) GetSetting(ctx context.Context, req *pb.GetSettingReque
for _, v := range values {
res.Data = append(res.Data, &pb.SettingItem{
Name: v.Name,
Type: v.Type,
Value: v.Value,
})
}
return
}
func NewSettingService(cbs ...SettingOption) *SettingService {
opts := &settingOptions{}
for _, cb := range cbs {
cb(opts)
}
return &SettingService{}
return &SettingService{
opts: opts,
}
}