|
|
@@ -0,0 +1,34 @@
|
|
|
+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 := "13322912052"
|
|
|
+ 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 := "FOHOW商城售后"
|
|
|
+ //sign := "凤凰玖玖"
|
|
|
+ template := "SMS_200694500"
|
|
|
+ // 短信发送
|
|
|
+ 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
|
|
|
+}
|