From 50ece3db77941588d8ef25dd3dd1237bc2a37c11 Mon Sep 17 00:00:00 2001 From: Tenko Date: Fri, 21 Jun 2024 11:22:47 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8D=E7=89=87=E6=94=AF=E6=8C=81=E8=87=AA?= =?UTF-8?q?=E5=AE=9A=E4=B9=89=E5=A4=B4=E5=83=8F=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/web/card.go | 12 +++++++++++- template/Card.tmpl | 2 +- template/OldCard.tmpl | 2 +- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/core/web/card.go b/src/core/web/card.go index 8462281..e71a07b 100644 --- a/src/core/web/card.go +++ b/src/core/web/card.go @@ -11,6 +11,7 @@ import ( "io" "log" "net/http" + "net/url" "strconv" "strings" ) @@ -129,7 +130,16 @@ func cardData(userId int64, sklandId, uid string) (PlayerCard, error) { playerCard.Level = playerData.Status.Level playerCard.RegTime = playerData.Status.RegisterTs playerCard.MainStageProgress = playerData.StageInfoMap[playerData.Status.MainStageProgress].Code - playerCard.Avatar = playerData.Status.Secretary.SkinID + avatarId := playerData.Status.Avatar.Id + if strings.HasPrefix(avatarId, "char") { + playerCard.Avatar = fmt.Sprintf("https://web.hycdn.cn/arknights/game/assets/char_skin/avatar/%s.png", url.QueryEscape(avatarId)) + } else { + // 头像 + paintingName := fmt.Sprintf("%s.png", strings.ToUpper(avatarId[:1])+avatarId[1:]) + m := utils.Md5(paintingName) + path := "https://media.prts.wiki/thumb" + fmt.Sprintf("/%s/%s/", m[:1], m[:2]) + playerCard.Avatar = path + paintingName + "/80px-" + paintingName + } playerCard.Resume = playerData.Status.Resume playerCard.CharCnt = len(playerData.Chars) playerCard.NationList = getNationList(playerData) diff --git a/template/Card.tmpl b/template/Card.tmpl index 8438204..e675536 100644 --- a/template/Card.tmpl +++ b/template/Card.tmpl @@ -153,7 +153,7 @@
- +
{{.Level}}
diff --git a/template/OldCard.tmpl b/template/OldCard.tmpl index 547947c..9421153 100644 --- a/template/OldCard.tmpl +++ b/template/OldCard.tmpl @@ -92,7 +92,7 @@
- +
{{.Name}}  ({{.ServerName}})