dc54c4e934
- Introduced new API endpoints `GET /api/v1/smoke/profile` and `PUT /api/v1/smoke/profile` for retrieving and updating user smoking profiles. - Added a new database table `fa_smoke_user_profile` to store user-specific smoking data, including daily smoking habits and motivations. - Updated the smoke handler and service to integrate user profile data into AI advice generation. - Enhanced documentation to reflect the new user profile features and their usage.
30 lines
1023 B
Go
30 lines
1023 B
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.PUT("/profile", smokeHandler.UpsertProfile)
|
|
|
|
smoke.GET("/dashboard", smokeHandler.Dashboard)
|
|
smoke.POST("/logs", smokeHandler.Create)
|
|
smoke.GET("/logs", smokeHandler.List)
|
|
smoke.GET("/logs/latest", smokeHandler.LatestLogs)
|
|
smoke.GET("/logs/:id", smokeHandler.Get)
|
|
smoke.PUT("/logs/:id", smokeHandler.Update)
|
|
smoke.DELETE("/logs/:id", smokeHandler.Delete)
|
|
|
|
// AI 戒烟建议(会员优先;非会员需看广告解锁)
|
|
smoke.GET("/ai/advice", smokeHandler.GetAIAdvice)
|
|
smoke.POST("/ai/advice_unlocks", smokeHandler.UnlockAIAdvice)
|
|
}
|
|
}
|