diff --git a/cv/user_cv/user.go b/cv/user_cv/user.go index 1d535ee2883cadf78e5651180796269c599392d7..9a5114509dd12aa91d990dee2aec130d5e61daa7 100644 --- a/cv/user_cv/user.go +++ b/cv/user_cv/user.go @@ -100,6 +100,7 @@ type CvUserBase struct { //VIP用户过期时间(只有自己查询自己,才返回) VipExpireTime *int64 `json:"vipExpireTime"` Svip rpc.CvSvip `json:"svip"` // svip结构,等级+权限 + Medals []uint32 `json:"medals"` // 勋章列表 MedalInfo []medal_cv.CvMedal `json:"medalInfo"` // 勋章列表 Headwear *headwear_cv.CvHeadwear `json:"headwear"` // 当前使用的头饰 Ride property_cv.CvProperty `json:"ride"` // 当前使用的座驾 @@ -191,6 +192,7 @@ func GetUserBases(userIds []mysql.ID, myUserId mysql.ID) ([]*CvUserBase, error) IsPrettyCode: user.IsPrettyCode(), IsVip: vips[user.ID] != nil, IsOfficialStaff: superManagerMap[user.ID], + Medals: IfLogoutMedals(IfLogout(user.LogoutTime), []uint32{}, medals[user.ID]), MedalInfo: IfLogoutMedalInfo(invisible, []medal_cv.CvMedal{}, medalInfo[user.ID]), Ride: IfLogoutRide(IfLogout(user.LogoutTime), property_cv.CvProperty{}, property_cv.CvProperty{ Id: rides[user.ID], diff --git a/cv/user_cv/utils.go b/cv/user_cv/utils.go index 827e24e839402edf186a0a25bbe7df47d7eb0793..c8a629132b99fdaf627cb26a9982667493507b79 100644 --- a/cv/user_cv/utils.go +++ b/cv/user_cv/utils.go @@ -78,6 +78,13 @@ func IfLogout(logoutTime int64) bool { return logoutTime > 0 && time.Now().Unix() > logoutTime } +func IfLogoutMedals(condition bool, trueVal, falseVal []uint32) []uint32 { + if condition { + return trueVal + } + return falseVal +} + func IfLogoutMedalInfo(condition bool, trueVal, falseVal []medal_cv.CvMedal) []medal_cv.CvMedal { if condition { return trueVal diff --git a/domain/service/user_s/user.go b/domain/service/user_s/user.go index f76cd7499e2bb020b0262ba619c2579b41c0a6c2..7a768badb8da20bae140eb870b44d237ad45f81d 100644 --- a/domain/service/user_s/user.go +++ b/domain/service/user_s/user.go @@ -285,6 +285,7 @@ func userToDetailOne(model *domain.Model, user *user_m.User, myUserId mysql.ID, IsOfficialStaff: isOfficialStaff, VipExpireTime: vipExpireTime, Svip: svip, + Medals: IfLogoutMedals(IfLogout(user.LogoutTime), []uint32{}, medals), MedalInfo: IfLogoutMedalInfo(IfLogout(user.LogoutTime), []medal_cv.CvMedal{}, medalInfo), Headwear: IfLogoutHeadwear(IfLogout(user.LogoutTime), nil, headwear), Ride: IfLogoutRide(IfLogout(user.LogoutTime), property_cv.CvProperty{}, ride), diff --git a/route/user_r/user.go b/route/user_r/user.go index a21243df4c03e0c47fa6127805e9c5168334e713..87cf5cf326d298e13e4651265e22c6d94280057e 100644 --- a/route/user_r/user.go +++ b/route/user_r/user.go @@ -89,7 +89,7 @@ func UserDetailByExternalId(c *gin.Context) (*mycontext.MyContext, error) { if n == 0 { // FIXME:转异步执行 err = tim_m.FlushHiloInfo(*cvUserDetail.ExternalId, cvUserDetail.IsVip, cvUserDetail.IsPrettyCode, - nil, cvUserDetail.MyGroupPowerName, cvUserDetail.Noble.Level) + cvUserDetail.Medals, cvUserDetail.MyGroupPowerName, cvUserDetail.Noble.Level) if err == nil { redisCli.GetRedis().Set(model, user_k.GetKeySyncTimHilo(userId), "1", time.Minute) } else {