feat: 用户中心

This commit is contained in:
Blizzard
2026-02-11 14:33:00 +08:00
parent 4ccab96ca2
commit 112a1f439c
17 changed files with 1571 additions and 138 deletions
+6
View File
@@ -0,0 +1,6 @@
package request
type UpdateProfile struct {
Nickname string `json:"nickname"`
AvatarId string `json:"avatarId"`
}
+1 -1
View File
@@ -8,5 +8,5 @@ type LevelConfig struct {
Level int `json:"level" gorm:"column:level"` // 等级数值
Title string `json:"title" gorm:"column:title"` // 等级称号 (e.g., "萌芽园丁")
MinSunlight int64 `json:"minSunlight" gorm:"column:min_sunlight"` // 达到该等级所需的最小阳光值
Perks string `json:"perks" gorm:"column:column:perks"` // 解锁权益描述 (e.g., "解锁智能诊断")
Perks string `json:"perks" gorm:"column:perks"` // 解锁权益描述 (e.g., "解锁智能诊断")
}
+21
View File
@@ -0,0 +1,21 @@
package plant
import (
"sundynix-go/global"
"sundynix-go/model/system"
)
type UserProfile struct {
global.BaseModel
UserId string `json:"userId" gorm:"index;column:user_id"`
Nickname string `json:"nickname" gorm:"column:nick_name"`
AvatarId string `json:"avatarId" gorm:"column:avatar_id"`
LevelId string `json:"levelId" gorm:"column:level_id"` // 当前等级id
CurrentSunlight int64 `json:"currentSunlight" gorm:"column:current_sunlight"` // 当前持有阳光值 (可消耗)
TotalSunlight int64 `json:"totalSunlight" gorm:"column:total_sunlight"` // 历史累计阳光值 (用于计算等级)
PlantCount int64 `json:"plantCount" gorm:"column:plant_count"`
CareCount int64 `json:"careCount" gorm:"column:care_count"`
PostCount int64 `json:"postCount" gorm:"column:post_count"`
Avatar *system.Oss `json:"avatar" gorm:"foreignKey:AvatarId"`
Level *LevelConfig `json:"level" gorm:"foreignKey:LevelId"`
}