Files
wx_service/internal/routes/smoke_routes.go
T
nepiedg 16844d4a42 Enhance AI and Redis integration for smoke logging features
- Added AI configuration options to .env.example and config.go for OpenAI integration.
- Implemented Redis caching for session management in main.go and auth middleware.
- Updated smoke logging service to support real smoking time (`smoke_at`) and AI advice retrieval.
- Enhanced API routes to include endpoints for AI advice and unlock functionality for non-members.
- Improved database schema with new tables for AI advice and unlock records.
- Expanded documentation to cover new AI features and Redis caching implementation.
2026-01-03 02:14:21 +00:00

24 lines
736 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")
{
smoke.POST("/logs", smokeHandler.Create)
smoke.GET("/logs", smokeHandler.List)
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)
}
}