package mixrepoimpl import ( "context" "voucher/internal/biz/mixrepos" "voucher/internal/conf" "voucher/internal/pkg/sms" ) type SmsMixRepoImpl struct { bc *conf.Bootstrap smsService sms.Service } func NewSmsMixRepoImpl(bc *conf.Bootstrap) (mixrepos.SmsMixRepo, error) { config := sms.Config{ AccessKeyID: bc.AliYunSms.AccessKeyId, AccessKeySecret: bc.AliYunSms.AccessKeySecret, Endpoint: bc.AliYunSms.Endpoint, SignName: bc.AliYunSms.SignName, RetryTimes: 0, Timeout: 15, } smsService, err := sms.NewService(config) if err != nil { return nil, err } return &SmsMixRepoImpl{bc: bc, smsService: smsService}, nil } func (s *SmsMixRepoImpl) Send(ctx context.Context, phoneNumbers []string, params map[string]string) error { return s.smsService.SendSMS(ctx, phoneNumbers, s.bc.AliYunSms.TemplateSendCode, params) }