refactor: 清理重构遗留的死代码
Some checks failed
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Has been cancelled
Some checks failed
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Has been cancelled
- personal_customer.Service: 删除已迁移到 client_auth 的死方法 (GetProfile/SendVerificationCode/VerifyCode),移除多余的 verificationService/jwtManager 依赖 - 删除 internal/service/customer/ 整个目录(零引用的早期残留)
This commit is contained in:
@@ -1,14 +1,11 @@
|
||||
// Package personal_customer 提供个人客户管理的业务逻辑服务
|
||||
// 包含个人客户注册、登录、微信绑定、短信验证等功能
|
||||
// Package personal_customer 提供个人客户资料管理的业务逻辑服务
|
||||
package personal_customer
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/break/junhong_cmp_fiber/internal/model"
|
||||
"github.com/break/junhong_cmp_fiber/internal/service/verification"
|
||||
"github.com/break/junhong_cmp_fiber/internal/store/postgres"
|
||||
"github.com/break/junhong_cmp_fiber/pkg/auth"
|
||||
"github.com/break/junhong_cmp_fiber/pkg/errors"
|
||||
"go.uber.org/zap"
|
||||
"gorm.io/gorm"
|
||||
@@ -16,40 +13,24 @@ import (
|
||||
|
||||
// Service 个人客户服务
|
||||
type Service struct {
|
||||
store *postgres.PersonalCustomerStore
|
||||
phoneStore *postgres.PersonalCustomerPhoneStore
|
||||
verificationService *verification.Service
|
||||
jwtManager *auth.JWTManager
|
||||
logger *zap.Logger
|
||||
store *postgres.PersonalCustomerStore
|
||||
phoneStore *postgres.PersonalCustomerPhoneStore
|
||||
logger *zap.Logger
|
||||
}
|
||||
|
||||
// NewService 创建个人客户服务实例
|
||||
func NewService(
|
||||
store *postgres.PersonalCustomerStore,
|
||||
phoneStore *postgres.PersonalCustomerPhoneStore,
|
||||
verificationService *verification.Service,
|
||||
jwtManager *auth.JWTManager,
|
||||
logger *zap.Logger,
|
||||
) *Service {
|
||||
return &Service{
|
||||
store: store,
|
||||
phoneStore: phoneStore,
|
||||
verificationService: verificationService,
|
||||
jwtManager: jwtManager,
|
||||
logger: logger,
|
||||
store: store,
|
||||
phoneStore: phoneStore,
|
||||
logger: logger,
|
||||
}
|
||||
}
|
||||
|
||||
// SendVerificationCode 发送验证码
|
||||
func (s *Service) SendVerificationCode(ctx context.Context, phone string) error {
|
||||
return s.verificationService.SendCode(ctx, phone)
|
||||
}
|
||||
|
||||
// VerifyCode 验证验证码
|
||||
func (s *Service) VerifyCode(ctx context.Context, phone string, code string) error {
|
||||
return s.verificationService.VerifyCode(ctx, phone, code)
|
||||
}
|
||||
|
||||
// UpdateProfile 更新个人资料
|
||||
func (s *Service) UpdateProfile(ctx context.Context, customerID uint, nickname, avatarURL string) error {
|
||||
customer, err := s.store.GetByID(ctx, customerID)
|
||||
@@ -84,20 +65,6 @@ func (s *Service) UpdateProfile(ctx context.Context, customerID uint, nickname,
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetProfile 获取个人资料
|
||||
func (s *Service) GetProfile(ctx context.Context, customerID uint) (*model.PersonalCustomer, error) {
|
||||
customer, err := s.store.GetByID(ctx, customerID)
|
||||
if err != nil {
|
||||
s.logger.Error("查询个人客户失败",
|
||||
zap.Uint("customer_id", customerID),
|
||||
zap.Error(err),
|
||||
)
|
||||
return nil, errors.Wrap(errors.CodeInternalError, err, "查询个人客户失败")
|
||||
}
|
||||
|
||||
return customer, nil
|
||||
}
|
||||
|
||||
// GetProfileWithPhone 获取个人资料(包含主手机号)
|
||||
func (s *Service) GetProfileWithPhone(ctx context.Context, customerID uint) (*model.PersonalCustomer, string, error) {
|
||||
// 获取客户信息
|
||||
|
||||
Reference in New Issue
Block a user