🎨 优化热榜的链接为短链

This commit is contained in:
李寻欢
2024-07-16 13:30:06 +08:00
parent 78450aeace
commit dee47ddd58
3 changed files with 106 additions and 99 deletions

View File

@@ -26,12 +26,12 @@ func GenShortUrl(url string) (shortUrl string) {
SetAuthScheme("Token").
SetAuthToken(config.Conf.System.UrlcApiToken).
SetBody(string(pbs)).
SetResult(&respData).
Post("https://www.urlc.cn/api/url/add")
if err != nil {
log.Printf("短链接获取失败: %s", err.Error())
return
}
log.Printf("短链接获取结果: %s", unicodeToText(resp.String()))
log.Printf("短链接获取结果: %s", resp.String())
_ = json.Unmarshal(resp.Body(), &respData)
return respData.Short
}