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

112 lines
3.3 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. // PageCustomerService
  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.PageCustomerServiceReq true "相关参数"
  16. // @Success 200 {object} md.GetBasicResp "设置列表"
  17. // @Failure 400 {object} md.Response "具体错误"
  18. // @Router /api/im/pageCustomerService [POST]
  19. func PageCustomerService(c *gin.Context) {
  20. var req *md.PageCustomerServiceReq
  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.PageCustomerService(*req)
  26. if err != nil {
  27. e.OutErr(c, e.ERR, err.Error())
  28. return
  29. }
  30. e.OutSuc(c, resp, nil)
  31. }
  32. // AddCustomerService
  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.AddCustomerServiceReq true "相关参数"
  40. // @Success 200 {string} "success"
  41. // @Failure 400 {object} md.Response "具体错误"
  42. // @Router /api/im/addCustomerService [post]
  43. func AddCustomerService(c *gin.Context) {
  44. var req *md.AddCustomerServiceReq
  45. if err1 := c.ShouldBindJSON(&req); err1 != nil {
  46. e.OutErr(c, e.ERR_INVALID_ARGS, err1.Error())
  47. return
  48. }
  49. err := svc.AddCustomerService(*req)
  50. if err != nil {
  51. e.OutErr(c, e.ERR, err.Error())
  52. return
  53. }
  54. e.OutSuc(c, "success", nil)
  55. }
  56. // SetCustomerServiceState
  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.SetCustomerServiceStateReq true "相关参数"
  64. // @Success 200 {string} "success"
  65. // @Failure 400 {object} md.Response "具体错误"
  66. // @Router /api/im/setCustomerServiceState [post]
  67. func SetCustomerServiceState(c *gin.Context) {
  68. var req *md.SetCustomerServiceStateReq
  69. if err1 := c.ShouldBindJSON(&req); err1 != nil {
  70. e.OutErr(c, e.ERR_INVALID_ARGS, err1.Error())
  71. return
  72. }
  73. err := svc.SetCustomerServiceState(*req)
  74. if err != nil {
  75. e.OutErr(c, e.ERR, err.Error())
  76. return
  77. }
  78. e.OutSuc(c, "success", nil)
  79. }
  80. // UpdateCustomerServiceMemo
  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.UpdateCustomerServiceMemoReq true "相关参数"
  88. // @Success 200 {string} "success"
  89. // @Failure 400 {object} md.Response "具体错误"
  90. // @Router /api/im/updateCustomerServiceMemo [post]
  91. func UpdateCustomerServiceMemo(c *gin.Context) {
  92. var req *md.UpdateCustomerServiceMemoReq
  93. if err1 := c.ShouldBindJSON(&req); err1 != nil {
  94. e.OutErr(c, e.ERR_INVALID_ARGS, err1.Error())
  95. return
  96. }
  97. err := svc.UpdateCustomerServiceMemo(*req)
  98. if err != nil {
  99. e.OutErr(c, e.ERR, err.Error())
  100. return
  101. }
  102. e.OutSuc(c, "success", nil)
  103. }