1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- package lib
- import (
- "fmt"
- openapi "github.com/alibabacloud-go/darabonba-openapi/client"
- dysmsapi20170525 "github.com/alibabacloud-go/dysmsapi-20170525/v2/client"
- "github.com/alibabacloud-go/tea/tea"
- )
- func message_CreateClient(accessKeyId *string, accessKeySecret *string) (_result *dysmsapi20170525.Client, _err error) {
- config := &openapi.Config{
- // 您的AccessKey ID
- AccessKeyId: accessKeyId,
- // 您的AccessKey Secret
- AccessKeySecret: accessKeySecret,
- }
- // 访问的域名
- config.Endpoint = tea.String("dysmsapi.aliyuncs.com")
- _result = &dysmsapi20170525.Client{}
- _result, _err = dysmsapi20170525.NewClient(config)
- return _result, _err
- }
- func Message_Sand(PhoneNumbers string, TemplateCode string, TemplateParam string) {
- client, _err := message_CreateClient(tea.String("LTAI5tBmBMw5s1nFvZsKXSPi"), tea.String("6L386APuJyCS8wyS726spfiwmKSksi"))
- if _err != nil {
- //Config.AddSysMessage(PhoneNumbers, TemplateCode, TemplateParam, "CreateClient _err")
- return
- }
- sendSmsRequest := &dysmsapi20170525.SendSmsRequest{
- PhoneNumbers: tea.String(PhoneNumbers),
- SignName: tea.String("宝智达网络科技"),
- TemplateCode: tea.String(TemplateCode),
- TemplateParam: tea.String(TemplateParam),
- }
- // 复制代码运行请自行打印 API 的返回值
- _result, _err := client.SendSms(sendSmsRequest)
- str := fmt.Sprintf("%s", _result.Body)
- println(str)
- }
- // println(lib.Message_Sand("18777951277","SMS_215350603","{\"code\":\"1111\"}"))
|