You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
758 B
Go

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

package sms
import (
"cls/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}
}