短信发送方法
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
646 B

  1. package sms
  2. import (
  3. "testing"
  4. )
  5. func Test_SendByTencent(t *testing.T) {
  6. secretId := "AKIDObaKq9NRFn6A2iBaOxGKBoqeEbjdT5Vg"
  7. secretKey := "0mLiqlU0IMwIOEqGWYMxLVREsMelhT3R"
  8. smsAppId := "1400705248"
  9. signname := "智企易创"
  10. mobiles := []string{"18607565510"}
  11. templateId := "1478144"
  12. params := []string{"666555", "5"}
  13. requestId, status, err := SendByTencent(secretId, secretKey, smsAppId, signname, mobiles, templateId, params, "ap-beijing")
  14. t.Log(*requestId)
  15. if len(status) > 0 {
  16. for _, v := range status {
  17. t.Log(*v.SerialNo, *v.PhoneNumber, *v.Code, *v.Message, *v.Fee, *v.SessionContext, *v.IsoCode)
  18. }
  19. }
  20. t.Log(err)
  21. }