为 Spark Messenger 主路径补齐 POST /v1/friends/requests/reject,并落地法律协议/反馈/订阅/密码登录及管理页,同步 OpenAPI 文档。 Co-authored-by: Cursor <cursoragent@cursor.com>
62 lines
1.3 KiB
Go
62 lines
1.3 KiB
Go
package clienthandler
|
|
|
|
import (
|
|
"github.com/gin-gonic/gin"
|
|
|
|
clientlogic "spark-server/internal/module/client/logic"
|
|
"spark-server/internal/transport/http/respond"
|
|
)
|
|
|
|
type Handler struct {
|
|
svc *clientlogic.Service
|
|
}
|
|
|
|
func New(svc *clientlogic.Service) *Handler {
|
|
return &Handler{svc: svc}
|
|
}
|
|
|
|
func (h *Handler) LegalAgreements(c *gin.Context) {
|
|
out, err := h.svc.LegalAgreements(c.Request.Context())
|
|
if err != nil {
|
|
respond.JSONError(c, err)
|
|
return
|
|
}
|
|
respond.JSON(c, out)
|
|
}
|
|
|
|
func (h *Handler) SubmitFeedback(c *gin.Context) {
|
|
var in clientlogic.FeedbackInput
|
|
if err := respond.BindJSON(c, &in); err != nil {
|
|
respond.JSONError(c, err)
|
|
return
|
|
}
|
|
out, err := h.svc.SubmitFeedback(c.Request.Context(), in)
|
|
if err != nil {
|
|
respond.JSONError(c, err)
|
|
return
|
|
}
|
|
respond.JSON(c, out)
|
|
}
|
|
|
|
func (h *Handler) SubscriptionPlans(c *gin.Context) {
|
|
out, err := h.svc.SubscriptionPlans(c.Request.Context())
|
|
if err != nil {
|
|
respond.JSONError(c, err)
|
|
return
|
|
}
|
|
respond.JSON(c, out)
|
|
}
|
|
|
|
func (h *Handler) SetPassword(c *gin.Context) {
|
|
var in clientlogic.SetPasswordInput
|
|
if err := respond.BindJSON(c, &in); err != nil {
|
|
respond.JSONError(c, err)
|
|
return
|
|
}
|
|
if err := h.svc.SetPassword(c.Request.Context(), in); err != nil {
|
|
respond.JSONError(c, err)
|
|
return
|
|
}
|
|
respond.JSON(c, gin.H{})
|
|
}
|