Files
kra-new/internal/server/handler/live_chat.go
T

29 lines
602 B
Go

package handler
import (
"github.com/gin-gonic/gin"
"kra/internal/service/dto"
service "kra/internal/service/livechat"
)
type LiveChat struct{ service *service.Service }
func NewLiveChat(service *service.Service) *LiveChat { return &LiveChat{service: service} }
func (h *LiveChat) History(c *gin.Context) {
roomID, ok := businessID(c)
if !ok {
return
}
in, ok := bindQuery[dto.LiveChatHistoryRequest](c)
if !ok {
return
}
items, err := h.service.History(c.Request.Context(), roomID, in.Limit)
if err != nil {
businessFail(c, err)
return
}
OKWithData(c, gin.H{"list": items})
}