4fb1016977
iotlcm-sms:独立短信 HTTP/gRPC 服务,支持阿里云与腾讯云。 - Go module 迁移至 git.5iot.com/iotlcm-public/iotlcm-sms - 补 Apache-2.0 LICENSE,重写 README(特性/配置/接口/部署/目录/测试) - 配置改为 config.example.yaml + SMS_* 环境变量注入,仓库不含真实凭证 - 清理内部标识(私有镜像仓库 / 公司名 / 客户签名 / 真实模板ID / 真实手机号) - 统一 LF 行尾并加 .gitattributes
41 lines
1.1 KiB
Go
41 lines
1.1 KiB
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"log"
|
|
"os"
|
|
|
|
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests"
|
|
"github.com/aliyun/alibaba-cloud-sdk-go/services/dysmsapi"
|
|
)
|
|
|
|
func main() {
|
|
keyID := os.Getenv("ALIYUN_ACCESS_KEY_ID")
|
|
keySecret := os.Getenv("ALIYUN_ACCESS_KEY_SECRET")
|
|
if keyID == "" || keySecret == "" {
|
|
log.Fatal("ALIYUN_ACCESS_KEY_ID and ALIYUN_ACCESS_KEY_SECRET are required")
|
|
}
|
|
region := os.Getenv("ALIYUN_REGION_ID")
|
|
if region == "" {
|
|
region = "cn-hangzhou"
|
|
}
|
|
|
|
client, err := dysmsapi.NewClientWithAccessKey(region, keyID, keySecret)
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
request := dysmsapi.CreateQuerySmsTemplateListRequest()
|
|
request.PageIndex = requests.NewInteger(1)
|
|
request.PageSize = requests.NewInteger(50)
|
|
response, err := client.QuerySmsTemplateList(request)
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
if response.Code != "OK" {
|
|
log.Fatalf("query failed: code=%s message=%s", response.Code, response.Message)
|
|
}
|
|
for _, template := range response.SmsTemplateList {
|
|
fmt.Printf("%s\t%s\t%s\t%s\n", template.TemplateCode, template.AuditStatus, template.TemplateName, template.TemplateContent)
|
|
}
|
|
}
|