fix(admin): 管理后台 - 修复公告编辑与模型价格配置 (#355)

This commit is contained in:
Rou authored and GitHub committed 2026-08-31 06:49:38 +08:00
1 parent 2b7375f631
commit cc4aa736ff
7 files changed
+309 -128

No files matched your search

+1 -1
View File
@@ -735,7 +735,7 @@ func (r *Repository) AdminSystemChannels(keyword string, status string, limit in
func (r *Repository) AdminSystemChannelReferences() ([]model.ModelChannel, error) {
var channels []model.ModelChannel
err := r.db.Select("id", "name").Where("scope = ?", model.ChannelScopeSystem).Order("created_at asc").Find(&channels).Error
err := r.db.Select("id", "name", "enabled").Where("scope = ?", model.ChannelScopeSystem).Order("created_at asc").Find(&channels).Error
return channels, err
}
+6 -5
View File
@@ -73,9 +73,10 @@ type AdminUserReference struct {
}
type AdminChannelReference struct {
ID string `json:"id"`
Name string `json:"name"`
Models []string `json:"models"`
ID string `json:"id"`
Name string `json:"name"`
Enabled bool `json:"enabled"`
Models []string `json:"models"`
}
type AdminReferenceData struct {
@@ -189,7 +190,7 @@ func (s *Service) AdminReferences(actor *model.User) (*AdminReferenceData, error
result.Users = append(result.Users, AdminUserReference{ID: user.ID, Username: user.Username, DisplayName: user.DisplayName})
}
for _, channel := range channels {
items, itemErr := s.repo.ChannelModels(channel.ID, true)
items, itemErr := s.repo.ChannelModels(channel.ID, false)
if itemErr != nil {
return nil, itemErr
}
@@ -197,7 +198,7 @@ func (s *Service) AdminReferences(actor *model.User) (*AdminReferenceData, error
for _, item := range items {
models = append(models, item.ModelKey)
}
result.Channels = append(result.Channels, AdminChannelReference{ID: channel.ID, Name: channel.Name, Models: uniqueNonEmpty(models)})
result.Channels = append(result.Channels, AdminChannelReference{ID: channel.ID, Name: channel.Name, Enabled: channel.Enabled, Models: uniqueNonEmpty(models)})
}
return result, nil
}