package controller import ( "github.com/gin-gonic/gin" "net/http" "service/api/base" "service/api/consts" "service/api/proto/firenze" "service/library/middleware" ) func Init(r *gin.Engine) { r.HandleMethodNotAllowed = true r.GET("/", WsHandler) r.GET("/ws", WsHandler) r.POST("/send_biz_msg", middleware.JSONParamValidator(firenze.SendBizMsgParam{}), SendBizMsgHandler) r.POST("/live_mids", LiveMidsHandler) } func ReplyOk(ctx *gin.Context, data any) { ctx.JSON(http.StatusOK, base.BaseResponse{ Ret: consts.RetCodeSuccess, ErrCode: consts.ErrorCodeSuccess, Data: data, }) } func ReplyErrorMsg(ctx *gin.Context, msg string) { ctx.AbortWithStatusJSON(http.StatusOK, base.BaseResponse{ Ret: consts.RetCodeFail, ErrCode: consts.ErrorCodeFail, Msg: msg, }) }