chore(init): 初始化解忧商行项目并完成 Phase 0 基座
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
package sms
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
type MockProvider struct {
|
||||
log *zap.Logger
|
||||
}
|
||||
|
||||
func NewMockProvider(log *zap.Logger) *MockProvider {
|
||||
return &MockProvider{log: log}
|
||||
}
|
||||
|
||||
func (p *MockProvider) SendLoginCode(ctx context.Context, phone string, code string) error {
|
||||
if err := ctx.Err(); err != nil {
|
||||
return err
|
||||
}
|
||||
if p.log != nil {
|
||||
p.log.Info("本地短信验证码", zap.String("phone", maskPhone(phone)), zap.String("code", code))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *MockProvider) SendTemplate(ctx context.Context, req TemplateRequest) error {
|
||||
if err := ctx.Err(); err != nil {
|
||||
return err
|
||||
}
|
||||
if p.log != nil {
|
||||
p.log.Info("本地模板短信(未真实发送)",
|
||||
zap.String("phone", maskPhone(req.Phone)),
|
||||
zap.String("template_code", req.TemplateCode),
|
||||
zap.Any("params", req.Params),
|
||||
)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user