diff --git a/services/sms/client.go b/services/sms/client.go index f88e3bd..4a65d14 100644 --- a/services/sms/client.go +++ b/services/sms/client.go @@ -90,8 +90,8 @@ func (c *Client) SendSms(req *SendSmsRequest) (resp *SendSmsResponse, err error) func (c *Client) SendSmsV2(req *SendSmsRequestV2) (resp *SendSmsResponseV2, err error) { - if req.Mobile == "" { - err = errors.New("mobile is empty") + if req.Phone == "" { + err = errors.New("phone is empty") return } diff --git a/services/sms/client_test.go b/services/sms/client_test.go index d06db1c..060f011 100644 --- a/services/sms/client_test.go +++ b/services/sms/client_test.go @@ -144,8 +144,8 @@ func TestClient_SendSmsUrl(t *testing.T) { func TestClient_SendSmsCodeV2(t *testing.T) { req := CreateSendSmsRequestV2(SendSmsParamV2{ - Mobile: "18320021439", - Type: SmsTypeBindPhone, + Phone: "18320021439", + Type: SmsTypeRegister, Replaces: []Item{{ Key: ReplaceKeyCode, Value: "6379", diff --git a/services/sms/sms.go b/services/sms/sms.go index 74ade7f..a362aa5 100644 --- a/services/sms/sms.go +++ b/services/sms/sms.go @@ -31,7 +31,7 @@ type SendSmsResponse struct { type SendSmsRequestV2 struct { *requests.JsonRequest - Mobile string `position:"Json" field:"mobile"` + Phone string `position:"Json" field:"phone"` Type string `position:"Json" field:"type"` Replaces []Item `position:"Json" field:"replaces"` Company string `position:"Json" field:"company"` @@ -59,7 +59,7 @@ type SendSmsParam struct { } type SendSmsParamV2 struct { - Mobile string // 手机号 + Phone string // 手机号 Type SmsType // 验证码类型 Replaces []Item Company string // 子游戏公司主体 @@ -88,13 +88,13 @@ func CreateSendSmsResponse() (resp *SendSmsResponse) { func CreateSendSmsRequestV2(param SendSmsParamV2) (req *SendSmsRequestV2) { req = &SendSmsRequestV2{ JsonRequest: &requests.JsonRequest{}, - Mobile: param.Mobile, + Phone: param.Phone, Type: param.Type, Replaces: param.Replaces, Company: param.Company, Ip: param.Ip, } - req.InitWithApiInfo(HOST, VERSION, "/v1/sms/send") + req.InitWithApiInfo(HOST, VERSION, "/v2/sms/send") req.Method = requests.POST return }