package handler import ( "net/http" "time" "github.com/gin-gonic/gin" "wx_service/internal/middleware" "wx_service/internal/model" ) func (h *SmokeHandler) Motivation(c *gin.Context) { user := middleware.MustCurrentUser(c) profile, err := h.smokeProfileService.Get(c.Request.Context(), int(user.ID)) if err != nil { c.JSON(http.StatusInternalServerError, model.Error(http.StatusInternalServerError, "获取基础信息失败,请稍后重试")) return } result, err := h.smokeLogService.Motivation(c.Request.Context(), int(user.ID), time.Now().In(time.Local), profile) if err != nil { c.JSON(http.StatusInternalServerError, model.Error(http.StatusInternalServerError, "生成激励语失败,请稍后重试")) return } c.JSON(http.StatusOK, model.Success(result)) }