go-stock/backend/data/dingding_api_test.go
spark 6483243d2a feat(stock): 添加电报资讯功能
- 在后端增加电报资讯抓取功能,定时刷新并发送到前端
- 在前端添加电报资讯显示组件,滚动显示最新资讯
- 更新 go.mod 和 go.sum 文件,添加相关依赖
2025-01-14 13:13:50 +08:00

33 lines
820 B
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package data
import (
"github.com/go-resty/resty/v2"
"testing"
)
// @Author spark
// @Date 2025/1/3 13:53
// @Desc
//-----------------------------------------------------------------------------------
func TestRobot(t *testing.T) {
dingdingRobotUrl := "XXX"
resp, err := resty.New().R().
SetHeader("Content-Type", "application/json").
SetBody(`{
"msgtype": "markdown",
"markdown": {
"title":"go-stock",
"text": "#### 杭州天气 @150XXXXXXXX \n > 9度西北风1级空气良89相对温度73%\n > ![screenshot](https://img.alicdn.com/tfs/TB1NwmBEL9TBuNjy1zbXXXpepXa-2400-1218.png)\n > ###### 10点20分发布 [天气](https://www.dingtalk.com) \n"
},
"at": {
"isAtAll": true
}
}`).
Post(dingdingRobotUrl)
if err != nil {
t.Error(err)
}
t.Log(resp.String())
}