| 1234567891011121314151617181920212223242526272829303132333435 |
- package helpers
- import (
- "fmt"
- "github.com/GiterLab/aliyun-sms-go-sdk/dysms"
- "github.com/astaxie/beego"
- "github.com/tobyzxj/uuid"
- "os"
- "strings"
- )
- // 发送发货短信
- func DispathSendSms(tels []string, expressNo string) {
- if tels == nil || len(tels) == 0 {
- return
- }
- kefuTel := "15876023557"
- mobile := strings.Join(tels, ",")
- params := fmt.Sprintf(`{"tel":"%s","expressNo":"%s"}`, kefuTel, expressNo)
- /* ok, resp := alidayu.SendSMS(mobile, sign, template, params)*/
- dysms.HTTPDebugEnable = true
- dysms.SetACLClient(beego.AppConfig.String("AliSmsAccessId"), beego.AppConfig.String("AliSmsAccessSecret")) // dysms.New(ACCESSID, ACCESSKEY)
- sign := "凤凰菁选"
- //sign := "凤凰玖玖"
- template := "SMS_201456487"
- // 短信发送
- respSendSms, err := dysms.SendSms(uuid.New(), mobile, sign, template, params).DoActionWithException()
- if err != nil {
- fmt.Println("send sms failed", err, respSendSms.Error())
- os.Exit(0)
- }
- fmt.Println("send sms succeed", respSendSms.String())
- return
- }
|