package sms import ( "cls-server/pkg/http" "fmt" ) type IsmsService interface { Send(code string, phone string) error } // ConsoleSmsService debug环境使用 type SmsService struct { client *http.Client } func (s *SmsService) Send(code string, phone string) error { fmt.Printf("手机号【%s】验证码【%s】\n", phone, code) return nil resp, err := s.client.SubmitPhoneCodeRequest(&http.MsgReq{}) if err != nil { return err } if resp.State == 200 { return nil } //fmt.Printf("【中国移动】 您的验证码为:%s,您正在进行身份验证,该验证码10分钟内有效,如非本人操作,请忽略本短信!\n", msg) return nil } func NewDebugSmsService(client *http.Client) IsmsService { return &SmsService{client} }