Enhance smoking tracking API and documentation

- Updated the main.go file to set the local time zone to Asia/Shanghai.
- Changed API endpoints from `PUT` to `POST` for user profile and logs management in multiple documentation files to reflect the correct usage.
- Added new fields in the API response for home summary, including `last_smoke_at`, `today_count`, `resisted_count`, and `reduced_from_yesterday`.
- Enhanced documentation across various files to accurately describe the updated API endpoints and their expected behaviors.
This commit is contained in:
nepiedg
2026-01-25 07:55:32 +00:00
parent be6d579d41
commit b67dc32369
12 changed files with 758 additions and 37 deletions
+2 -2
View File
@@ -12,7 +12,7 @@ func registerSmokeRoutes(protected *gin.RouterGroup, smokeHandler *smokehandler.
{
// 首次进入/基础信息(用于基准、AI 个性化、作息规避等)
smoke.GET("/profile", smokeHandler.GetProfile)
smoke.PUT("/profile", smokeHandler.UpsertProfile)
smoke.POST("/profile", smokeHandler.UpsertProfile)
// 不使用 AI 时的默认“下次抽烟时间”建议(阶梯式延时)
smoke.GET("/next_smoke_time", smokeHandler.GetNextSmokeTime)
@@ -23,7 +23,7 @@ func registerSmokeRoutes(protected *gin.RouterGroup, smokeHandler *smokehandler.
smoke.GET("/logs", smokeHandler.List)
smoke.GET("/logs/latest", smokeHandler.LatestLogs)
smoke.GET("/logs/:id", smokeHandler.Get)
smoke.PUT("/logs/:id", smokeHandler.Update)
smoke.POST("/logs/:id", smokeHandler.Update)
smoke.DELETE("/logs/:id", smokeHandler.Delete)
// AI 戒烟建议(会员优先;非会员需看广告解锁)