🎨 优化热榜的链接为短链

This commit is contained in:
李寻欢
2024-07-16 11:58:52 +08:00
parent 9e4f151623
commit 78450aeace
5 changed files with 52 additions and 1 deletions

View File

@@ -75,7 +75,10 @@ func getTopData() (data []string) {
}
d.Channel = "百度"
newDatas = append(newDatas, d)
data = append(data, fmt.Sprintf("标题: %s\n热度: %s\n详情: %s", d.Title, d.Hot, d.Url))
shortUrl := utils.GenShortUrl(d.Url)
if shortUrl != "" {
data = append(data, fmt.Sprintf("标题: %s\n热度: %s\n详情: %s", d.Title, d.Hot, shortUrl))
}
}
// 保存新数据到数据库
if len(newDatas) > 0 {