You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Open-IM-Server/pkg/common/http/http_resp.go

24 lines
422 B

3 years ago
package http
3 years ago
import (
"Open_IM/pkg/common/constant"
"net/http"
"github.com/gin-gonic/gin"
)
type BaseResp struct {
Code int32 `json:"code"`
ErrMsg string `json:"err_msg"`
Data interface{} `json:"data"`
}
func RespHttp200(ctx *gin.Context, err constant.ErrInfo, data interface{}) {
resp := BaseResp{
Code: err.Code(),
ErrMsg: err.Error(),
Data: data,
}
ctx.JSON(http.StatusOK, resp)
}