3154365ab2
- Introduced a new database model `SmokeMotivationQuote` for storing motivational quotes. - Added a new API endpoint `GET /api/v1/smoke/motivation` to retrieve motivation quotes for users. - Updated the main.go file to include the new model in the auto-migration process. - Enhanced smoke_routes.go to register the new motivation route with the smoke handler.
30 lines
1.3 KiB
Go
30 lines
1.3 KiB
Go
package model
|
|
|
|
import (
|
|
"time"
|
|
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
// SmokeMotivationQuote 存储不同场景的激励语模板(可附带 AI 提示词)。
|
|
type SmokeMotivationQuote struct {
|
|
ID uint `gorm:"primaryKey;autoIncrement;comment:记录ID" json:"id"`
|
|
Scene string `gorm:"column:scene;size:40;index:idx_smoke_motivation_scene;comment:场景类型" json:"scene"`
|
|
Type string `gorm:"column:type;size:30;comment:文案类型" json:"type"`
|
|
Message string `gorm:"column:message;type:text;comment:展示文案" json:"message"`
|
|
AIPrompt string `gorm:"column:ai_prompt;type:text;comment:AI提示词" json:"ai_prompt,omitempty"`
|
|
Enabled bool `gorm:"column:enabled;default:true;comment:是否启用" json:"enabled"`
|
|
Weight int `gorm:"column:weight;default:1;comment:权重(越大越优先)" json:"weight"`
|
|
CreatedAt time.Time `gorm:"comment:创建时间" json:"created_at"`
|
|
UpdatedAt time.Time `gorm:"comment:更新时间" json:"updated_at"`
|
|
DeletedAt gorm.DeletedAt `gorm:"index;comment:删除时间" json:"-"`
|
|
}
|
|
|
|
func (SmokeMotivationQuote) TableName() string {
|
|
return "fa_smoke_motivation_quote"
|
|
}
|
|
|
|
func (SmokeMotivationQuote) TableComment() string {
|
|
return "戒烟-激励语模板"
|
|
}
|