first commit

This commit is contained in:
2026-09-11 01:41:52 +08:00
commit 9f22e6ccae
263 changed files with 28935 additions and 0 deletions
+35
View File
@@ -0,0 +1,35 @@
package v1
import (
"git.lzcwy.cn/zhengchiliu/zt-closet-backend/internal/middleware"
"git.lzcwy.cn/zhengchiliu/zt-closet-backend/internal/service"
"git.lzcwy.cn/zhengchiliu/zt-closet-backend/pkg/app"
"git.lzcwy.cn/zhengchiliu/zt-closet-backend/pkg/errcode"
"github.com/gin-gonic/gin"
)
// HoroscopeHandler 今日运势接口。
type HoroscopeHandler struct {
svc *service.HoroscopeService
}
// NewHoroscopeHandler 创建运势 handler。
func NewHoroscopeHandler() *HoroscopeHandler {
return &HoroscopeHandler{svc: service.NewHoroscopeService()}
}
// Today 获取当前用户今日运势。
func (h *HoroscopeHandler) Today(c *gin.Context) {
response := app.NewResponse(c)
userID, ok := middleware.GetUserID(c.Request.Context())
if !ok {
response.ToErrorResponse(errcode.Unauthorized)
return
}
out, e := h.svc.GetToday(c.Request.Context(), userID)
if e != nil {
response.ToErrorResponse(e)
return
}
response.ToResponse(out)
}