蛋蛋星球 后台端
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

138 lines
3.9 KiB

  1. package im
  2. import (
  3. "applet/app/e"
  4. md "applet/app/md/im"
  5. svc "applet/app/svc/im"
  6. "github.com/gin-gonic/gin"
  7. )
  8. // PageEmoticon
  9. // @Summary Im-表情包(列表)
  10. // @Tags 表情包
  11. // @Description 表情包(列表)
  12. // @Accept json
  13. // @Produce json
  14. // @param Authorization header string true "验证参数Bearer和token空格拼接"
  15. // @param req body md.PageEmoticonReq true "相关参数"
  16. // @Success 200 {object} md.GetBasicResp "设置列表"
  17. // @Failure 400 {object} md.Response "具体错误"
  18. // @Router /api/im/pageEmoticon [POST]
  19. func PageEmoticon(c *gin.Context) {
  20. var req *md.PageEmoticonReq
  21. if err1 := c.ShouldBindJSON(&req); err1 != nil {
  22. e.OutErr(c, e.ERR_INVALID_ARGS, err1.Error())
  23. return
  24. }
  25. err, resp := svc.PageEmoticon(*req)
  26. if err != nil {
  27. e.OutErr(c, e.ERR, err.Error())
  28. return
  29. }
  30. e.OutSuc(c, resp, nil)
  31. }
  32. // AddEmoticon
  33. // @Summary Im-表情包(新增)
  34. // @Tags 表情包
  35. // @Description 表情包(新增)
  36. // @Accept json
  37. // @Produce json
  38. // @param Authorization header string true "验证参数Bearer和token空格拼接"
  39. // @param req body md.AddEmoticonReq true "相关参数"
  40. // @Success 200 {string} "success"
  41. // @Failure 400 {object} md.Response "具体错误"
  42. // @Router /api/im/addEmoticon [post]
  43. func AddEmoticon(c *gin.Context) {
  44. var req *md.AddEmoticonReq
  45. if err1 := c.ShouldBindJSON(&req); err1 != nil {
  46. e.OutErr(c, e.ERR_INVALID_ARGS, err1.Error())
  47. return
  48. }
  49. err := svc.AddEmoticon(*req)
  50. if err != nil {
  51. e.OutErr(c, e.ERR, err.Error())
  52. return
  53. }
  54. e.OutSuc(c, "success", nil)
  55. }
  56. // SetEmoticonState
  57. // @Summary Im-表情包(更新状态)
  58. // @Tags 表情包
  59. // @Description 表情包(新增)
  60. // @Accept json
  61. // @Produce json
  62. // @param Authorization header string true "验证参数Bearer和token空格拼接"
  63. // @param req body md.SetEmoticonStateReq true "相关参数"
  64. // @Success 200 {string} "success"
  65. // @Failure 400 {object} md.Response "具体错误"
  66. // @Router /api/im/setEmoticonState [post]
  67. func SetEmoticonState(c *gin.Context) {
  68. var req *md.SetEmoticonStateReq
  69. if err1 := c.ShouldBindJSON(&req); err1 != nil {
  70. e.OutErr(c, e.ERR_INVALID_ARGS, err1.Error())
  71. return
  72. }
  73. err := svc.SetEmoticonState(*req)
  74. if err != nil {
  75. e.OutErr(c, e.ERR, err.Error())
  76. return
  77. }
  78. e.OutSuc(c, "success", nil)
  79. }
  80. // UpdateEmoticon
  81. // @Summary Im-表情包(编辑)
  82. // @Tags 表情包
  83. // @Description 表情包(编辑)
  84. // @Accept json
  85. // @Produce json
  86. // @param Authorization header string true "验证参数Bearer和token空格拼接"
  87. // @param req body md.UpdateEmoticonReq true "相关参数"
  88. // @Success 200 {string} "success"
  89. // @Failure 400 {object} md.Response "具体错误"
  90. // @Router /api/im/updateEmoticon [post]
  91. func UpdateEmoticon(c *gin.Context) {
  92. var req *md.UpdateEmoticonReq
  93. if err1 := c.ShouldBindJSON(&req); err1 != nil {
  94. e.OutErr(c, e.ERR_INVALID_ARGS, err1.Error())
  95. return
  96. }
  97. err := svc.UpdateEmoticon(*req)
  98. if err != nil {
  99. e.OutErr(c, e.ERR, err.Error())
  100. return
  101. }
  102. e.OutSuc(c, "success", nil)
  103. }
  104. // DeleteEmoticon
  105. // @Summary Im-表情包(删除)
  106. // @Tags 表情包
  107. // @Description 表情包(删除)
  108. // @Accept json
  109. // @Produce json
  110. // @param Authorization header string true "验证参数Bearer和token空格拼接"
  111. // @param req body md.DeleteEmoticonReq true "相关参数"
  112. // @Success 200 {string} "success"
  113. // @Failure 400 {object} md.Response "具体错误"
  114. // @Router /api/im/deleteEmoticon [post]
  115. func DeleteEmoticon(c *gin.Context) {
  116. var req *md.DeleteEmoticonReq
  117. if err1 := c.ShouldBindJSON(&req); err1 != nil {
  118. e.OutErr(c, e.ERR_INVALID_ARGS, err1.Error())
  119. return
  120. }
  121. err := svc.DeleteEmoticon(*req)
  122. if err != nil {
  123. e.OutErr(c, e.ERR, err.Error())
  124. return
  125. }
  126. e.OutSuc(c, "success", nil)
  127. }