refactor: Update service and repository methods to use context
- Refactored multiple service and repository methods to accept context as a parameter, enhancing consistency and enabling better control over request lifecycles. - Updated handlers to utilize context in method calls, improving error handling and performance. - Cleaned up Dockerfile by removing unnecessary whitespace.
This commit is contained in:
@@ -28,14 +28,14 @@ type Property struct {
|
||||
// yggdrasilSerializationService 序列化服务实现
|
||||
type yggdrasilSerializationService struct {
|
||||
textureRepo repository.TextureRepository
|
||||
signatureService *signatureService
|
||||
signatureService *SignatureService
|
||||
logger *zap.Logger
|
||||
}
|
||||
|
||||
// NewSerializationService 创建序列化服务实例
|
||||
func NewSerializationService(
|
||||
textureRepo repository.TextureRepository,
|
||||
signatureService *signatureService,
|
||||
signatureService *SignatureService,
|
||||
logger *zap.Logger,
|
||||
) SerializationService {
|
||||
return &yggdrasilSerializationService{
|
||||
@@ -58,7 +58,7 @@ func (s *yggdrasilSerializationService) SerializeProfile(ctx context.Context, pr
|
||||
|
||||
// 处理皮肤
|
||||
if profile.SkinID != nil {
|
||||
skin, err := s.textureRepo.FindByID(*profile.SkinID)
|
||||
skin, err := s.textureRepo.FindByID(ctx, *profile.SkinID)
|
||||
if err != nil {
|
||||
s.logger.Error("获取皮肤失败",
|
||||
zap.Error(err),
|
||||
@@ -74,7 +74,7 @@ func (s *yggdrasilSerializationService) SerializeProfile(ctx context.Context, pr
|
||||
|
||||
// 处理披风
|
||||
if profile.CapeID != nil {
|
||||
cape, err := s.textureRepo.FindByID(*profile.CapeID)
|
||||
cape, err := s.textureRepo.FindByID(ctx, *profile.CapeID)
|
||||
if err != nil {
|
||||
s.logger.Error("获取披风失败",
|
||||
zap.Error(err),
|
||||
|
||||
Reference in New Issue
Block a user