chatroom_manager.go 778 B

123456789101112131415161718192021222324252627282930313233
  1. package controllers
  2. import (
  3. //"fmt"
  4. "github.com/gin-gonic/gin"
  5. "lzyd-message-api/common"
  6. "lzyd-message-api/services"
  7. )
  8. // @tags 房间操作
  9. // @Description 获取房间详情
  10. // @Summary 获取房间详情
  11. // @Accept json
  12. // @Produce json
  13. // @Param room_id query string true "房间id"
  14. // @Success 200 {string} json "{"code":200, "message":"success"}"
  15. // @Router /api/chatroom/detail [get]
  16. func ChatroomDetail(c *gin.Context) {
  17. roomId := c.Query("room_id")
  18. if roomId == "" || roomId == "0"{
  19. common.ReturnFailureMsg(c, common.InternalError, "room_id 不能为空")
  20. return
  21. }
  22. err,data := services.ChatroomDetail(common.DB, roomId)
  23. if err != nil {
  24. common.ReturnFailureMsg(c, common.InternalError, err.Error())
  25. return
  26. }
  27. common.ReturnSuccess(c, data)
  28. }