package sms import ( "fmt" "golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests" "testing" ) var ( client *Client ) func TestMain(t *testing.M) { var err error client, err = NewClient() if err != nil { panic(err) } t.Run() } func TestClient_SendEmail(t *testing.T) { req := CreateSendEmailRequest(SendEmailParam{ Addresses: []string{"xuyang@89you.com"}, Subject: "测试邮件", Body: "xxx已修改密码,新密码是:xxx", FromName: "高热监控", }) email, err := client.SendEmail(req) if err != nil { panic(err) } fmt.Println(email) } func TestClient_SendFeiShuWebHook(t *testing.T) { //req := CreateSendFeiShuWebHookRequest(SendFeiShuWebHookParam{ // Do: FeiShuWebHookDoTypeSendRichText, // Token: "b762f80c-fe4f-4182-b48e-5c78041592bc", // Content: "[[{\"tag\":\"text\",\"text\":\"富文本信息: \"},{\"tag\":\"a\",\"text\":\"请查看\",\"href\":\"http://www.example.com/\"},{\"tag\":\"at\",\"user_id\":\"ou_18eac8********17ad4f02e8bbbb\"}]]", // Title: "卡片主标题", // TitleColor: "purple", //}) // //resp, err := client.SendFeiShuWebHook(req) //if err != nil { // panic(err) //} //fmt.Println(resp.Msg) //req2 := CreateSendFeiShuWebHookRequest(SendFeiShuWebHookParam{ // Do: FeiShuWebHookDoTypeSendSimpleText, // Token: "b762f80c-fe4f-4182-b48e-5c78041592bc", // Content: " - 苹果ID:XXXX\n - 游戏ID:XXXX\n - bundleID:XXXX\n - 应用名:XXX\n - 下架时间:2025-04-18 12:36:52\n - IP:XX(城市A省份)、XX(城市B省份);说明:XX为具体的IP,括号内为IP对应的城市;", //}) // //resp2, err := client.SendFeiShuWebHook(req2) //if err != nil { // panic(err) //} //fmt.Println(resp2) //[ // [ // { // "tag": "text", // "text": "苹果ID:XXXX" // } // ], // [ // { // "tag": "text", // "text": "游戏ID:XXXX" // } // ] //] req3 := CreateSendFeiShuWebHookRequest(SendFeiShuWebHookParam{ TitleColor: "purple", Title: "监控报警", Do: FeiShuWebHookDoTypeSendCardText, Token: "b762f80c-fe4f-4182-b48e-5c78041592bc", Content: "[{\"tag\":\"div\",\"text\":{\"tag\":\"plain_text\",\"content\":\"苹果ID:XXXX\"}},{\"tag\":\"div\",\"text\":{\"tag\":\"plain_text\",\"content\":\"游戏ID:XXXX\"}}]", }) resp3, err := client.SendFeiShuWebHook(req3) if err != nil { panic(err) } fmt.Println(resp3.Msg) fmt.Println(resp3) } func TestClient_SendSms(t *testing.T) { req := CreateSendSmsRequest(SendSmsParam{ Mobile: "18320021439", Type: SmsTypeBindPhone, Code: 123456, Expired: 5, }) req.Domain = requests.Host{ Default: "127.0.0.1:8804", } sms, err := client.SendSms(req) if err != nil { panic(err) } fmt.Println(sms) }