fix: 更新图片下载路径为 /tmp/qqbot,确保头像和封面图片的下载和处理逻辑一致
This commit is contained in:
@@ -224,12 +224,12 @@ func (p PlayerDataLite) IsDiffFrom(p2 PlayerDataLite) bool {
|
||||
}
|
||||
|
||||
func (p PlayerData) ToString() string {
|
||||
err := util.DownloadFile(p.ProfilePicture, util.GenTempFilePath(p.ID+".jpg"))
|
||||
filePath, err := util.DownloadFile(p.ProfilePicture, "/tmp/qqbot")
|
||||
if err != nil {
|
||||
log.Default().Printf("下载头像失败,url:%s,err:%v", p.ProfilePicture, err)
|
||||
}
|
||||
defer os.Remove(util.GenTempFilePath(p.ID + ".jpg"))
|
||||
outFile, err := util.ResizeImageByMaxHeight(util.GenTempFilePath(p.ID+".jpg"), 20)
|
||||
defer os.Remove(filePath)
|
||||
outFile, err := util.ResizeImageByMaxHeight(filePath, 20)
|
||||
if err != nil {
|
||||
log.Default().Printf("缩放头像失败,url:%s,err:%v", p.ProfilePicture, err)
|
||||
}
|
||||
@@ -284,12 +284,12 @@ func (p PlayerDataLite) ToString() string {
|
||||
}
|
||||
|
||||
func (p PlayerData) LastDiffToString(lastDayQueryData PlayerDataLite) string {
|
||||
err := util.DownloadFile(p.ProfilePicture, util.GenTempFilePath(p.ID+".jpg"))
|
||||
filePath, err := util.DownloadFile(p.ProfilePicture, "/tmp/qqbot")
|
||||
if err != nil {
|
||||
log.Default().Printf("下载头像失败,url:%s,err:%v", p.ProfilePicture, err)
|
||||
}
|
||||
defer os.Remove(util.GenTempFilePath(p.ID + ".jpg"))
|
||||
outFile, err := util.ResizeImageByMaxHeight(util.GenTempFilePath(p.ID+".jpg"), 20)
|
||||
defer os.Remove(filePath)
|
||||
outFile, err := util.ResizeImageByMaxHeight(filePath, 20)
|
||||
if err != nil {
|
||||
log.Default().Printf("缩放头像失败,url:%s,err:%v", p.ProfilePicture, err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user