6
0

新增发送短信v2接口优化

This commit is contained in:
许 洋 2025-07-07 16:40:10 +08:00
parent 5f5a1160bf
commit 66eb586d88
3 changed files with 8 additions and 8 deletions

View File

@ -90,8 +90,8 @@ func (c *Client) SendSms(req *SendSmsRequest) (resp *SendSmsResponse, err error)
func (c *Client) SendSmsV2(req *SendSmsRequestV2) (resp *SendSmsResponseV2, err error) { func (c *Client) SendSmsV2(req *SendSmsRequestV2) (resp *SendSmsResponseV2, err error) {
if req.Mobile == "" { if req.Phone == "" {
err = errors.New("mobile is empty") err = errors.New("phone is empty")
return return
} }

View File

@ -144,8 +144,8 @@ func TestClient_SendSmsUrl(t *testing.T) {
func TestClient_SendSmsCodeV2(t *testing.T) { func TestClient_SendSmsCodeV2(t *testing.T) {
req := CreateSendSmsRequestV2(SendSmsParamV2{ req := CreateSendSmsRequestV2(SendSmsParamV2{
Mobile: "18320021439", Phone: "18320021439",
Type: SmsTypeBindPhone, Type: SmsTypeRegister,
Replaces: []Item{{ Replaces: []Item{{
Key: ReplaceKeyCode, Key: ReplaceKeyCode,
Value: "6379", Value: "6379",

View File

@ -31,7 +31,7 @@ type SendSmsResponse struct {
type SendSmsRequestV2 struct { type SendSmsRequestV2 struct {
*requests.JsonRequest *requests.JsonRequest
Mobile string `position:"Json" field:"mobile"` Phone string `position:"Json" field:"phone"`
Type string `position:"Json" field:"type"` Type string `position:"Json" field:"type"`
Replaces []Item `position:"Json" field:"replaces"` Replaces []Item `position:"Json" field:"replaces"`
Company string `position:"Json" field:"company"` Company string `position:"Json" field:"company"`
@ -59,7 +59,7 @@ type SendSmsParam struct {
} }
type SendSmsParamV2 struct { type SendSmsParamV2 struct {
Mobile string // 手机号 Phone string // 手机号
Type SmsType // 验证码类型 Type SmsType // 验证码类型
Replaces []Item Replaces []Item
Company string // 子游戏公司主体 Company string // 子游戏公司主体
@ -88,13 +88,13 @@ func CreateSendSmsResponse() (resp *SendSmsResponse) {
func CreateSendSmsRequestV2(param SendSmsParamV2) (req *SendSmsRequestV2) { func CreateSendSmsRequestV2(param SendSmsParamV2) (req *SendSmsRequestV2) {
req = &SendSmsRequestV2{ req = &SendSmsRequestV2{
JsonRequest: &requests.JsonRequest{}, JsonRequest: &requests.JsonRequest{},
Mobile: param.Mobile, Phone: param.Phone,
Type: param.Type, Type: param.Type,
Replaces: param.Replaces, Replaces: param.Replaces,
Company: param.Company, Company: param.Company,
Ip: param.Ip, Ip: param.Ip,
} }
req.InitWithApiInfo(HOST, VERSION, "/v1/sms/send") req.InitWithApiInfo(HOST, VERSION, "/v2/sms/send")
req.Method = requests.POST req.Method = requests.POST
return return
} }