fix(pkg): 优化pkg显示

This commit is contained in:
liyp 2024-09-01 20:54:37 +08:00
parent 174e55c279
commit 554949feb7

View file

@ -139,15 +139,24 @@ func (a *Pkg) GetMsg() string {
msg += "包名:" + searchResult["Name"].(string) + "\n" msg += "包名:" + searchResult["Name"].(string) + "\n"
msg += "版本:" + searchResult["Version"].(string) + "\n" msg += "版本:" + searchResult["Version"].(string) + "\n"
msg += "描述:" + searchResult["Description"].(string) + "\n" msg += "描述:" + searchResult["Description"].(string) + "\n"
msg += "维护者:" + maintainer + "\n" msg += "维护者:" + maintainer
upstream, ok := searchResult["URL"].(string) upstream, ok := searchResult["URL"].(string)
if !ok || upstream == "" { if !ok || upstream == "" {
upstream = "无" upstream = "无"
} }
coMaintainers, ok := searchResult["CoMaintainers"].([]interface{})
if ok {
msg += " ( "
for _, coMaintainer := range coMaintainers {
msg += coMaintainer.(string) + " "
}
msg += ")"
}
msg += "\n"
msg += "上游:" + upstream + "\n" msg += "上游:" + upstream + "\n"
msg += OutOfDate msg += OutOfDate
last_update := time.Unix(int64(searchResult["LastModified"].(float64)), 0).Format("2006-01-02 15:04:05") last_update := time.Unix(int64(searchResult["LastModified"].(float64)), 0).Format("2006-01-02 15:04:05")
msg += "更新时间:" + last_update msg += "更新时间:" + last_update + "\n"
msg += "投票:" + fmt.Sprintf("%.0f", searchResult["NumVotes"].(float64)) + "\n" msg += "投票:" + fmt.Sprintf("%.0f", searchResult["NumVotes"].(float64)) + "\n"
msg += "AUR 链接https://aur.archlinux.org/packages/" + searchResult["Name"].(string) + "\n" msg += "AUR 链接https://aur.archlinux.org/packages/" + searchResult["Name"].(string) + "\n"