mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-19 00:09:02 +08:00
Merge remote-tracking branch 'origin/superGroup' into superGroup
This commit is contained in:
+3697
-13
File diff suppressed because it is too large
Load Diff
+3697
-13
File diff suppressed because it is too large
Load Diff
+2463
-10
File diff suppressed because it is too large
Load Diff
@@ -16,6 +16,18 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// @Summary 用户登录
|
||||||
|
// @Description 用户登录
|
||||||
|
// @Tags 鉴权认证
|
||||||
|
// @ID UserRegister
|
||||||
|
// @Accept json
|
||||||
|
// @Param token header string true "im token"
|
||||||
|
// @Param req body api.UserRegisterReq true "secret为openIM密钥, 详细见服务端config.yaml secret字段 <br> platform为平台ID <br> ex为拓展字段"
|
||||||
|
// @Produce json
|
||||||
|
// @Success 0 {object} api.UserRegisterResp
|
||||||
|
// @Failure 500 {object} api.UserRegisterResp "errCode为500 一般为服务器内部错误"
|
||||||
|
// @Failure 400 {object} api.UserRegisterResp "errCode为400 一般为参数输入错误, token未带上等"
|
||||||
|
// @Router /auth/user_register [post]
|
||||||
func UserRegister(c *gin.Context) {
|
func UserRegister(c *gin.Context) {
|
||||||
params := api.UserRegisterReq{}
|
params := api.UserRegisterReq{}
|
||||||
if err := c.BindJSON(¶ms); err != nil {
|
if err := c.BindJSON(¶ms); err != nil {
|
||||||
@@ -73,6 +85,18 @@ func UserRegister(c *gin.Context) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Summary 用户登录
|
||||||
|
// @Description 获取用户的token
|
||||||
|
// @Tags 鉴权认证
|
||||||
|
// @ID UserToken
|
||||||
|
// @Accept json
|
||||||
|
// @Param token header string true "im token"
|
||||||
|
// @Param req body api.UserTokenReq true "secret为openIM密钥, 详细见服务端config.yaml secret字段, platform为平台ID"
|
||||||
|
// @Produce json
|
||||||
|
// @Success 0 {object} api.UserTokenResp
|
||||||
|
// @Failure 500 {object} api.UserTokenResp "errCode为500 一般为服务器内部错误"
|
||||||
|
// @Failure 400 {object} api.UserTokenResp "errCode为400 一般为参数输入错误, token未带上等"
|
||||||
|
// @Router /auth/user_token [post]
|
||||||
func UserToken(c *gin.Context) {
|
func UserToken(c *gin.Context) {
|
||||||
params := api.UserTokenReq{}
|
params := api.UserTokenReq{}
|
||||||
if err := c.BindJSON(¶ms); err != nil {
|
if err := c.BindJSON(¶ms); err != nil {
|
||||||
@@ -111,6 +135,18 @@ func UserToken(c *gin.Context) {
|
|||||||
c.JSON(http.StatusOK, resp)
|
c.JSON(http.StatusOK, resp)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Summary 解析token
|
||||||
|
// @Description 解析用户token
|
||||||
|
// @Tags 鉴权认证
|
||||||
|
// @ID ParseToken
|
||||||
|
// @Accept json
|
||||||
|
// @Param token header string true "im token"
|
||||||
|
// @Param req body api.ParseTokenReq true "secret为openIM密钥, 详细见服务端config.yaml secret字段, platform为平台ID"
|
||||||
|
// @Produce json
|
||||||
|
// @Success 0 {object} api.ParseTokenResp
|
||||||
|
// @Failure 500 {object} api.ParseTokenResp "errCode为500 一般为服务器内部错误"
|
||||||
|
// @Failure 400 {object} api.ParseTokenResp "errCode为400 一般为参数输入错误, token未带上等"
|
||||||
|
// @Router /auth/parse_token [post]
|
||||||
func ParseToken(c *gin.Context) {
|
func ParseToken(c *gin.Context) {
|
||||||
params := api.ParseTokenReq{}
|
params := api.ParseTokenReq{}
|
||||||
if err := c.BindJSON(¶ms); err != nil {
|
if err := c.BindJSON(¶ms); err != nil {
|
||||||
@@ -137,6 +173,18 @@ func ParseToken(c *gin.Context) {
|
|||||||
c.JSON(http.StatusOK, resp)
|
c.JSON(http.StatusOK, resp)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Summary 强制登出
|
||||||
|
// @Description 对应的平台强制登出
|
||||||
|
// @Tags 鉴权认证
|
||||||
|
// @ID ForceLogout
|
||||||
|
// @Accept json
|
||||||
|
// @Param token header string true "im token"
|
||||||
|
// @Param req body api.ForceLogoutReq true "platform为平台ID, fromUserID为要执行强制登出的用户ID"
|
||||||
|
// @Produce json
|
||||||
|
// @Success 0 {object} api.ForceLogoutResp
|
||||||
|
// @Failure 500 {object} api.ForceLogoutResp "errCode为500 一般为服务器内部错误"
|
||||||
|
// @Failure 400 {object} api.ForceLogoutResp "errCode为400 一般为参数输入错误, token未带上等"
|
||||||
|
// @Router /auth/force_logout [post]
|
||||||
func ForceLogout(c *gin.Context) {
|
func ForceLogout(c *gin.Context) {
|
||||||
params := api.ForceLogoutReq{}
|
params := api.ForceLogoutReq{}
|
||||||
if err := c.BindJSON(¶ms); err != nil {
|
if err := c.BindJSON(¶ms); err != nil {
|
||||||
|
|||||||
@@ -16,6 +16,18 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// @Summary 根据seq列表删除消息
|
||||||
|
// @Description 根据seq列表删除消息
|
||||||
|
// @Tags 消息相关
|
||||||
|
// @ID DelMsg
|
||||||
|
// @Accept json
|
||||||
|
// @Param token header string true "im token"
|
||||||
|
// @Param req body api.DelMsgReq true "userID为要删除的用户ID <br> seqList为seq列表"
|
||||||
|
// @Produce json
|
||||||
|
// @Success 0 {object} api.DelMsgResp
|
||||||
|
// @Failure 500 {object} api.DelMsgResp "errCode为500 一般为服务器内部错误"
|
||||||
|
// @Failure 400 {object} api.DelMsgResp "errCode为400 一般为参数输入错误, token未带上等"
|
||||||
|
// @Router /msg/del_msg [post]
|
||||||
func DelMsg(c *gin.Context) {
|
func DelMsg(c *gin.Context) {
|
||||||
var (
|
var (
|
||||||
req api.DelMsgReq
|
req api.DelMsgReq
|
||||||
@@ -30,6 +42,17 @@ func DelMsg(c *gin.Context) {
|
|||||||
if err := utils.CopyStructFields(&reqPb, &req); err != nil {
|
if err := utils.CopyStructFields(&reqPb, &req); err != nil {
|
||||||
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields", err.Error())
|
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields", err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var ok bool
|
||||||
|
var errInfo string
|
||||||
|
ok, reqPb.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||||
|
if !ok {
|
||||||
|
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||||
|
log.NewError(req.OperationID, errMsg)
|
||||||
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
grpcConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfflineMessageName, req.OperationID)
|
grpcConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfflineMessageName, req.OperationID)
|
||||||
if grpcConn == nil {
|
if grpcConn == nil {
|
||||||
errMsg := req.OperationID + " getcdv3.GetConn == nil"
|
errMsg := req.OperationID + " getcdv3.GetConn == nil"
|
||||||
@@ -50,6 +73,18 @@ func DelMsg(c *gin.Context) {
|
|||||||
c.JSON(http.StatusOK, resp)
|
c.JSON(http.StatusOK, resp)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Summary 清空用户消息
|
||||||
|
// @Description 清空用户消息
|
||||||
|
// @Tags 消息相关
|
||||||
|
// @ID ClearMsg
|
||||||
|
// @Accept json
|
||||||
|
// @Param token header string true "im token"
|
||||||
|
// @Param req body api.CleanUpMsgReq true "userID为要清空的用户ID"
|
||||||
|
// @Produce json
|
||||||
|
// @Success 0 {object} api.CleanUpMsgResp
|
||||||
|
// @Failure 500 {object} api.CleanUpMsgResp "errCode为500 一般为服务器内部错误"
|
||||||
|
// @Failure 400 {object} api.CleanUpMsgResp "errCode为400 一般为参数输入错误, token未带上等"
|
||||||
|
// @Router /msg/clear_msg [post]
|
||||||
func ClearMsg(c *gin.Context) {
|
func ClearMsg(c *gin.Context) {
|
||||||
params := api.CleanUpMsgReq{}
|
params := api.CleanUpMsgReq{}
|
||||||
if err := c.BindJSON(¶ms); err != nil {
|
if err := c.BindJSON(¶ms); err != nil {
|
||||||
|
|||||||
@@ -16,6 +16,18 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// @Summary 添加黑名单
|
||||||
|
// @Description 添加黑名单
|
||||||
|
// @Tags 好友相关
|
||||||
|
// @ID AddBlack
|
||||||
|
// @Accept json
|
||||||
|
// @Param token header string true "im token"
|
||||||
|
// @Param req body api.AddBlacklistReq true "fromUserID为设置的用户, toUserID为被设置的用户"
|
||||||
|
// @Produce json
|
||||||
|
// @Success 0 {object} api.AddBlacklistResp
|
||||||
|
// @Failure 500 {object} api.AddBlacklistResp "errCode为500 一般为服务器内部错误"
|
||||||
|
// @Failure 400 {object} api.AddBlacklistResp "errCode为400 一般为参数输入错误, token未带上等"
|
||||||
|
// @Router /friend/add_black [post]
|
||||||
func AddBlack(c *gin.Context) {
|
func AddBlack(c *gin.Context) {
|
||||||
params := api.AddBlacklistReq{}
|
params := api.AddBlacklistReq{}
|
||||||
if err := c.BindJSON(¶ms); err != nil {
|
if err := c.BindJSON(¶ms); err != nil {
|
||||||
@@ -49,6 +61,18 @@ func AddBlack(c *gin.Context) {
|
|||||||
c.JSON(http.StatusOK, resp)
|
c.JSON(http.StatusOK, resp)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Summary 批量加好友
|
||||||
|
// @Description 批量加好友
|
||||||
|
// @Tags 好友相关
|
||||||
|
// @ID ImportFriend
|
||||||
|
// @Accept json
|
||||||
|
// @Param token header string true "im token"
|
||||||
|
// @Param req body api.ImportFriendReq true "fromUserID批量加好友的用户ID, friendUserIDList为"
|
||||||
|
// @Produce json
|
||||||
|
// @Success 0 {object} api.ImportFriendResp "data列表中对象的result-1为添加该用户失败, 0为成功"
|
||||||
|
// @Failure 500 {object} api.ImportFriendResp "errCode为500 一般为服务器内部错误"
|
||||||
|
// @Failure 400 {object} api.ImportFriendResp "errCode为400 一般为参数输入错误, token未带上等"
|
||||||
|
// @Router /friend/import_friend [post]
|
||||||
func ImportFriend(c *gin.Context) {
|
func ImportFriend(c *gin.Context) {
|
||||||
params := api.ImportFriendReq{}
|
params := api.ImportFriendReq{}
|
||||||
if err := c.BindJSON(¶ms); err != nil {
|
if err := c.BindJSON(¶ms); err != nil {
|
||||||
@@ -97,6 +121,18 @@ func ImportFriend(c *gin.Context) {
|
|||||||
c.JSON(http.StatusOK, resp)
|
c.JSON(http.StatusOK, resp)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Summary 添加好友
|
||||||
|
// @Description 添加好友
|
||||||
|
// @Tags 好友相关
|
||||||
|
// @ID AddFriend
|
||||||
|
// @Accept json
|
||||||
|
// @Param token header string true "im token"
|
||||||
|
// @Param req body api.AddFriendReq true "reqMsg为申请信息, fromUserID为申请用户, toUserID为被添加用户"
|
||||||
|
// @Produce json
|
||||||
|
// @Success 0 {object} api.AddFriendResp
|
||||||
|
// @Failure 500 {object} api.AddFriendResp "errCode为500 一般为服务器内部错误"
|
||||||
|
// @Failure 400 {object} api.AddFriendResp "errCode为400 一般为参数输入错误, token未带上等"
|
||||||
|
// @Router /friend/add_friend [post]
|
||||||
func AddFriend(c *gin.Context) {
|
func AddFriend(c *gin.Context) {
|
||||||
params := api.AddFriendReq{}
|
params := api.AddFriendReq{}
|
||||||
if err := c.BindJSON(¶ms); err != nil {
|
if err := c.BindJSON(¶ms); err != nil {
|
||||||
@@ -114,7 +150,7 @@ func AddFriend(c *gin.Context) {
|
|||||||
if !ok {
|
if !ok {
|
||||||
errMsg := req.CommID.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
errMsg := req.CommID.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||||
log.NewError(req.CommID.OperationID, errMsg)
|
log.NewError(req.CommID.OperationID, errMsg)
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": errMsg})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -140,6 +176,18 @@ func AddFriend(c *gin.Context) {
|
|||||||
c.JSON(http.StatusOK, resp)
|
c.JSON(http.StatusOK, resp)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Summary 同意/拒绝好友请求
|
||||||
|
// @Description 同意/拒绝好友请求
|
||||||
|
// @Tags 好友相关
|
||||||
|
// @ID AddFriendResponse
|
||||||
|
// @Accept json
|
||||||
|
// @Param token header string true "im token"
|
||||||
|
// @Param req body api.AddFriendResponseReq true "fromUserID同意/拒绝的用户ID, toUserID为申请用户, handleMsg为处理信息, flag为具体操作, 1为同意, 2为拒绝"
|
||||||
|
// @Produce json
|
||||||
|
// @Success 0 {object} api.AddFriendResponseResp
|
||||||
|
// @Failure 500 {object} api.AddFriendResponseResp "errCode为500 一般为服务器内部错误"
|
||||||
|
// @Failure 400 {object} api.AddFriendResponseResp "errCode为400 一般为参数输入错误, token未带上等"
|
||||||
|
// @Router /friend/add_friend_response [post]
|
||||||
func AddFriendResponse(c *gin.Context) {
|
func AddFriendResponse(c *gin.Context) {
|
||||||
params := api.AddFriendResponseReq{}
|
params := api.AddFriendResponseReq{}
|
||||||
if err := c.BindJSON(¶ms); err != nil {
|
if err := c.BindJSON(¶ms); err != nil {
|
||||||
@@ -158,7 +206,7 @@ func AddFriendResponse(c *gin.Context) {
|
|||||||
if !ok {
|
if !ok {
|
||||||
errMsg := req.CommID.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
errMsg := req.CommID.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||||
log.NewError(req.CommID.OperationID, errMsg)
|
log.NewError(req.CommID.OperationID, errMsg)
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": errMsg})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -186,6 +234,18 @@ func AddFriendResponse(c *gin.Context) {
|
|||||||
c.JSON(http.StatusOK, resp)
|
c.JSON(http.StatusOK, resp)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Summary 删除好友
|
||||||
|
// @Description 删除好友
|
||||||
|
// @Tags 好友相关
|
||||||
|
// @ID DeleteFriend
|
||||||
|
// @Accept json
|
||||||
|
// @Param token header string true "im token"
|
||||||
|
// @Param req body api.DeleteFriendReq true "fromUserID为操作用户, toUserID为被删除用户"
|
||||||
|
// @Produce json
|
||||||
|
// @Success 0 {object} api.DeleteFriendResp
|
||||||
|
// @Failure 500 {object} api.DeleteFriendResp "errCode为500 一般为服务器内部错误"
|
||||||
|
// @Failure 400 {object} api.DeleteFriendResp "errCode为400 一般为参数输入错误, token未带上等"
|
||||||
|
// @Router /friend/delete_friend [post]
|
||||||
func DeleteFriend(c *gin.Context) {
|
func DeleteFriend(c *gin.Context) {
|
||||||
params := api.DeleteFriendReq{}
|
params := api.DeleteFriendReq{}
|
||||||
if err := c.BindJSON(¶ms); err != nil {
|
if err := c.BindJSON(¶ms); err != nil {
|
||||||
@@ -228,6 +288,18 @@ func DeleteFriend(c *gin.Context) {
|
|||||||
c.JSON(http.StatusOK, resp)
|
c.JSON(http.StatusOK, resp)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Summary 获取黑名单列表
|
||||||
|
// @Description 获取黑名单列表
|
||||||
|
// @Tags 好友相关
|
||||||
|
// @ID GetBlacklist
|
||||||
|
// @Accept json
|
||||||
|
// @Param token header string true "im token"
|
||||||
|
// @Param req body api.GetBlackListReq true "fromUserID要获取黑名单的用户"
|
||||||
|
// @Produce json
|
||||||
|
// @Success 0 {object} api.GetBlackListResp
|
||||||
|
// @Failure 500 {object} api.GetBlackListResp "errCode为500 一般为服务器内部错误"
|
||||||
|
// @Failure 400 {object} api.GetBlackListResp "errCode为400 一般为参数输入错误, token未带上等"
|
||||||
|
// @Router /friend/get_black_list [post]
|
||||||
func GetBlacklist(c *gin.Context) {
|
func GetBlacklist(c *gin.Context) {
|
||||||
params := api.GetBlackListReq{}
|
params := api.GetBlackListReq{}
|
||||||
if err := c.BindJSON(¶ms); err != nil {
|
if err := c.BindJSON(¶ms); err != nil {
|
||||||
@@ -244,7 +316,7 @@ func GetBlacklist(c *gin.Context) {
|
|||||||
if !ok {
|
if !ok {
|
||||||
errMsg := req.CommID.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
errMsg := req.CommID.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||||
log.NewError(req.CommID.OperationID, errMsg)
|
log.NewError(req.CommID.OperationID, errMsg)
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -276,6 +348,18 @@ func GetBlacklist(c *gin.Context) {
|
|||||||
c.JSON(http.StatusOK, resp)
|
c.JSON(http.StatusOK, resp)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Summary 设置好友备注
|
||||||
|
// @Description 设置好友备注
|
||||||
|
// @Tags 好友相关
|
||||||
|
// @ID SetFriendRemark
|
||||||
|
// @Accept json
|
||||||
|
// @Param token header string true "im token"
|
||||||
|
// @Param req body api.SetFriendRemarkReq true "fromUserID为设置的用户, toUserID为被设置的用户, remark为好友备注"
|
||||||
|
// @Produce json
|
||||||
|
// @Success 0 {object} api.SetFriendRemarkResp
|
||||||
|
// @Failure 500 {object} api.SetFriendRemarkResp "errCode为500 一般为服务器内部错误"
|
||||||
|
// @Failure 400 {object} api.SetFriendRemarkResp "errCode为400 一般为参数输入错误, token未带上等"
|
||||||
|
// @Router /friend/set_friend_remark [post]
|
||||||
func SetFriendRemark(c *gin.Context) {
|
func SetFriendRemark(c *gin.Context) {
|
||||||
params := api.SetFriendRemarkReq{}
|
params := api.SetFriendRemarkReq{}
|
||||||
if err := c.BindJSON(¶ms); err != nil {
|
if err := c.BindJSON(¶ms); err != nil {
|
||||||
@@ -319,6 +403,18 @@ func SetFriendRemark(c *gin.Context) {
|
|||||||
c.JSON(http.StatusOK, resp)
|
c.JSON(http.StatusOK, resp)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Summary 把用户移除黑名单
|
||||||
|
// @Description 把用户移除黑名单
|
||||||
|
// @Tags 好友相关
|
||||||
|
// @ID RemoveBlack
|
||||||
|
// @Accept json
|
||||||
|
// @Param token header string true "im token"
|
||||||
|
// @Param req body api.RemoveBlackListReq true "fromUserID要获取黑名单的用户"
|
||||||
|
// @Produce json
|
||||||
|
// @Success 0 {object} api.RemoveBlackListResp
|
||||||
|
// @Failure 500 {object} api.RemoveBlackListResp "errCode为500 一般为服务器内部错误"
|
||||||
|
// @Failure 400 {object} api.RemoveBlackListResp "errCode为400 一般为参数输入错误, token未带上等"
|
||||||
|
// @Router /friend/remove_black [post]
|
||||||
func RemoveBlack(c *gin.Context) {
|
func RemoveBlack(c *gin.Context) {
|
||||||
params := api.RemoveBlackListReq{}
|
params := api.RemoveBlackListReq{}
|
||||||
if err := c.BindJSON(¶ms); err != nil {
|
if err := c.BindJSON(¶ms); err != nil {
|
||||||
@@ -335,7 +431,7 @@ func RemoveBlack(c *gin.Context) {
|
|||||||
if !ok {
|
if !ok {
|
||||||
errMsg := req.CommID.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
errMsg := req.CommID.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||||
log.NewError(req.CommID.OperationID, errMsg)
|
log.NewError(req.CommID.OperationID, errMsg)
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -360,6 +456,18 @@ func RemoveBlack(c *gin.Context) {
|
|||||||
c.JSON(http.StatusOK, resp)
|
c.JSON(http.StatusOK, resp)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Summary 检查用户之间是否为好友
|
||||||
|
// @Description 检查用户之间是否为好友
|
||||||
|
// @Tags 好友相关
|
||||||
|
// @ID IsFriend
|
||||||
|
// @Accept json
|
||||||
|
// @Param token header string true "im token"
|
||||||
|
// @Param req body api.IsFriendReq true "fromUserID为请求用户, toUserID为要检查的用户"
|
||||||
|
// @Produce json
|
||||||
|
// @Success 0 {object} api.IsFriendResp
|
||||||
|
// @Failure 500 {object} api.IsFriendResp "errCode为500 一般为服务器内部错误"
|
||||||
|
// @Failure 400 {object} api.IsFriendResp "errCode为400 一般为参数输入错误, token未带上等"
|
||||||
|
// @Router /friend/is_friend [post]
|
||||||
func IsFriend(c *gin.Context) {
|
func IsFriend(c *gin.Context) {
|
||||||
params := api.IsFriendReq{}
|
params := api.IsFriendReq{}
|
||||||
if err := c.BindJSON(¶ms); err != nil {
|
if err := c.BindJSON(¶ms); err != nil {
|
||||||
@@ -376,7 +484,7 @@ func IsFriend(c *gin.Context) {
|
|||||||
if !ok {
|
if !ok {
|
||||||
errMsg := req.CommID.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
errMsg := req.CommID.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||||
log.NewError(req.CommID.OperationID, errMsg)
|
log.NewError(req.CommID.OperationID, errMsg)
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": errMsg})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -403,6 +511,18 @@ func IsFriend(c *gin.Context) {
|
|||||||
c.JSON(http.StatusOK, resp)
|
c.JSON(http.StatusOK, resp)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Summary 获取用户的好友列表
|
||||||
|
// @Description 获取用户的好友列表
|
||||||
|
// @Tags 好友相关
|
||||||
|
// @ID GetFriendList
|
||||||
|
// @Accept json
|
||||||
|
// @Param token header string true "im token"
|
||||||
|
// @Param req body api.GetFriendListReq true "fromUserID为要获取好友列表的用户ID"
|
||||||
|
// @Produce json
|
||||||
|
// @Success 0 {object} api.GetFriendListResp
|
||||||
|
// @Failure 500 {object} api.GetFriendListResp "errCode为500 一般为服务器内部错误"
|
||||||
|
// @Failure 400 {object} api.GetFriendListResp "errCode为400 一般为参数输入错误, token未带上等"
|
||||||
|
// @Router /friend/get_friend_list [post]
|
||||||
func GetFriendList(c *gin.Context) {
|
func GetFriendList(c *gin.Context) {
|
||||||
params := api.GetFriendListReq{}
|
params := api.GetFriendListReq{}
|
||||||
if err := c.BindJSON(¶ms); err != nil {
|
if err := c.BindJSON(¶ms); err != nil {
|
||||||
@@ -447,6 +567,18 @@ func GetFriendList(c *gin.Context) {
|
|||||||
//c.JSON(http.StatusOK, resp)
|
//c.JSON(http.StatusOK, resp)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Summary 获取好友申请列表
|
||||||
|
// @Description 删除好友
|
||||||
|
// @Tags 好友相关
|
||||||
|
// @ID GetFriendApplyList
|
||||||
|
// @Accept json
|
||||||
|
// @Param token header string true "im token"
|
||||||
|
// @Param req body api.GetFriendApplyListReq true "fromUserID为要获取申请列表的用户ID"
|
||||||
|
// @Produce json
|
||||||
|
// @Success 0 {object} api.GetFriendApplyListResp
|
||||||
|
// @Failure 500 {object} api.GetFriendApplyListResp "errCode为500 一般为服务器内部错误"
|
||||||
|
// @Failure 400 {object} api.GetFriendApplyListResp "errCode为400 一般为参数输入错误, token未带上等"
|
||||||
|
// @Router /friend/get_friend_apply_list [post]
|
||||||
func GetFriendApplyList(c *gin.Context) {
|
func GetFriendApplyList(c *gin.Context) {
|
||||||
params := api.GetFriendApplyListReq{}
|
params := api.GetFriendApplyListReq{}
|
||||||
if err := c.BindJSON(¶ms); err != nil {
|
if err := c.BindJSON(¶ms); err != nil {
|
||||||
@@ -463,7 +595,7 @@ func GetFriendApplyList(c *gin.Context) {
|
|||||||
if !ok {
|
if !ok {
|
||||||
errMsg := req.CommID.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
errMsg := req.CommID.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||||
log.NewError(req.CommID.OperationID, errMsg)
|
log.NewError(req.CommID.OperationID, errMsg)
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -491,6 +623,18 @@ func GetFriendApplyList(c *gin.Context) {
|
|||||||
c.JSON(http.StatusOK, resp)
|
c.JSON(http.StatusOK, resp)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Summary 获取自己的好友申请列表
|
||||||
|
// @Description 获取自己的好友申请列表
|
||||||
|
// @Tags 好友相关
|
||||||
|
// @ID GetSelfFriendApplyList
|
||||||
|
// @Accept json
|
||||||
|
// @Param token header string true "im token"
|
||||||
|
// @Param req body api.GetSelfApplyListReq true "fromUserID为自己的用户ID"
|
||||||
|
// @Produce json
|
||||||
|
// @Success 0 {object} api.GetSelfApplyListResp
|
||||||
|
// @Failure 500 {object} api.GetSelfApplyListResp "errCode为500 一般为服务器内部错误"
|
||||||
|
// @Failure 400 {object} api.GetSelfApplyListResp "errCode为400 一般为参数输入错误, token未带上等"
|
||||||
|
// @Router /friend/get_self_friend_apply_list [post]
|
||||||
func GetSelfFriendApplyList(c *gin.Context) {
|
func GetSelfFriendApplyList(c *gin.Context) {
|
||||||
params := api.GetSelfApplyListReq{}
|
params := api.GetSelfApplyListReq{}
|
||||||
if err := c.BindJSON(¶ms); err != nil {
|
if err := c.BindJSON(¶ms); err != nil {
|
||||||
@@ -507,7 +651,7 @@ func GetSelfFriendApplyList(c *gin.Context) {
|
|||||||
if !ok {
|
if !ok {
|
||||||
errMsg := req.CommID.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
errMsg := req.CommID.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||||
log.NewError(req.CommID.OperationID, errMsg)
|
log.NewError(req.CommID.OperationID, errMsg)
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+261
-16
@@ -20,6 +20,18 @@ import (
|
|||||||
jsonData "Open_IM/internal/utils"
|
jsonData "Open_IM/internal/utils"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// @Summary 把用户踢出群组
|
||||||
|
// @Description 把用户踢出群组
|
||||||
|
// @Tags 群组相关
|
||||||
|
// @ID KickGroupMember
|
||||||
|
// @Accept json
|
||||||
|
// @Param token header string true "im token"
|
||||||
|
// @Param req body api.KickGroupMemberReq true "GroupID为要操作的群ID <br> kickedUserIDList为要踢出的群用户ID <br> reason为原因"
|
||||||
|
// @Produce json
|
||||||
|
// @Success 0 {object} api.KickGroupMemberResp "result为结果码, -1为失败, 0为成功"
|
||||||
|
// @Failure 500 {object} api.KickGroupMemberResp "errCode为500 一般为服务器内部错误"
|
||||||
|
// @Failure 400 {object} api.KickGroupMemberResp "errCode为400 一般为参数输入错误, token未带上等"
|
||||||
|
// @Router /group/kick_group [post]
|
||||||
func KickGroupMember(c *gin.Context) {
|
func KickGroupMember(c *gin.Context) {
|
||||||
params := api.KickGroupMemberReq{}
|
params := api.KickGroupMemberReq{}
|
||||||
if err := c.BindJSON(¶ms); err != nil {
|
if err := c.BindJSON(¶ms); err != nil {
|
||||||
@@ -72,6 +84,18 @@ func KickGroupMember(c *gin.Context) {
|
|||||||
c.JSON(http.StatusOK, memberListResp)
|
c.JSON(http.StatusOK, memberListResp)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Summary 获取群成员信息
|
||||||
|
// @Description 获取群成员信息
|
||||||
|
// @Tags 群组相关
|
||||||
|
// @ID GetGroupMembersInfo
|
||||||
|
// @Accept json
|
||||||
|
// @Param token header string true "im token"
|
||||||
|
// @Param req body api.GetGroupMembersInfoReq true "memberList为要获取群成员的群ID列表"
|
||||||
|
// @Produce json
|
||||||
|
// @Success 0 {object} api.GetGroupMembersInfoResp{data=[]open_im_sdk.GroupMemberFullInfo}
|
||||||
|
// @Failure 500 {object} api.GetGroupMembersInfoResp "errCode为500 一般为服务器内部错误"
|
||||||
|
// @Failure 400 {object} api.GetGroupMembersInfoResp "errCode为400 一般为参数输入错误, token未带上等"
|
||||||
|
// @Router /group/get_group_members_info [post]
|
||||||
func GetGroupMembersInfo(c *gin.Context) {
|
func GetGroupMembersInfo(c *gin.Context) {
|
||||||
params := api.GetGroupMembersInfoReq{}
|
params := api.GetGroupMembersInfoReq{}
|
||||||
if err := c.BindJSON(¶ms); err != nil {
|
if err := c.BindJSON(¶ms); err != nil {
|
||||||
@@ -161,6 +185,18 @@ func GetGroupMemberList(c *gin.Context) {
|
|||||||
c.JSON(http.StatusOK, memberListResp)
|
c.JSON(http.StatusOK, memberListResp)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Summary 获取全部群成员列表
|
||||||
|
// @Description 获取全部群成员列表
|
||||||
|
// @Tags 群组相关
|
||||||
|
// @ID GetGroupAllMemberList
|
||||||
|
// @Accept json
|
||||||
|
// @Param token header string true "im token"
|
||||||
|
// @Param req body api.GetGroupAllMemberReq true "GroupID为要获取群成员的群ID"
|
||||||
|
// @Produce json
|
||||||
|
// @Success 0 {object} api.GetGroupAllMemberResp{data=[]open_im_sdk.GroupMemberFullInfo}
|
||||||
|
// @Failure 500 {object} api.GetGroupAllMemberResp "errCode为500 一般为服务器内部错误"
|
||||||
|
// @Failure 400 {object} api.GetGroupAllMemberResp "errCode为400 一般为参数输入错误, token未带上等"
|
||||||
|
// @Router /group/get_group_all_member_list [post]
|
||||||
func GetGroupAllMemberList(c *gin.Context) {
|
func GetGroupAllMemberList(c *gin.Context) {
|
||||||
params := api.GetGroupAllMemberReq{}
|
params := api.GetGroupAllMemberReq{}
|
||||||
if err := c.BindJSON(¶ms); err != nil {
|
if err := c.BindJSON(¶ms); err != nil {
|
||||||
@@ -204,6 +240,18 @@ func GetGroupAllMemberList(c *gin.Context) {
|
|||||||
c.JSON(http.StatusOK, memberListResp)
|
c.JSON(http.StatusOK, memberListResp)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Summary 获取用户加入群列表
|
||||||
|
// @Description 获取用户加入群列表
|
||||||
|
// @Tags 群组相关
|
||||||
|
// @ID GetJoinedGroupList
|
||||||
|
// @Accept json
|
||||||
|
// @Param token header string true "im token"
|
||||||
|
// @Param req body api.GetJoinedGroupListReq true "fromUserID为要获取的用户ID"
|
||||||
|
// @Produce json
|
||||||
|
// @Success 0 {object} api.GetJoinedGroupListResp{data=[]open_im_sdk.GroupInfo}
|
||||||
|
// @Failure 500 {object} api.GetJoinedGroupListResp "errCode为500 一般为服务器内部错误"
|
||||||
|
// @Failure 400 {object} api.GetJoinedGroupListResp "errCode为400 一般为参数输入错误, token未带上等"
|
||||||
|
// @Router /group/get_joined_group_list [post]
|
||||||
func GetJoinedGroupList(c *gin.Context) {
|
func GetJoinedGroupList(c *gin.Context) {
|
||||||
params := api.GetJoinedGroupListReq{}
|
params := api.GetJoinedGroupListReq{}
|
||||||
if err := c.BindJSON(¶ms); err != nil {
|
if err := c.BindJSON(¶ms); err != nil {
|
||||||
@@ -247,6 +295,18 @@ func GetJoinedGroupList(c *gin.Context) {
|
|||||||
c.JSON(http.StatusOK, GroupListResp)
|
c.JSON(http.StatusOK, GroupListResp)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Summary 将用户拉入群组
|
||||||
|
// @Description 将用户拉入群组
|
||||||
|
// @Tags 群组相关
|
||||||
|
// @ID InviteUserToGroup
|
||||||
|
// @Accept json
|
||||||
|
// @Param token header string true "im token"
|
||||||
|
// @Param req body api.InviteUserToGroupReq true "groupID为要拉进的群组ID <br> invitedUserIDList为要获取群成员的群ID列表 <br> reason为原因"
|
||||||
|
// @Produce json
|
||||||
|
// @Success 0 {object} api.InviteUserToGroupResp "result为结果码, -1为失败, 0为成功""
|
||||||
|
// @Failure 500 {object} api.InviteUserToGroupResp "errCode为500 一般为服务器内部错误"
|
||||||
|
// @Failure 400 {object} api.InviteUserToGroupResp "errCode为400 一般为参数输入错误, token未带上等"
|
||||||
|
// @Router /group/invite_user_to_group [post]
|
||||||
func InviteUserToGroup(c *gin.Context) {
|
func InviteUserToGroup(c *gin.Context) {
|
||||||
params := api.InviteUserToGroupReq{}
|
params := api.InviteUserToGroupReq{}
|
||||||
if err := c.BindJSON(¶ms); err != nil {
|
if err := c.BindJSON(¶ms); err != nil {
|
||||||
@@ -297,6 +357,18 @@ func InviteUserToGroup(c *gin.Context) {
|
|||||||
c.JSON(http.StatusOK, resp)
|
c.JSON(http.StatusOK, resp)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Summary 创建群组
|
||||||
|
// @Description 创建群组
|
||||||
|
// @Tags 群组相关
|
||||||
|
// @ID CreateGroup
|
||||||
|
// @Accept json
|
||||||
|
// @Param token header string true "im token"
|
||||||
|
// @Param req body api.CreateGroupReq true "ownerUserID为群主ID <br> ex为群扩展字段 <br> roleLevel为群员角色,1为普通用户 2为群主 3为管理员"
|
||||||
|
// @Produce json
|
||||||
|
// @Success 0 {object} api.CreateGroupResp{data=open_im_sdk.GroupInfo}
|
||||||
|
// @Failure 500 {object} api.CreateGroupResp "errCode为500 一般为服务器内部错误"
|
||||||
|
// @Failure 400 {object} api.CreateGroupResp "errCode为400 一般为参数输入错误, token未带上等"
|
||||||
|
// @Router /group/create_group [post]
|
||||||
func CreateGroup(c *gin.Context) {
|
func CreateGroup(c *gin.Context) {
|
||||||
params := api.CreateGroupReq{}
|
params := api.CreateGroupReq{}
|
||||||
if err := c.BindJSON(¶ms); err != nil {
|
if err := c.BindJSON(¶ms); err != nil {
|
||||||
@@ -318,7 +390,7 @@ func CreateGroup(c *gin.Context) {
|
|||||||
if !ok {
|
if !ok {
|
||||||
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||||
log.NewError(req.OperationID, errMsg)
|
log.NewError(req.OperationID, errMsg)
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": errMsg})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -351,7 +423,18 @@ func CreateGroup(c *gin.Context) {
|
|||||||
c.JSON(http.StatusOK, resp)
|
c.JSON(http.StatusOK, resp)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 群主或管理员收到的
|
// @Summary 获取用户收到的加群信息列表
|
||||||
|
// @Description 获取用户收到的加群信息列表
|
||||||
|
// @Tags 群组相关
|
||||||
|
// @ID GetRecvGroupApplicationList
|
||||||
|
// @Accept json
|
||||||
|
// @Param token header string true "im token"
|
||||||
|
// @Param req body api.GetGroupApplicationListReq true "fromUserID为要获取的用户ID"
|
||||||
|
// @Produce json
|
||||||
|
// @Success 0 {object} api.GetGroupApplicationListResp
|
||||||
|
// @Failure 500 {object} api.GetGroupApplicationListResp "errCode为500 一般为服务器内部错误"
|
||||||
|
// @Failure 400 {object} api.GetGroupApplicationListResp "errCode为400 一般为参数输入错误, token未带上等"
|
||||||
|
// @Router /group/get_recv_group_applicationList [post]
|
||||||
func GetRecvGroupApplicationList(c *gin.Context) {
|
func GetRecvGroupApplicationList(c *gin.Context) {
|
||||||
params := api.GetGroupApplicationListReq{}
|
params := api.GetGroupApplicationListReq{}
|
||||||
if err := c.BindJSON(¶ms); err != nil {
|
if err := c.BindJSON(¶ms); err != nil {
|
||||||
@@ -361,13 +444,15 @@ func GetRecvGroupApplicationList(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
req := &rpc.GetGroupApplicationListReq{}
|
req := &rpc.GetGroupApplicationListReq{}
|
||||||
utils.CopyStructFields(req, params)
|
utils.CopyStructFields(req, params)
|
||||||
//var ok bool
|
var ok bool
|
||||||
//ok, req.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"))
|
var errInfo string
|
||||||
//if !ok {
|
ok, req.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||||
// log.NewError(req.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
if !ok {
|
||||||
// c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||||
// return
|
log.NewError(req.OperationID, errMsg)
|
||||||
//}
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": errMsg})
|
||||||
|
return
|
||||||
|
}
|
||||||
log.NewInfo(req.OperationID, "GetGroupApplicationList args ", req.String())
|
log.NewInfo(req.OperationID, "GetGroupApplicationList args ", req.String())
|
||||||
|
|
||||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID)
|
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID)
|
||||||
@@ -391,6 +476,18 @@ func GetRecvGroupApplicationList(c *gin.Context) {
|
|||||||
c.JSON(http.StatusOK, resp)
|
c.JSON(http.StatusOK, resp)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Summary 获取用户加群申请列表
|
||||||
|
// @Description 获取用户加群申请列表
|
||||||
|
// @Tags 群组相关
|
||||||
|
// @ID GetUserReqGroupApplicationList
|
||||||
|
// @Accept json
|
||||||
|
// @Param token header string true "im token"
|
||||||
|
// @Param req body api.GetUserReqGroupApplicationListReq true "userID为要获取的用户ID"
|
||||||
|
// @Produce json
|
||||||
|
// @Success 0 {object} api.GetGroupApplicationListResp
|
||||||
|
// @Failure 500 {object} api.GetGroupApplicationListResp "errCode为500 一般为服务器内部错误"
|
||||||
|
// @Failure 400 {object} api.GetGroupApplicationListResp "errCode为400 一般为参数输入错误, token未带上等"
|
||||||
|
// @Router /group/get_user_req_group_applicationList [post]
|
||||||
func GetUserReqGroupApplicationList(c *gin.Context) {
|
func GetUserReqGroupApplicationList(c *gin.Context) {
|
||||||
var params api.GetUserReqGroupApplicationListReq
|
var params api.GetUserReqGroupApplicationListReq
|
||||||
if err := c.BindJSON(¶ms); err != nil {
|
if err := c.BindJSON(¶ms); err != nil {
|
||||||
@@ -400,12 +497,15 @@ func GetUserReqGroupApplicationList(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
req := &rpc.GetUserReqApplicationListReq{}
|
req := &rpc.GetUserReqApplicationListReq{}
|
||||||
utils.CopyStructFields(req, params)
|
utils.CopyStructFields(req, params)
|
||||||
//ok, req.OpUserID := token_verify.GetUserIDFromToken(c.Request.Header.Get("token"))
|
var ok bool
|
||||||
//if !ok {
|
var errInfo string
|
||||||
// log.NewError(req.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
ok, req.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||||
// c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
if !ok {
|
||||||
// return
|
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||||
//}
|
log.NewError(req.OperationID, errMsg)
|
||||||
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": errMsg})
|
||||||
|
return
|
||||||
|
}
|
||||||
log.NewInfo(req.OperationID, "GetGroupsInfo args ", req.String())
|
log.NewInfo(req.OperationID, "GetGroupsInfo args ", req.String())
|
||||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID)
|
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID)
|
||||||
if etcdConn == nil {
|
if etcdConn == nil {
|
||||||
@@ -428,6 +528,18 @@ func GetUserReqGroupApplicationList(c *gin.Context) {
|
|||||||
c.JSON(http.StatusOK, resp)
|
c.JSON(http.StatusOK, resp)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Summary 通过群ID列表获取群信息
|
||||||
|
// @Description 通过群ID列表获取群信息
|
||||||
|
// @Tags 群组相关
|
||||||
|
// @ID GetGroupsInfo
|
||||||
|
// @Accept json
|
||||||
|
// @Param token header string true "im token"
|
||||||
|
// @Param req body api.GetGroupInfoReq true "groupIDList为群ID列表"
|
||||||
|
// @Produce json
|
||||||
|
// @Success 0 {object} api.GetGroupInfoResp
|
||||||
|
// @Failure 500 {object} api.GetGroupInfoResp "errCode为500 一般为服务器内部错误"
|
||||||
|
// @Failure 400 {object} api.GetGroupInfoResp "errCode为400 一般为参数输入错误, token未带上等"
|
||||||
|
// @Router /group/get_groups_info [post]
|
||||||
func GetGroupsInfo(c *gin.Context) {
|
func GetGroupsInfo(c *gin.Context) {
|
||||||
params := api.GetGroupInfoReq{}
|
params := api.GetGroupInfoReq{}
|
||||||
if err := c.BindJSON(¶ms); err != nil {
|
if err := c.BindJSON(¶ms); err != nil {
|
||||||
@@ -484,6 +596,19 @@ func GetGroupsInfo(c *gin.Context) {
|
|||||||
//}
|
//}
|
||||||
|
|
||||||
//process application
|
//process application
|
||||||
|
|
||||||
|
// @Summary 处理加群消息
|
||||||
|
// @Description 处理加群消息
|
||||||
|
// @Tags 群组相关
|
||||||
|
// @ID ApplicationGroupResponse
|
||||||
|
// @Accept json
|
||||||
|
// @Param token header string true "im token"
|
||||||
|
// @Param req body api.ApplicationGroupResponseReq true "groupID为要处理的群ID <br> fromUserID为要处理的用户ID <br> handleMsg为处理结果信息 <br> handleResult为处理结果 1为同意加群 2为拒绝加群"
|
||||||
|
// @Produce json
|
||||||
|
// @Success 0 {object} api.ApplicationGroupResponseResp
|
||||||
|
// @Failure 500 {object} api.ApplicationGroupResponseResp "errCode为500 一般为服务器内部错误"
|
||||||
|
// @Failure 400 {object} api.ApplicationGroupResponseResp "errCode为400 一般为参数输入错误, token未带上等"
|
||||||
|
// @Router /group/group_application_response [post]
|
||||||
func ApplicationGroupResponse(c *gin.Context) {
|
func ApplicationGroupResponse(c *gin.Context) {
|
||||||
params := api.ApplicationGroupResponseReq{}
|
params := api.ApplicationGroupResponseReq{}
|
||||||
if err := c.BindJSON(¶ms); err != nil {
|
if err := c.BindJSON(¶ms); err != nil {
|
||||||
@@ -526,6 +651,18 @@ func ApplicationGroupResponse(c *gin.Context) {
|
|||||||
c.JSON(http.StatusOK, resp)
|
c.JSON(http.StatusOK, resp)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Summary 加入群聊
|
||||||
|
// @Description 加入群聊
|
||||||
|
// @Tags 群组相关
|
||||||
|
// @ID JoinGroup
|
||||||
|
// @Accept json
|
||||||
|
// @Param token header string true "im token"
|
||||||
|
// @Param req body api.JoinGroupReq true "reqMessage为申请进群信息"
|
||||||
|
// @Produce json
|
||||||
|
// @Success 0 {object} api.JoinGroupResp
|
||||||
|
// @Failure 500 {object} api.JoinGroupResp "errCode为500 一般为服务器内部错误"
|
||||||
|
// @Failure 400 {object} api.JoinGroupResp "errCode为400 一般为参数输入错误, token未带上等"
|
||||||
|
// @Router /group/join_group [post]
|
||||||
func JoinGroup(c *gin.Context) {
|
func JoinGroup(c *gin.Context) {
|
||||||
params := api.JoinGroupReq{}
|
params := api.JoinGroupReq{}
|
||||||
if err := c.BindJSON(¶ms); err != nil {
|
if err := c.BindJSON(¶ms); err != nil {
|
||||||
@@ -542,7 +679,7 @@ func JoinGroup(c *gin.Context) {
|
|||||||
if !ok {
|
if !ok {
|
||||||
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||||
log.NewError(req.OperationID, errMsg)
|
log.NewError(req.OperationID, errMsg)
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -567,6 +704,18 @@ func JoinGroup(c *gin.Context) {
|
|||||||
c.JSON(http.StatusOK, resp)
|
c.JSON(http.StatusOK, resp)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Summary 退出群聊
|
||||||
|
// @Description 退出群聊
|
||||||
|
// @Tags 群组相关
|
||||||
|
// @ID QuitGroup
|
||||||
|
// @Accept json
|
||||||
|
// @Param token header string true "im token"
|
||||||
|
// @Param req body api.QuitGroupReq true "groupID为要退出的群ID"
|
||||||
|
// @Produce json
|
||||||
|
// @Success 0 {object} api.QuitGroupResp
|
||||||
|
// @Failure 500 {object} api.QuitGroupResp "errCode为500 一般为服务器内部错误"
|
||||||
|
// @Failure 400 {object} api.QuitGroupResp "errCode为400 一般为参数输入错误, token未带上等"
|
||||||
|
// @Router /group/quit_group [post]
|
||||||
func QuitGroup(c *gin.Context) {
|
func QuitGroup(c *gin.Context) {
|
||||||
params := api.QuitGroupReq{}
|
params := api.QuitGroupReq{}
|
||||||
if err := c.BindJSON(¶ms); err != nil {
|
if err := c.BindJSON(¶ms); err != nil {
|
||||||
@@ -608,6 +757,18 @@ func QuitGroup(c *gin.Context) {
|
|||||||
c.JSON(http.StatusOK, resp)
|
c.JSON(http.StatusOK, resp)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Summary 设置群信息
|
||||||
|
// @Description 设置群信息
|
||||||
|
// @Tags 群组相关
|
||||||
|
// @ID SetGroupInfo
|
||||||
|
// @Accept json
|
||||||
|
// @Param token header string true "im token"
|
||||||
|
// @Param req body api.SetGroupInfoReq true "notification为群介绍 <br> introduction为群公告 <br> needVerification为加群验证 0为申请需要同意 邀请直接进 1为所有人进群需要验证,除了群主管理员邀请进群 2为直接进群"
|
||||||
|
// @Produce json
|
||||||
|
// @Success 0 {object} api.SetGroupInfoResp
|
||||||
|
// @Failure 500 {object} api.SetGroupInfoResp "errCode为500 一般为服务器内部错误"
|
||||||
|
// @Failure 400 {object} api.SetGroupInfoResp "errCode为400 一般为参数输入错误, token未带上等"
|
||||||
|
// @Router /group/set_group_info [post]
|
||||||
func SetGroupInfo(c *gin.Context) {
|
func SetGroupInfo(c *gin.Context) {
|
||||||
params := api.SetGroupInfoReq{}
|
params := api.SetGroupInfoReq{}
|
||||||
if err := c.BindJSON(¶ms); err != nil {
|
if err := c.BindJSON(¶ms); err != nil {
|
||||||
@@ -655,6 +816,18 @@ func SetGroupInfo(c *gin.Context) {
|
|||||||
log.NewInfo(req.OperationID, "SetGroupInfo api return ", resp)
|
log.NewInfo(req.OperationID, "SetGroupInfo api return ", resp)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Summary 转让群主
|
||||||
|
// @Description 转让群主
|
||||||
|
// @Tags 群组相关
|
||||||
|
// @ID TransferGroupOwner
|
||||||
|
// @Accept json
|
||||||
|
// @Param token header string true "im token"
|
||||||
|
// @Param req body api.TransferGroupOwnerReq true "GroupID为要操作的群ID <br> oldOwnerUserID为老群主ID <br> newOwnerUserID为新群主ID"
|
||||||
|
// @Produce json
|
||||||
|
// @Success 0 {object} api.TransferGroupOwnerResp
|
||||||
|
// @Failure 500 {object} api.TransferGroupOwnerResp "errCode为500 一般为服务器内部错误"
|
||||||
|
// @Failure 400 {object} api.TransferGroupOwnerResp "errCode为400 一般为参数输入错误, token未带上等"
|
||||||
|
// @Router /group/transfer_group [post]
|
||||||
func TransferGroupOwner(c *gin.Context) {
|
func TransferGroupOwner(c *gin.Context) {
|
||||||
params := api.TransferGroupOwnerReq{}
|
params := api.TransferGroupOwnerReq{}
|
||||||
if err := c.BindJSON(¶ms); err != nil {
|
if err := c.BindJSON(¶ms); err != nil {
|
||||||
@@ -697,6 +870,18 @@ func TransferGroupOwner(c *gin.Context) {
|
|||||||
c.JSON(http.StatusOK, resp)
|
c.JSON(http.StatusOK, resp)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Summary 解散群组
|
||||||
|
// @Description 解散群组
|
||||||
|
// @Tags 群组相关
|
||||||
|
// @ID DismissGroup
|
||||||
|
// @Accept json
|
||||||
|
// @Param token header string true "im token"
|
||||||
|
// @Param req body api.DismissGroupReq true "groupID为要解散的群组ID"
|
||||||
|
// @Produce json
|
||||||
|
// @Success 0 {object} api.DismissGroupResp
|
||||||
|
// @Failure 500 {object} api.DismissGroupResp "errCode为500 一般为服务器内部错误"
|
||||||
|
// @Failure 400 {object} api.DismissGroupResp "errCode为400 一般为参数输入错误, token未带上等"
|
||||||
|
// @Router /group/dismiss_group [post]
|
||||||
func DismissGroup(c *gin.Context) {
|
func DismissGroup(c *gin.Context) {
|
||||||
params := api.DismissGroupReq{}
|
params := api.DismissGroupReq{}
|
||||||
if err := c.BindJSON(¶ms); err != nil {
|
if err := c.BindJSON(¶ms); err != nil {
|
||||||
@@ -739,6 +924,18 @@ func DismissGroup(c *gin.Context) {
|
|||||||
c.JSON(http.StatusOK, resp)
|
c.JSON(http.StatusOK, resp)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Summary 禁言群成员
|
||||||
|
// @Description 禁言群成员
|
||||||
|
// @Tags 群组相关
|
||||||
|
// @ID MuteGroupMember
|
||||||
|
// @Accept json
|
||||||
|
// @Param token header string true "im token"
|
||||||
|
// @Param req body api.MuteGroupMemberReq true "groupID为群组ID <br> userID为要禁言的用户ID <br> mutedSeconds为禁言秒数"
|
||||||
|
// @Produce json
|
||||||
|
// @Success 0 {object} api.DismissGroupResp
|
||||||
|
// @Failure 500 {object} api.DismissGroupResp "errCode为500 一般为服务器内部错误"
|
||||||
|
// @Failure 400 {object} api.DismissGroupResp "errCode为400 一般为参数输入错误, token未带上等"
|
||||||
|
// @Router /group/mute_group_member [post]
|
||||||
func MuteGroupMember(c *gin.Context) {
|
func MuteGroupMember(c *gin.Context) {
|
||||||
params := api.MuteGroupMemberReq{}
|
params := api.MuteGroupMemberReq{}
|
||||||
if err := c.BindJSON(¶ms); err != nil {
|
if err := c.BindJSON(¶ms); err != nil {
|
||||||
@@ -781,6 +978,18 @@ func MuteGroupMember(c *gin.Context) {
|
|||||||
c.JSON(http.StatusOK, resp)
|
c.JSON(http.StatusOK, resp)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Summary 取消禁言群成员
|
||||||
|
// @Description 取消禁言群成员
|
||||||
|
// @Tags 群组相关
|
||||||
|
// @ID CancelMuteGroupMember
|
||||||
|
// @Accept json
|
||||||
|
// @Param token header string true "im token"
|
||||||
|
// @Param req body api.CancelMuteGroupMemberReq true "groupID为群组ID <br> userID为要取消禁言的用户ID"
|
||||||
|
// @Produce json
|
||||||
|
// @Success 0 {object} api.CancelMuteGroupMemberResp
|
||||||
|
// @Failure 500 {object} api.CancelMuteGroupMemberResp "errCode为500 一般为服务器内部错误"
|
||||||
|
// @Failure 400 {object} api.CancelMuteGroupMemberResp "errCode为400 一般为参数输入错误, token未带上等"
|
||||||
|
// @Router /group/cancel_mute_group_member [post]
|
||||||
func CancelMuteGroupMember(c *gin.Context) {
|
func CancelMuteGroupMember(c *gin.Context) {
|
||||||
params := api.CancelMuteGroupMemberReq{}
|
params := api.CancelMuteGroupMemberReq{}
|
||||||
if err := c.BindJSON(¶ms); err != nil {
|
if err := c.BindJSON(¶ms); err != nil {
|
||||||
@@ -823,6 +1032,18 @@ func CancelMuteGroupMember(c *gin.Context) {
|
|||||||
c.JSON(http.StatusOK, resp)
|
c.JSON(http.StatusOK, resp)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Summary 禁言群组
|
||||||
|
// @Description 禁言群组
|
||||||
|
// @Tags 群组相关
|
||||||
|
// @ID MuteGroup
|
||||||
|
// @Accept json
|
||||||
|
// @Param token header string true "im token"
|
||||||
|
// @Param req body api.MuteGroupReq true "groupID为群组ID"
|
||||||
|
// @Produce json
|
||||||
|
// @Success 0 {object} api.MuteGroupResp
|
||||||
|
// @Failure 500 {object} api.MuteGroupResp "errCode为500 一般为服务器内部错误"
|
||||||
|
// @Failure 400 {object} api.MuteGroupResp "errCode为400 一般为参数输入错误, token未带上等"
|
||||||
|
// @Router /group/mute_group [post]
|
||||||
func MuteGroup(c *gin.Context) {
|
func MuteGroup(c *gin.Context) {
|
||||||
params := api.MuteGroupReq{}
|
params := api.MuteGroupReq{}
|
||||||
if err := c.BindJSON(¶ms); err != nil {
|
if err := c.BindJSON(¶ms); err != nil {
|
||||||
@@ -865,6 +1086,18 @@ func MuteGroup(c *gin.Context) {
|
|||||||
c.JSON(http.StatusOK, resp)
|
c.JSON(http.StatusOK, resp)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Summary 取消禁言群组
|
||||||
|
// @Description 取消禁言群组
|
||||||
|
// @Tags 群组相关
|
||||||
|
// @ID CancelMuteGroup
|
||||||
|
// @Accept json
|
||||||
|
// @Param token header string true "im token"
|
||||||
|
// @Param req body api.CancelMuteGroupReq true "groupID为群组ID"
|
||||||
|
// @Produce json
|
||||||
|
// @Success 0 {object} api.CancelMuteGroupResp
|
||||||
|
// @Failure 500 {object} api.CancelMuteGroupResp "errCode为500 一般为服务器内部错误"
|
||||||
|
// @Failure 400 {object} api.CancelMuteGroupResp "errCode为400 一般为参数输入错误, token未带上等"
|
||||||
|
// @Router /group/cancel_mute_group [post]
|
||||||
func CancelMuteGroup(c *gin.Context) {
|
func CancelMuteGroup(c *gin.Context) {
|
||||||
params := api.CancelMuteGroupReq{}
|
params := api.CancelMuteGroupReq{}
|
||||||
if err := c.BindJSON(¶ms); err != nil {
|
if err := c.BindJSON(¶ms); err != nil {
|
||||||
@@ -951,6 +1184,18 @@ func SetGroupMemberNickname(c *gin.Context) {
|
|||||||
c.JSON(http.StatusOK, resp)
|
c.JSON(http.StatusOK, resp)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Summary 修改群成员信息
|
||||||
|
// @Description 修改群成员信息
|
||||||
|
// @Tags 群组相关
|
||||||
|
// @ID SetGroupMemberInfo
|
||||||
|
// @Accept json
|
||||||
|
// @Param token header string true "im token"
|
||||||
|
// @Param req body api.SetGroupMemberInfoReq true "除了operationID, userID, groupID其他参数可选"
|
||||||
|
// @Produce json
|
||||||
|
// @Success 0 {object} api.SetGroupMemberInfoResp
|
||||||
|
// @Failure 500 {object} api.SetGroupMemberInfoResp "errCode为500 一般为服务器内部错误"
|
||||||
|
// @Failure 400 {object} api.SetGroupMemberInfoResp "errCode为400 一般为参数输入错误, token未带上等"
|
||||||
|
// @Router /group/set_group_member_info [post]
|
||||||
func SetGroupMemberInfo(c *gin.Context) {
|
func SetGroupMemberInfo(c *gin.Context) {
|
||||||
var (
|
var (
|
||||||
req api.SetGroupMemberInfoReq
|
req api.SetGroupMemberInfoReq
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package apiThird
|
package apiThird
|
||||||
|
|
||||||
import (
|
import (
|
||||||
apiStruct "Open_IM/pkg/base_info"
|
api "Open_IM/pkg/base_info"
|
||||||
"Open_IM/pkg/common/config"
|
"Open_IM/pkg/common/config"
|
||||||
"Open_IM/pkg/common/constant"
|
"Open_IM/pkg/common/constant"
|
||||||
imdb "Open_IM/pkg/common/db/mysql_model/im_mysql_model"
|
imdb "Open_IM/pkg/common/db/mysql_model/im_mysql_model"
|
||||||
@@ -17,10 +17,24 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// @Summary minio上传文件(web api)
|
||||||
|
// @Description minio上传文件(web api), 请注意本api请求为form并非json
|
||||||
|
// @Tags 第三方服务相关
|
||||||
|
// @ID MinioUploadFile
|
||||||
|
// @Accept json
|
||||||
|
// @Param token header string true "im token"
|
||||||
|
// @Param file formData file true "要上传的文件文件"
|
||||||
|
// @Param fileType formData int true "文件类型"
|
||||||
|
// @Param operationID formData string true "操作唯一ID"
|
||||||
|
// @Produce json
|
||||||
|
// @Success 0 {object} api.MinioUploadFileResp ""
|
||||||
|
// @Failure 500 {object} api.MinioUploadFileResp "errCode为500 一般为服务器内部错误"
|
||||||
|
// @Failure 400 {object} api.MinioUploadFileResp "errCode为400 一般为参数输入错误, token未带上等"
|
||||||
|
// @Router /third/minio_upload [post]
|
||||||
func MinioUploadFile(c *gin.Context) {
|
func MinioUploadFile(c *gin.Context) {
|
||||||
var (
|
var (
|
||||||
req apiStruct.MinioUploadFileReq
|
req api.MinioUploadFileReq
|
||||||
resp apiStruct.MinioUploadFileResp
|
resp api.MinioUploadFileResp
|
||||||
)
|
)
|
||||||
defer func() {
|
defer func() {
|
||||||
if r := recover(); r != nil {
|
if r := recover(); r != nil {
|
||||||
@@ -41,7 +55,7 @@ func MinioUploadFile(c *gin.Context) {
|
|||||||
if !ok {
|
if !ok {
|
||||||
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||||
log.NewError(req.OperationID, errMsg)
|
log.NewError(req.OperationID, errMsg)
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -100,8 +114,8 @@ func MinioUploadFile(c *gin.Context) {
|
|||||||
|
|
||||||
func MinioStorageCredential(c *gin.Context) {
|
func MinioStorageCredential(c *gin.Context) {
|
||||||
var (
|
var (
|
||||||
req apiStruct.MinioStorageCredentialReq
|
req api.MinioStorageCredentialReq
|
||||||
resp apiStruct.MiniostorageCredentialResp
|
resp api.MiniostorageCredentialResp
|
||||||
)
|
)
|
||||||
if err := c.BindJSON(&req); err != nil {
|
if err := c.BindJSON(&req); err != nil {
|
||||||
log.NewError("0", utils.GetSelfFuncName(), "BindJSON failed ", err.Error())
|
log.NewError("0", utils.GetSelfFuncName(), "BindJSON failed ", err.Error())
|
||||||
@@ -151,8 +165,8 @@ func MinioStorageCredential(c *gin.Context) {
|
|||||||
|
|
||||||
func UploadUpdateApp(c *gin.Context) {
|
func UploadUpdateApp(c *gin.Context) {
|
||||||
var (
|
var (
|
||||||
req apiStruct.UploadUpdateAppReq
|
req api.UploadUpdateAppReq
|
||||||
resp apiStruct.UploadUpdateAppResp
|
resp api.UploadUpdateAppResp
|
||||||
)
|
)
|
||||||
if err := c.Bind(&req); err != nil {
|
if err := c.Bind(&req); err != nil {
|
||||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "BindJSON failed ", err.Error())
|
log.NewError(req.OperationID, utils.GetSelfFuncName(), "BindJSON failed ", err.Error())
|
||||||
@@ -204,8 +218,8 @@ func UploadUpdateApp(c *gin.Context) {
|
|||||||
|
|
||||||
func GetDownloadURL(c *gin.Context) {
|
func GetDownloadURL(c *gin.Context) {
|
||||||
var (
|
var (
|
||||||
req apiStruct.GetDownloadURLReq
|
req api.GetDownloadURLReq
|
||||||
resp apiStruct.GetDownloadURLResp
|
resp api.GetDownloadURLResp
|
||||||
)
|
)
|
||||||
defer func() {
|
defer func() {
|
||||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp)
|
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp)
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ func TencentCloudStorageCredential(c *gin.Context) {
|
|||||||
if !ok {
|
if !ok {
|
||||||
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||||
log.NewError(req.OperationID, errMsg)
|
log.NewError(req.OperationID, errMsg)
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": errMsg})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -317,7 +317,7 @@ func SetGlobalRecvMessageOpt(c *gin.Context) {
|
|||||||
// @Param token header string true "im token"
|
// @Param token header string true "im token"
|
||||||
// @Param req body api.GetSelfUserInfoReq true "请求体"
|
// @Param req body api.GetSelfUserInfoReq true "请求体"
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Success 0 {object} api.GetSelfUserInfoResp
|
// @Success 0 {object} api.GetSelfUserInfoResp{data=open_im_sdk.UserInfo}
|
||||||
// @Failure 500 {object} api.GetSelfUserInfoResp "errCode为500 一般为服务器内部错误"
|
// @Failure 500 {object} api.GetSelfUserInfoResp "errCode为500 一般为服务器内部错误"
|
||||||
// @Failure 400 {object} api.GetSelfUserInfoResp "errCode为400 一般为参数输入错误, token未带上等"
|
// @Failure 400 {object} api.GetSelfUserInfoResp "errCode为400 一般为参数输入错误, token未带上等"
|
||||||
// @Router /user/get_self_user_info [post]
|
// @Router /user/get_self_user_info [post]
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ type CreateGroupReq struct {
|
|||||||
type CreateGroupResp struct {
|
type CreateGroupResp struct {
|
||||||
CommResp
|
CommResp
|
||||||
GroupInfo open_im_sdk.GroupInfo `json:"-"`
|
GroupInfo open_im_sdk.GroupInfo `json:"-"`
|
||||||
Data map[string]interface{} `json:"data"`
|
Data map[string]interface{} `json:"data" swaggerignore:"true"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type GetGroupApplicationListReq struct {
|
type GetGroupApplicationListReq struct {
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
package base_info
|
package base_info
|
||||||
|
|
||||||
type DelMsgReq struct {
|
type DelMsgReq struct {
|
||||||
OpUserID string `json:"opUserID,omitempty"`
|
UserID string `json:"userID,omitempty" binding:"required"`
|
||||||
UserID string `json:"userID,omitempty"`
|
SeqList []uint32 `json:"seqList,omitempty" binding:"required"`
|
||||||
SeqList []uint32 `json:"seqList,omitempty"`
|
OperationID string `json:"operationID,omitempty" binding:"required"`
|
||||||
OperationID string `json:"operationID,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type DelMsgResp struct {
|
type DelMsgResp struct {
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ type GetUsersInfoReq struct {
|
|||||||
type GetUsersInfoResp struct {
|
type GetUsersInfoResp struct {
|
||||||
CommResp
|
CommResp
|
||||||
UserInfoList []*open_im_sdk.PublicUserInfo `json:"-"`
|
UserInfoList []*open_im_sdk.PublicUserInfo `json:"-"`
|
||||||
Data []map[string]interface{} `json:"data"`
|
Data []map[string]interface{} `json:"data" swaggerignore:"true"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type UpdateSelfUserInfoReq struct {
|
type UpdateSelfUserInfoReq struct {
|
||||||
@@ -36,7 +36,7 @@ type GetSelfUserInfoReq struct {
|
|||||||
type GetSelfUserInfoResp struct {
|
type GetSelfUserInfoResp struct {
|
||||||
CommResp
|
CommResp
|
||||||
UserInfo *open_im_sdk.UserInfo `json:"-"`
|
UserInfo *open_im_sdk.UserInfo `json:"-"`
|
||||||
Data map[string]interface{} `json:"data"`
|
Data map[string]interface{} `json:"data" swaggerignore:"true"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type GetFriendIDListFromCacheReq struct {
|
type GetFriendIDListFromCacheReq struct {
|
||||||
|
|||||||
Reference in New Issue
Block a user