From 5ce7f7bba419912f8516f5a2353aa0d0c9d9cf2f Mon Sep 17 00:00:00 2001 From: lixiangwuxian Date: Sat, 5 Jul 2025 20:51:59 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=9C=A8=20MsgInHandler=20=E4=B8=AD?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=AF=B9=20StructuredMsg=20=E9=95=BF?= =?UTF-8?q?=E5=BA=A6=E7=9A=84=E6=A3=80=E6=9F=A5=EF=BC=8C=E9=81=BF=E5=85=8D?= =?UTF-8?q?=E6=BD=9C=E5=9C=A8=E7=9A=84=E6=95=B0=E7=BB=84=E8=B6=8A=E7=95=8C?= =?UTF-8?q?=E9=94=99=E8=AF=AF=EF=BC=9B=E6=9B=B4=E6=96=B0=20PlayerDataLite?= =?UTF-8?q?=20=E7=BB=93=E6=9E=84=E4=BD=93=EF=BC=8C=E6=B7=BB=E5=8A=A0=20Gor?= =?UTF-8?q?m=20=E6=A0=87=E7=AD=BE=E4=BB=A5=E6=94=AF=E6=8C=81=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=BA=93=E6=98=A0=E5=B0=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- handler/handler.go | 2 +- service/scoresaber/model.go | 30 +++++++++++++++--------------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/handler/handler.go b/handler/handler.go index d1706ff..6622645 100644 --- a/handler/handler.go +++ b/handler/handler.go @@ -119,7 +119,7 @@ func MsgInHandler(msg model.Message) (reply *model.Reply) { return reply } } - if msg.StructuredMsg[0].GetMessageType() == qq_message.TypeAt { + if len(msg.StructuredMsg) > 0 && msg.StructuredMsg[0].GetMessageType() == qq_message.TypeAt { if atMsg, ok := msg.StructuredMsg[0].(*qq_message.AtMessage); ok { atUserID := atMsg.Data.QQ loginAccountInfo, err := action.GetLoginAccountInfo() diff --git a/service/scoresaber/model.go b/service/scoresaber/model.go index 7e81b75..94e4625 100644 --- a/service/scoresaber/model.go +++ b/service/scoresaber/model.go @@ -203,21 +203,21 @@ type PlayerData struct { } type PlayerDataLite struct { - ID string `json:"id" db:"id"` - Name string `json:"name" db:"name"` - ProfilePicture string `json:"profilePicture" db:"profile_picture"` - Country string `json:"country" db:"country"` - Device string `json:"device" db:"device"` - PP float64 `json:"pp" db:"pp"` - Rank int `json:"rank" db:"rank"` - CountryRank int `json:"countryRank" db:"country_rank"` - TotalScore int `json:"totalScore" db:"total_score"` - TotalRankedScore int `json:"totalRankedScore" db:"total_ranked_score"` - AverageRankedAccuracy float64 `json:"averageRankedAccuracy" db:"average_ranked_accuracy"` - TotalPlayCount int `json:"totalPlayCount" db:"total_play_count"` - RankedPlayCount int `json:"rankedPlayCount" db:"ranked_play_count"` - ReplaysWatched int `json:"replaysWatched" db:"replays_watched"` - GeneratedTime string `json:"generatedTime" db:"generated_time"` + ID string `json:"id" db:"id" gorm:"column:id"` + Name string `json:"name" db:"name" gorm:"column:name"` + ProfilePicture string `json:"profilePicture" db:"profile_picture" gorm:"column:profile_picture"` + Country string `json:"country" db:"country" gorm:"column:country"` + Device string `json:"device" db:"device" gorm:"column:device"` + PP float64 `json:"pp" db:"pp" gorm:"column:pp"` + Rank int `json:"rank" db:"rank" gorm:"column:rank"` + CountryRank int `json:"countryRank" db:"country_rank" gorm:"column:country_rank"` + TotalScore int `json:"totalScore" db:"total_score" gorm:"column:total_score"` + TotalRankedScore int `json:"totalRankedScore" db:"total_ranked_score" gorm:"column:total_ranked_score"` + AverageRankedAccuracy float64 `json:"averageRankedAccuracy" db:"average_ranked_accuracy" gorm:"column:average_ranked_accuracy"` + TotalPlayCount int `json:"totalPlayCount" db:"total_play_count" gorm:"column:total_play_count"` + RankedPlayCount int `json:"rankedPlayCount" db:"ranked_play_count" gorm:"column:ranked_play_count"` + ReplaysWatched int `json:"replaysWatched" db:"replays_watched" gorm:"column:replays_watched"` + GeneratedTime string `json:"generatedTime" db:"generated_time" gorm:"column:generated_time"` } func (p PlayerDataLite) IsDiffFrom(p2 PlayerDataLite) bool {