Skip to content

Commit

Permalink
fix: improve code format
Browse files Browse the repository at this point in the history
  • Loading branch information
hsluoyz committed Dec 21, 2023
1 parent f6dc61a commit e8925b6
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 13 deletions.
1 change: 1 addition & 0 deletions aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package go_sms_sender

import (
"fmt"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/credentials"
"github.com/aws/aws-sdk-go/aws/session"
Expand Down
2 changes: 1 addition & 1 deletion baidubce.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func GetBceClient(accessId, accessKey, sign, template string, endpoint []string)
func (c *BaiduClient) SendMessage(param map[string]string, targetPhoneNumber ...string) error {
code, ok := param["code"]
if !ok {
return fmt.Errorf("missing parameter: msg code")
return fmt.Errorf("missing parameter: code")
}

phoneNumbers := bytes.Buffer{}
Expand Down
2 changes: 1 addition & 1 deletion gccpay.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func Md5(str string) string {
func (c *GCCPAYClient) SendMessage(param map[string]string, targetPhoneNumber ...string) error {
_, ok := param["code"]
if !ok {
return fmt.Errorf("missing parameter: msg code")
return fmt.Errorf("missing parameter: code")
}

if len(targetPhoneNumber) < 1 {
Expand Down
3 changes: 2 additions & 1 deletion huawei.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,9 @@ func GetHuaweiClient(accessId string, accessKey string, sign string, template st
func (c *HuaweiClient) SendMessage(param map[string]string, targetPhoneNumber ...string) error {
code, ok := param["code"]
if !ok {
return fmt.Errorf("missing parameter: msg code")
return fmt.Errorf("missing parameter: code")
}

templateParas := fmt.Sprintf("[\"%s\"]", code)

phoneNumbers := bytes.Buffer{}
Expand Down
2 changes: 1 addition & 1 deletion huyi.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func GetMd5String(s string) string {
func (hc *HuyiClient) SendMessage(param map[string]string, targetPhoneNumber ...string) error {
code, ok := param["code"]
if !ok {
return fmt.Errorf("missing parameter: msg code")
return fmt.Errorf("missing parameter: code")
}

if len(targetPhoneNumber) < 1 {
Expand Down
2 changes: 1 addition & 1 deletion infobip.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func GetInfobipClient(sender string, apiKey string, template string, baseUrl []s
func (c *InfobipClient) SendMessage(param map[string]string, targetPhoneNumber ...string) error {
code, ok := param["code"]
if !ok {
return fmt.Errorf("missing parameter: msg code")
return fmt.Errorf("missing parameter: code")
}

if len(targetPhoneNumber) < 1 {
Expand Down
2 changes: 1 addition & 1 deletion smsbao.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func GetSmsbaoClient(username string, apikey string, sign string, template strin
func (c *SmsBaoClient) SendMessage(param map[string]string, targetPhoneNumber ...string) error {
code, ok := param["code"]
if !ok {
return fmt.Errorf("missing parameter: msg code")
return fmt.Errorf("missing parameter: code")
}

if len(targetPhoneNumber) < 1 {
Expand Down
10 changes: 4 additions & 6 deletions twilio.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package go_sms_sender

import (
"fmt"

"github.com/twilio/twilio-go"
openapi "github.com/twilio/twilio-go/rest/api/v2010"
)
Expand Down Expand Up @@ -43,11 +44,9 @@ func GetTwilioClient(accessId string, accessKey string, template string) (*Twili
func (c *TwilioClient) SendMessage(param map[string]string, targetPhoneNumber ...string) error {
code, ok := param["code"]
if !ok {
return fmt.Errorf("missing parameter: msg code")
return fmt.Errorf("missing parameter: code")
}

var err error

bodyContent := fmt.Sprintf(c.template, code)

if len(targetPhoneNumber) < 2 {
Expand All @@ -60,12 +59,11 @@ func (c *TwilioClient) SendMessage(param map[string]string, targetPhoneNumber ..

for i := 1; i < len(targetPhoneNumber); i++ {
params.SetTo(targetPhoneNumber[i])
_, err = c.core.Api.CreateMessage(params)

_, err := c.core.Api.CreateMessage(params)
if err != nil {
return err
}
}

return err
return nil
}
4 changes: 3 additions & 1 deletion ucloud.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package go_sms_sender

import (
"fmt"

"github.com/ucloud/ucloud-sdk-go/services/usms"
"github.com/ucloud/ucloud-sdk-go/ucloud"
"github.com/ucloud/ucloud-sdk-go/ucloud/auth"
Expand Down Expand Up @@ -59,8 +60,9 @@ func GetUcloudClient(publicKey string, privateKey string, sign string, template
func (c *UcloudClient) SendMessage(param map[string]string, targetPhoneNumber ...string) error {
code, ok := param["code"]
if !ok {
return fmt.Errorf("missing parameter: msg code")
return fmt.Errorf("missing parameter: code")
}

req := c.core.NewSendUSMSMessageRequest()
req.SigContent = ucloud.String(c.Sign)
req.TemplateId = ucloud.String(c.Template)
Expand Down

0 comments on commit e8925b6

Please sign in to comment.