fix: 成长报告海报用宠物真实头像(没传才用 emoji)
- 后端 Poster 增 pet_avatar_url(取 pet.AvatarURL,和身份卡同一可靠路径) - 海报 canvas 优先用它、store 兜底;有照片画圆形头像、没有才 emoji - 头像九参数居中裁剪,竖图/横图都不压扁 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -199,6 +199,7 @@ func (s *Service) GetHealthSummary(userID, petID string) (*HealthSummary, error)
|
||||
type Poster struct {
|
||||
PetName string `json:"pet_name"`
|
||||
PetEmoji string `json:"pet_emoji"`
|
||||
PetAvatarURL string `json:"pet_avatar_url"` // 上传过照片就有,海报优先用它,没有才用 emoji
|
||||
Age string `json:"age"`
|
||||
Weight string `json:"weight"`
|
||||
Stage string `json:"stage"`
|
||||
@@ -223,7 +224,8 @@ func (s *Service) GetPoster(userID, petID string) (*Poster, error) {
|
||||
s.db.Model(&model.HealthRecord{}).Where("pet_id = ? AND type = ?", petID, model.RecordVaccine).Count(&vaccineRecs)
|
||||
|
||||
return &Poster{
|
||||
PetName: pet.Name, PetEmoji: pet.Emoji, Age: pet.Age, Weight: pet.Weight, Stage: pet.Stage,
|
||||
PetName: pet.Name, PetEmoji: pet.Emoji, PetAvatarURL: pet.AvatarURL,
|
||||
Age: pet.Age, Weight: pet.Weight, Stage: pet.Stage,
|
||||
TasksCompleted: tasksDone, WeightRecords: weightRecs, VaccineRecords: vaccineRecs,
|
||||
HighRiskCount: 0, Headline: "稳定成长",
|
||||
}, nil
|
||||
|
||||
Reference in New Issue
Block a user