mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-05-20 11:39:18 +08:00
24 lines
422 B
Go
24 lines
422 B
Go
package http
|
|
|
|
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)
|
|
}
|