feat: 戒烟成就、梦想图标预设、打卡统计与依赖注入调整

- 成就系统、连续打卡天数计算、管理后台成就 CRUD
- 梦想目标图标预设 DreamPreset 与用户端 dream-presets 接口
- 管理后台梦想图标 CRUD;戒烟打卡 summary 修正
- 忽略根目录编译产物 /api

Made-with: Cursor
This commit is contained in:
nepiedg
2026-04-04 14:55:50 +08:00
parent 1c0aeb152a
commit fd097729d7
20 changed files with 849 additions and 12 deletions
+43
View File
@@ -0,0 +1,43 @@
package achievement
import (
"time"
"gorm.io/gorm"
)
type Theme struct {
ID uint `gorm:"primaryKey" json:"id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
Name string `gorm:"size:50;not null;comment:主题名称" json:"name"`
Key string `gorm:"size:50;uniqueIndex;not null;comment:主题标识" json:"key"`
Icon string `gorm:"size:255;comment:主题图标" json:"icon"`
SortOrder int `gorm:"default:0;comment:排序" json:"sort_order"`
IsActive bool `gorm:"default:true;comment:是否启用" json:"is_active"`
Levels []Level `gorm:"foreignKey:ThemeID" json:"levels,omitempty"`
}
func (Theme) TableName() string {
return "fa_achievement_theme"
}
type Level struct {
ID uint `gorm:"primaryKey" json:"id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
ThemeID uint `gorm:"index;not null;comment:主题ID" json:"theme_id"`
Name string `gorm:"size:50;not null;comment:等级名称" json:"name"`
Icon string `gorm:"size:255;comment:等级图标" json:"icon"`
RequiredDays int `gorm:"not null;default:0;comment:所需打卡天数" json:"required_days"`
SortOrder int `gorm:"default:0;comment:排序" json:"sort_order"`
}
func (Level) TableName() string {
return "fa_achievement_level"
}