初始化
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"code.yun.ink/pkg/smsx"
|
||||
"code.yun.ink/pkg/smsx/entity"
|
||||
"code.yun.ink/pkg/smsx/interfaces"
|
||||
"github.com/yuninks/loggerx"
|
||||
)
|
||||
|
||||
func main() {
|
||||
ctx := context.Background()
|
||||
|
||||
logger := loggerx.NewLogger(ctx)
|
||||
sms, err := smsx.GetPlatform(ctx, entity.Platform3rdTypeTencent)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
|
||||
ini, err := sms.InitSmsx(ctx, entity.SmsConfigData{
|
||||
SysType: entity.Platform3rdTypeTencent,
|
||||
Tencent: &entity.SmsConfigDataTencent{
|
||||
SecretId: "AKIDb2b8SefT8YjgUBk8N0XtANMSZWFqLiIp",
|
||||
SecretKey: "QxqstqipqkTzfKqGVdgr3Merx0uvoU3R",
|
||||
SignName: "深圳宏建源贸易",
|
||||
SmsSdkAppId: "1400883795",
|
||||
},
|
||||
}, logger)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
|
||||
err = ini.Send(ctx, "2060882", "+85267369217", []interfaces.SmsSendParam{
|
||||
{
|
||||
Field: "1",
|
||||
Value: "123456",
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
|
||||
fmt.Println("success")
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user