feat(database): add gearTxt field to parsed results and update related functions
This commit is contained in:
@@ -116,3 +116,22 @@ func (s *DatabaseService) GetAllAppSettings() (map[string]string, error) {
|
||||
|
||||
return settings, nil
|
||||
}
|
||||
|
||||
// SaveOptimizerPreference saves the latest optimizer options for a hero.
|
||||
func (s *DatabaseService) SaveOptimizerPreference(heroID string, optionsJSON string) error {
|
||||
if err := s.db.SaveOptimizerPreference(heroID, optionsJSON); err != nil {
|
||||
s.logger.Error("保存配装偏好失败", "error", err, "hero_id", heroID)
|
||||
return fmt.Errorf("保存配装偏好失败: %w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetOptimizerPreference gets saved optimizer options for a hero.
|
||||
func (s *DatabaseService) GetOptimizerPreference(heroID string) (string, error) {
|
||||
optionsJSON, err := s.db.GetOptimizerPreference(heroID)
|
||||
if err != nil {
|
||||
s.logger.Error("获取配装偏好失败", "error", err, "hero_id", heroID)
|
||||
return "", fmt.Errorf("获取配装偏好失败: %w", err)
|
||||
}
|
||||
return optionsJSON, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user