zhangzengfei
2024-05-17 9e8d8b630affc4a4be428c775264ef4b0e5104b3
controller/subscribeCtl.go
@@ -1,13 +1,14 @@
package controller
import (
   "net/http"
   "strings"
   "time"
   "gat1400Exchange/config"
   "gat1400Exchange/pkg/logger"
   "gat1400Exchange/repository"
   "gat1400Exchange/vo"
   "net/http"
   "strings"
   "time"
   "github.com/gin-gonic/gin"
)
@@ -172,3 +173,22 @@
   c.JSON(http.StatusOK, gin.H{"msg": "ok"})
}
func (s SubscribeController) CancelSubscribes(c *gin.Context) {
   var req vo.Subscribe
   if err := c.BindJSON(&req); err != nil {
      c.JSON(http.StatusBadRequest, gin.H{"msg": err.Error()})
      return
   }
   if c.Param("id") == "" {
      c.JSON(http.StatusBadRequest, gin.H{"msg": "下级id为空"})
   }
   if err := s.Repository.CancelSubscribe(c.Param("id"), &req); err != nil {
      c.JSON(http.StatusInternalServerError, gin.H{"msg": err.Error()})
      return
   }
   c.JSON(http.StatusOK, gin.H{"msg": "ok"})
}