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.
39 lines
1.4 KiB
Go
39 lines
1.4 KiB
Go
package routes
|
|
|
|
import (
|
|
"github.com/gin-gonic/gin"
|
|
|
|
smokehandler "wx_service/internal/smoke/handler"
|
|
)
|
|
|
|
func registerSmokeRoutes(protected *gin.RouterGroup, smokeHandler *smokehandler.SmokeHandler) {
|
|
// 戒烟/抽烟记录(与 video 去水印功能在路由前缀上区分开)
|
|
smoke := protected.Group("/smoke")
|
|
{
|
|
// 首次进入/基础信息(用于基准、AI 个性化、作息规避等)
|
|
smoke.GET("/profile", smokeHandler.GetProfile)
|
|
smoke.POST("/profile", smokeHandler.UpsertProfile)
|
|
|
|
// 不使用 AI 时的默认“下次抽烟时间”建议(阶梯式延时)
|
|
smoke.GET("/next_smoke_time", smokeHandler.GetNextSmokeTime)
|
|
|
|
smoke.GET("/dashboard", smokeHandler.Dashboard)
|
|
smoke.GET("/stats", smokeHandler.Stats)
|
|
smoke.POST("/logs", smokeHandler.Create)
|
|
smoke.POST("/logs/resisted", smokeHandler.Resist)
|
|
smoke.GET("/logs", smokeHandler.List)
|
|
smoke.GET("/logs/latest", smokeHandler.LatestLogs)
|
|
smoke.GET("/logs/:id", smokeHandler.Get)
|
|
smoke.POST("/logs/:id", smokeHandler.Update)
|
|
smoke.DELETE("/logs/:id", smokeHandler.Delete)
|
|
smoke.GET("/motivation", smokeHandler.Motivation)
|
|
|
|
// AI 戒烟建议(会员优先;非会员需看广告解锁)
|
|
smoke.GET("/ai/advice", smokeHandler.GetAIAdvice)
|
|
smoke.POST("/ai/advice_unlocks", smokeHandler.UnlockAIAdvice)
|
|
|
|
// AI 下次抽烟时间建议(结构化时间节点)
|
|
smoke.GET("/ai/next_smoke_time", smokeHandler.GetAINextSmokeTime)
|
|
}
|
|
}
|