diff --git a/internal/api/manage/management_chat.go b/internal/api/manage/management_chat.go deleted file mode 100644 index 5d9b04e33..000000000 --- a/internal/api/manage/management_chat.go +++ /dev/null @@ -1,515 +0,0 @@ -/* -** description(""). -** copyright('open-im,www.open-im.io'). -** author("fg,Gordon@tuoyun.net"). -** time(2021/9/15 15:23). - */ -package manage - -import ( - "OpenIM/internal/apiresp" - api "OpenIM/pkg/apistruct" - "OpenIM/pkg/common/config" - "OpenIM/pkg/common/constant" - "OpenIM/pkg/common/log" - "OpenIM/pkg/common/tokenverify" - pbChat "OpenIM/pkg/proto/msg" - sdkws "OpenIM/pkg/proto/sdkws" - "OpenIM/pkg/utils" - "context" - "errors" - "net/http" - "strings" - - "github.com/gin-gonic/gin" - "github.com/go-playground/validator/v10" - "github.com/golang/protobuf/proto" - "github.com/mitchellh/mapstructure" -) - -var validate *validator.Validate - -func SetOptions(options map[string]bool, value bool) { - utils.SetSwitchFromOptions(options, constant.IsHistory, value) - utils.SetSwitchFromOptions(options, constant.IsPersistent, value) - utils.SetSwitchFromOptions(options, constant.IsSenderSync, value) - utils.SetSwitchFromOptions(options, constant.IsConversationUpdate, value) -} - -func newUserSendMsgReq(params *api.ManagementSendMsgReq) *pbChat.SendMsgReq { - var newContent string - var err error - switch params.ContentType { - case constant.Text: - newContent = params.Content["text"].(string) - case constant.Picture: - fallthrough - case constant.Custom: - fallthrough - case constant.Voice: - fallthrough - case constant.Video: - fallthrough - case constant.File: - fallthrough - case constant.CustomNotTriggerConversation: - fallthrough - case constant.CustomOnlineOnly: - fallthrough - case constant.AdvancedRevoke: - newContent = utils.StructToJsonString(params.Content) - case constant.Revoke: - newContent = params.Content["revokeMsgClientID"].(string) - default: - } - options := make(map[string]bool, 5) - if params.IsOnlineOnly { - SetOptions(options, false) - } - if params.NotOfflinePush { - utils.SetSwitchFromOptions(options, constant.IsOfflinePush, false) - } - if params.ContentType == constant.CustomOnlineOnly { - SetOptions(options, false) - } else if params.ContentType == constant.CustomNotTriggerConversation { - utils.SetSwitchFromOptions(options, constant.IsConversationUpdate, false) - } - - pbData := pbChat.SendMsgReq{ - OperationID: params.OperationID, - MsgData: &sdkws.MsgData{ - SendID: params.SendID, - GroupID: params.GroupID, - ClientMsgID: utils.GetMsgID(params.SendID), - SenderPlatformID: params.SenderPlatformID, - SenderNickname: params.SenderNickname, - SenderFaceURL: params.SenderFaceURL, - SessionType: params.SessionType, - MsgFrom: constant.SysMsgType, - ContentType: params.ContentType, - Content: []byte(newContent), - RecvID: params.RecvID, - // ForceList: params.ForceList, - CreateTime: utils.GetCurrentTimestampByMill(), - Options: options, - OfflinePushInfo: params.OfflinePushInfo, - }, - } - if params.ContentType == constant.OANotification { - var tips sdkws.TipsComm - tips.JsonDetail = utils.StructToJsonString(params.Content) - pbData.MsgData.Content, err = proto.Marshal(&tips) - if err != nil { - log.Error(params.OperationID, "Marshal failed ", err.Error(), tips.String()) - } - } - return &pbData -} -func init() { - validate = validator.New() -} - -// @Summary 管理员发送/撤回消息 -// @Description 管理员发送/撤回消息 消息格式详细见消息格式 -// @Tags 消息相关 -// @ID ManagementSendMsg -// @Accept json -// @Param token header string true "im token" -// @Param 管理员发送文字消息 body api.ManagementSendMsgReq{content=TextElem{}} true "该请求和消息结构体一样" -// @Param 管理员发送OA通知消息 body api.ManagementSendMsgReq{content=OANotificationElem{}} true "该请求和消息结构体一样" -// @Param 管理员撤回单聊消息 body api.ManagementSendMsgReq{content=RevokeElem{}} true "该请求和消息结构体一样" -// @Produce json -// @Success 0 {object} api.ManagementSendMsgResp "serverMsgID为服务器消息ID
clientMsgID为客户端消息ID
sendTime为发送消息时间" -// @Failure 500 {object} api.ManagementSendMsgResp "errCode为500 一般为服务器内部错误" -// @Failure 400 {object} api.ManagementSendMsgResp "errCode为400 一般为参数输入错误, token未带上等" -// @Router /msg/manage_send_msg [post] -func ManagementSendMsg(c *gin.Context) { - - apiresp.GinError(c, errors.New("todo")) - apiresp.GinSuccess(c, nil) - - var data interface{} - params := api.ManagementSendMsgReq{} - if err := c.BindJSON(¶ms); err != nil { - c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) - log.Error(c.PostForm("operationID"), "json unmarshal err", err.Error(), c.PostForm("content")) - return - } - switch params.ContentType { - case constant.Text: - data = TextElem{} - case constant.Picture: - data = PictureElem{} - case constant.Voice: - data = SoundElem{} - case constant.Video: - data = VideoElem{} - case constant.File: - data = FileElem{} - case constant.Custom: - data = CustomElem{} - case constant.Revoke: - data = RevokeElem{} - case constant.AdvancedRevoke: - data = MessageRevoked{} - case constant.OANotification: - data = OANotificationElem{} - params.SessionType = constant.NotificationChatType - case constant.CustomNotTriggerConversation: - data = CustomElem{} - case constant.CustomOnlineOnly: - data = CustomElem{} - //case constant.HasReadReceipt: - //case constant.Typing: - //case constant.Quote: - default: - c.JSON(http.StatusOK, gin.H{"errCode": 404, "errMsg": "contentType err"}) - log.Error(c.PostForm("operationID"), "contentType err", c.PostForm("content")) - return - } - if err := mapstructure.WeakDecode(params.Content, &data); err != nil { - c.JSON(http.StatusOK, gin.H{"errCode": 401, "errMsg": err.Error()}) - log.Error(c.PostForm("operationID"), "content to Map struct err", err.Error()) - return - } else if err := validate.Struct(data); err != nil { - c.JSON(http.StatusOK, gin.H{"errCode": 403, "errMsg": err.Error()}) - log.Error(c.PostForm("operationID"), "data args validate err", err.Error()) - return - } - log.NewInfo(params.OperationID, data, params) - token := c.Request.Header.Get("token") - claims, err := tokenverify.ParseToken(token, params.OperationID) - if err != nil { - log.NewError(params.OperationID, "parse token failed", err.Error(), token) - c.JSON(http.StatusOK, gin.H{"errCode": 400, "errMsg": "parse token failed", "sendTime": 0, "MsgID": ""}) - return - } - if !utils.IsContain(claims.UID, config.Config.Manager.AppManagerUid) { - log.NewError(params.OperationID, "not authorized", token) - c.JSON(http.StatusOK, gin.H{"errCode": 400, "errMsg": "not authorized", "sendTime": 0, "MsgID": ""}) - return - - } - switch params.SessionType { - case constant.SingleChatType: - if len(params.RecvID) == 0 { - log.NewError(params.OperationID, "recvID is a null string") - c.JSON(http.StatusOK, gin.H{"errCode": 405, "errMsg": "recvID is a null string", "sendTime": 0, "MsgID": ""}) - return - } - case constant.GroupChatType, constant.SuperGroupChatType: - if len(params.GroupID) == 0 { - log.NewError(params.OperationID, "groupID is a null string") - c.JSON(http.StatusOK, gin.H{"errCode": 405, "errMsg": "groupID is a null string", "sendTime": 0, "MsgID": ""}) - return - } - - } - log.NewInfo(params.OperationID, "Ws call success to ManagementSendMsgReq", params) - - pbData := newUserSendMsgReq(¶ms) - log.Info(params.OperationID, "", "api ManagementSendMsg call start..., [data: %s]", pbData.String()) - - etcdConn := rpc.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImMsgName, params.OperationID) - if etcdConn == nil { - errMsg := params.OperationID + "getcdv3.GetDefaultConn == nil" - log.NewError(params.OperationID, errMsg) - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) - return - } - client := pbChat.NewMsgClient(etcdConn) - log.Info(params.OperationID, "", "api ManagementSendMsg call, api call rpc...") - var status int32 - RpcResp, err := client.SendMsg(context.Background(), pbData) - if err != nil || (RpcResp != nil && RpcResp.ErrCode != 0) { - status = constant.MsgSendFailed - } else { - status = constant.MsgSendSuccessed - } - - respSetSendMsgStatus, err2 := client.SetSendMsgStatus(context.Background(), &pbChat.SetSendMsgStatusReq{OperationID: params.OperationID, Status: status}) - if err2 != nil { - log.NewError(params.OperationID, utils.GetSelfFuncName(), err2.Error()) - } - if respSetSendMsgStatus != nil && respSetSendMsgStatus.ErrCode != 0 { - log.NewError(params.OperationID, utils.GetSelfFuncName(), respSetSendMsgStatus.ErrCode, respSetSendMsgStatus.ErrMsg) - } - - log.Info(params.OperationID, "", "api ManagementSendMsg call end..., [data: %s] [reply: %s]", pbData.String(), RpcResp.String()) - resp := api.ManagementSendMsgResp{CommResp: api.CommResp{ErrCode: RpcResp.ErrCode, ErrMsg: RpcResp.ErrMsg}, ResultList: sdkws.UserSendMsgResp{ServerMsgID: RpcResp.ServerMsgID, ClientMsgID: RpcResp.ClientMsgID, SendTime: RpcResp.SendTime}} - log.Info(params.OperationID, "ManagementSendMsg return", resp) - c.JSON(http.StatusOK, resp) -} - -// @Summary 管理员批量发送群聊单聊消息 -// @Description 管理员批量发送群聊单聊消息 消息格式详细见
消息格式 -// @Tags 消息相关 -// @ID ManagementBatchSendMsg -// @Accept json -// @Param token header string true "im token" -// @Param 管理员批量发送单聊消息 body api.ManagementBatchSendMsgReq{content=TextElem{}} true "该请求和消息结构体一样
recvIDList为接受消息的用户ID列表" -// @Param 管理员批量发送OA通知 body api.ManagementSendMsgReq{content=OANotificationElem{}} true "该请求和消息结构体一样
recvIDList为接受消息的用户ID列表" -// @Produce json -// @Success 0 {object} api.ManagementBatchSendMsgReq "serverMsgID为服务器消息ID
clientMsgID为客户端消息ID
sendTime为发送消息时间" -// @Failure 500 {object} api.ManagementBatchSendMsgReq "errCode为500 一般为服务器内部错误" -// @Failure 400 {object} api.ManagementBatchSendMsgReq "errCode为400 一般为参数输入错误, token未带上等" -// @Router /msg/batch_send_msg [post] -func ManagementBatchSendMsg(c *gin.Context) { - var data interface{} - params := api.ManagementBatchSendMsgReq{} - resp := api.ManagementBatchSendMsgResp{} - resp.Data.FailedIDList = make([]string, 0) - if err := c.BindJSON(¶ms); err != nil { - c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) - log.Error(c.PostForm("operationID"), "json unmarshal err", err.Error(), c.PostForm("content")) - return - } - switch params.ContentType { - case constant.Text: - data = TextElem{} - case constant.Picture: - data = PictureElem{} - case constant.Voice: - data = SoundElem{} - case constant.Video: - data = VideoElem{} - case constant.File: - data = FileElem{} - //case constant.AtText: - // data = AtElem{} - //case constant.Merger: - // data = - //case constant.Card: - //case constant.Location: - case constant.Custom: - data = CustomElem{} - case constant.Revoke: - data = RevokeElem{} - case constant.OANotification: - data = OANotificationElem{} - params.SessionType = constant.NotificationChatType - case constant.CustomNotTriggerConversation: - data = CustomElem{} - case constant.CustomOnlineOnly: - data = CustomElem{} - //case constant.HasReadReceipt: - //case constant.Typing: - //case constant.Quote: - default: - c.JSON(http.StatusBadRequest, gin.H{"errCode": 404, "errMsg": "contentType err"}) - log.Error(c.PostForm("operationID"), "contentType err", c.PostForm("content")) - return - } - if err := mapstructure.WeakDecode(params.Content, &data); err != nil { - c.JSON(http.StatusBadRequest, gin.H{"errCode": 401, "errMsg": err.Error()}) - log.Error(c.PostForm("operationID"), "content to Map struct err", err.Error()) - return - } else if err := validate.Struct(data); err != nil { - c.JSON(http.StatusBadRequest, gin.H{"errCode": 403, "errMsg": err.Error()}) - log.Error(c.PostForm("operationID"), "data args validate err", err.Error()) - return - } - log.NewInfo(params.OperationID, data, params) - token := c.Request.Header.Get("token") - claims, err := tokenverify.ParseToken(token, params.OperationID) - if err != nil { - log.NewError(params.OperationID, "parse token failed", err.Error()) - c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "parse token failed", "sendTime": 0, "MsgID": ""}) - return - } - if !utils.IsContain(claims.UID, config.Config.Manager.AppManagerUid) { - c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "not authorized", "sendTime": 0, "MsgID": ""}) - return - } - log.NewInfo(params.OperationID, "Ws call success to ManagementSendMsgReq", params) - var msgSendFailedFlag bool - etcdConn := rpc.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImMsgName, params.OperationID) - if etcdConn == nil { - errMsg := params.OperationID + "getcdv3.GetDefaultConn == nil" - log.NewError(params.OperationID, errMsg) - c.JSON(http.StatusBadRequest, gin.H{"errCode": 500, "errMsg": "rpc server error: etcdConn == nil"}) - return - } - client := pbChat.NewMsgClient(etcdConn) - respSetSendMsgStatus, err := client.SetSendMsgStatus(context.Background(), &pbChat.SetSendMsgStatusReq{OperationID: params.OperationID, Status: constant.MsgIsSending}) - if err != nil { - log.NewError(params.OperationID, "call delete UserSendMsg rpc server failed", err.Error()) - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": err.Error()}) - return - } - if respSetSendMsgStatus.ErrCode != 0 { - log.NewError(params.OperationID, utils.GetSelfFuncName(), "rpc failed", respSetSendMsgStatus) - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": respSetSendMsgStatus.ErrMsg}) - return - } - - req := &api.ManagementSendMsgReq{ - ManagementSendMsg: params.ManagementSendMsg, - } - pbData := newUserSendMsgReq(req) - var recvList []string - if params.IsSendAll { - recvList, err = im_mysql_model.SelectAllUserID() - if err != nil { - log.NewError(params.OperationID, utils.GetSelfFuncName(), err.Error()) - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": err.Error()}) - } - } else { - recvList = params.RecvIDList - } - for _, recvID := range recvList { - pbData.MsgData.RecvID = recvID - log.Info(params.OperationID, "", "api ManagementSendMsg call start..., ", pbData.String()) - rpcResp, err := client.SendMsg(context.Background(), pbData) - if err != nil { - log.NewError(params.OperationID, "call delete UserSendMsg rpc server failed", err.Error()) - resp.Data.FailedIDList = append(resp.Data.FailedIDList, recvID) - msgSendFailedFlag = true - continue - } - if rpcResp.ErrCode != 0 { - log.NewError(params.OperationID, utils.GetSelfFuncName(), "rpc failed", pbData, rpcResp) - resp.Data.FailedIDList = append(resp.Data.FailedIDList, recvID) - msgSendFailedFlag = true - continue - } - resp.Data.ResultList = append(resp.Data.ResultList, &api.SingleReturnResult{ - ServerMsgID: rpcResp.ServerMsgID, - ClientMsgID: rpcResp.ClientMsgID, - SendTime: rpcResp.SendTime, - RecvID: recvID, - }) - } - var status int32 - if msgSendFailedFlag { - status = constant.MsgSendFailed - } else { - status = constant.MsgSendSuccessed - } - respSetSendMsgStatus, err2 := client.SetSendMsgStatus(context.Background(), &pbChat.SetSendMsgStatusReq{OperationID: params.OperationID, Status: status}) - if err2 != nil { - log.NewError(params.OperationID, utils.GetSelfFuncName(), err2.Error()) - } - if respSetSendMsgStatus != nil && resp.ErrCode != 0 { - log.NewError(params.OperationID, utils.GetSelfFuncName(), resp.ErrCode, resp.ErrMsg) - } - - log.NewInfo(params.OperationID, utils.GetSelfFuncName(), "resp: ", resp) - c.JSON(http.StatusOK, resp) -} - -func CheckMsgIsSendSuccess(c *gin.Context) { - var req api.CheckMsgIsSendSuccessReq - var resp api.CheckMsgIsSendSuccessResp - if err := c.BindJSON(&req); err != nil { - c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) - log.Error(c.PostForm("operationID"), "json unmarshal err", err.Error(), c.PostForm("content")) - return - } - etcdConn := rpc.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImMsgName, req.OperationID) - if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" - log.NewError(req.OperationID, errMsg) - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) - return - } - - client := pbChat.NewMsgClient(etcdConn) - rpcResp, err := client.GetSendMsgStatus(context.Background(), &pbChat.GetSendMsgStatusReq{OperationID: req.OperationID}) - if err != nil { - log.NewError(req.OperationID, utils.GetSelfFuncName(), err.Error()) - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call GetSendMsgStatus rpc server failed"}) - return - } - resp.ErrMsg = rpcResp.ErrMsg - resp.ErrCode = rpcResp.ErrCode - resp.Status = rpcResp.Status - c.JSON(http.StatusOK, resp) -} - -type PictureBaseInfo struct { - UUID string `mapstructure:"uuid"` - Type string `mapstructure:"type" ` - Size int64 `mapstructure:"size" ` - Width int32 `mapstructure:"width" ` - Height int32 `mapstructure:"height"` - Url string `mapstructure:"url" ` -} - -type PictureElem struct { - SourcePath string `mapstructure:"sourcePath"` - SourcePicture PictureBaseInfo `mapstructure:"sourcePicture"` - BigPicture PictureBaseInfo `mapstructure:"bigPicture" ` - SnapshotPicture PictureBaseInfo `mapstructure:"snapshotPicture"` -} -type SoundElem struct { - UUID string `mapstructure:"uuid"` - SoundPath string `mapstructure:"soundPath"` - SourceURL string `mapstructure:"sourceUrl"` - DataSize int64 `mapstructure:"dataSize"` - Duration int64 `mapstructure:"duration"` -} -type VideoElem struct { - VideoPath string `mapstructure:"videoPath"` - VideoUUID string `mapstructure:"videoUUID"` - VideoURL string `mapstructure:"videoUrl"` - VideoType string `mapstructure:"videoType"` - VideoSize int64 `mapstructure:"videoSize"` - Duration int64 `mapstructure:"duration"` - SnapshotPath string `mapstructure:"snapshotPath"` - SnapshotUUID string `mapstructure:"snapshotUUID"` - SnapshotSize int64 `mapstructure:"snapshotSize"` - SnapshotURL string `mapstructure:"snapshotUrl"` - SnapshotWidth int32 `mapstructure:"snapshotWidth"` - SnapshotHeight int32 `mapstructure:"snapshotHeight"` -} -type FileElem struct { - FilePath string `mapstructure:"filePath"` - UUID string `mapstructure:"uuid"` - SourceURL string `mapstructure:"sourceUrl"` - FileName string `mapstructure:"fileName"` - FileSize int64 `mapstructure:"fileSize"` -} -type AtElem struct { - Text string `mapstructure:"text"` - AtUserList []string `mapstructure:"atUserList"` - IsAtSelf bool `mapstructure:"isAtSelf"` -} -type LocationElem struct { - Description string `mapstructure:"description"` - Longitude float64 `mapstructure:"longitude"` - Latitude float64 `mapstructure:"latitude"` -} -type CustomElem struct { - Data string `mapstructure:"data" validate:"required"` - Description string `mapstructure:"description"` - Extension string `mapstructure:"extension"` -} -type TextElem struct { - Text string `mapstructure:"text" validate:"required"` -} - -type RevokeElem struct { - RevokeMsgClientID string `mapstructure:"revokeMsgClientID" validate:"required"` -} -type OANotificationElem struct { - NotificationName string `mapstructure:"notificationName" json:"notificationName" validate:"required"` - NotificationFaceURL string `mapstructure:"notificationFaceURL" json:"notificationFaceURL"` - NotificationType int32 `mapstructure:"notificationType" json:"notificationType" validate:"required"` - Text string `mapstructure:"text" json:"text" validate:"required"` - Url string `mapstructure:"url" json:"url"` - MixType int32 `mapstructure:"mixType" json:"mixType"` - PictureElem PictureElem `mapstructure:"pictureElem" json:"pictureElem"` - SoundElem SoundElem `mapstructure:"soundElem" json:"soundElem"` - VideoElem VideoElem `mapstructure:"videoElem" json:"videoElem"` - FileElem FileElem `mapstructure:"fileElem" json:"fileElem"` - Ex string `mapstructure:"ex" json:"ex"` -} -type MessageRevoked struct { - RevokerID string `mapstructure:"revokerID" json:"revokerID" validate:"required"` - RevokerRole int32 `mapstructure:"revokerRole" json:"revokerRole" validate:"required"` - ClientMsgID string `mapstructure:"clientMsgID" json:"clientMsgID" validate:"required"` - RevokerNickname string `mapstructure:"revokerNickname" json:"revokerNickname"` - SessionType int32 `mapstructure:"sessionType" json:"sessionType" validate:"required"` - Seq uint32 `mapstructure:"seq" json:"seq" validate:"required"` -} diff --git a/internal/api/manage/management_user.go b/internal/api/manage/management_user.go deleted file mode 100644 index 3b53d6430..000000000 --- a/internal/api/manage/management_user.go +++ /dev/null @@ -1,197 +0,0 @@ -/* -** description(""). -** copyright('open-im,www.open-im.io'). -** author("fg,Gordon@tuoyun.net"). -** time(2021/9/15 10:28). - */ -package manage - -import ( - api "OpenIM/pkg/apistruct" - "OpenIM/pkg/common/config" - "OpenIM/pkg/common/constant" - "OpenIM/pkg/common/log" - "OpenIM/pkg/common/tokenverify" - msggateway "OpenIM/pkg/proto/relay" - rpc "OpenIM/pkg/proto/user" - "OpenIM/pkg/utils" - "context" - "net/http" - "strings" - - "github.com/gin-gonic/gin" -) - -// @Summary 获取所有用户uid列表 -// @Description 获取所有用户uid列表 -// @Tags 用户相关 -// @ID GetAllUsersUid -// @Accept json -// @Param token header string true "im token" -// @Param req body api.GetAllUsersUidReq true "请求体" -// @Produce json -// @Success 0 {object} api.GetAllUsersUidResp -// @Failure 500 {object} api.Swagger500Resp "errCode为500 一般为服务器内部错误" -// @Failure 400 {object} api.Swagger400Resp "errCode为400 一般为参数输入错误, token未带上等" -// @Router /user/get_all_users_uid [post] -func GetAllUsersUid(c *gin.Context) { - params := api.GetAllUsersUidReq{} - if err := c.BindJSON(¶ms); err != nil { - c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) - return - } - req := &rpc.GetAllUserIDReq{} - utils.CopyStructFields(req, ¶ms) - - var ok bool - var errInfo string - ok, req.OpUserID, errInfo = tokenverify.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 - } - - log.NewInfo(params.OperationID, "GetAllUsersUid args ", req.String()) - etcdConn := rpc.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, req.OperationID) - if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" - log.NewError(req.OperationID, errMsg) - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) - return - } - client := rpc.NewUserClient(etcdConn) - RpcResp, err := client.GetAllUserID(context.Background(), req) - if err != nil { - log.NewError(req.OperationID, "call GetAllUsersUid users rpc server failed", err.Error()) - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call GetAllUsersUid users rpc server failed"}) - return - } - resp := api.GetAllUsersUidResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}, UserIDList: RpcResp.UserIDList} - if len(RpcResp.UserIDList) == 0 { - resp.UserIDList = []string{} - } - log.NewInfo(req.OperationID, "GetAllUsersUid api return", resp) - c.JSON(http.StatusOK, resp) - -} - -// @Summary 检查列表账户注册状态,并且返回结果 -// @Description 传入UserIDList检查列表账户注册状态,并且返回结果 -// @Tags 用户相关 -// @ID AccountCheck -// @Accept json -// @Param token header string true "im token" -// @Param req body api.AccountCheckReq true "请求体" -// @Produce json -// @Success 0 {object} api.AccountCheckResp -// @Failure 500 {object} api.Swagger500Resp "errCode为500 一般为服务器内部错误" -// @Failure 400 {object} api.Swagger400Resp "errCode为400 一般为参数输入错误, token未带上等" -// @Router /user/account_check [post] -func AccountCheck(c *gin.Context) { - params := api.AccountCheckReq{} - if err := c.BindJSON(¶ms); err != nil { - c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) - return - } - req := &rpc.AccountCheckReq{} - utils.CopyStructFields(req, ¶ms) - - var ok bool - var errInfo string - ok, req.OpUserID, errInfo = tokenverify.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 - } - - log.NewInfo(params.OperationID, "AccountCheck args ", req.String()) - etcdConn := rpc.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, req.OperationID) - if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" - log.NewError(req.OperationID, errMsg) - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) - return - } - client := rpc.NewUserClient(etcdConn) - - RpcResp, err := client.AccountCheck(context.Background(), req) - if err != nil { - log.NewError(req.OperationID, "call AccountCheck users rpc server failed", err.Error()) - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call AccountCheck users rpc server failed"}) - return - } - resp := api.AccountCheckResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}, ResultList: RpcResp.ResultList} - if len(RpcResp.ResultList) == 0 { - resp.ResultList = []*rpc.AccountCheckResp_SingleUserStatus{} - } - log.NewInfo(req.OperationID, "AccountCheck api return", resp) - c.JSON(http.StatusOK, resp) -} - -func GetUsersOnlineStatus(c *gin.Context) { - params := api.GetUsersOnlineStatusReq{} - if err := c.BindJSON(¶ms); err != nil { - c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) - return - } - req := &msggateway.GetUsersOnlineStatusReq{} - utils.CopyStructFields(req, ¶ms) - - var ok bool - var errInfo string - ok, req.OpUserID, errInfo = tokenverify.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.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) - return - } - - log.NewInfo(params.OperationID, "GetUsersOnlineStatus args ", req.String()) - var wsResult []*msggateway.GetUsersOnlineStatusResp_SuccessResult - var respResult []*msggateway.GetUsersOnlineStatusResp_SuccessResult - flag := false - grpcCons := rpc.GetDefaultGatewayConn4Unique(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), params.OperationID) - for _, v := range grpcCons { - client := msggateway.NewRelayClient(v) - reply, err := client.GetUsersOnlineStatus(context.Background(), req) - if err != nil { - log.NewError(params.OperationID, "GetUsersOnlineStatus rpc err", req.String(), err.Error()) - continue - } else { - if reply.ErrCode == 0 { - wsResult = append(wsResult, reply.SuccessResult...) - } - } - } - log.NewInfo(params.OperationID, "call GetUsersOnlineStatus rpc server is success", wsResult) - //Online data merge of each node - for _, v1 := range params.UserIDList { - flag = false - temp := new(msggateway.GetUsersOnlineStatusResp_SuccessResult) - for _, v2 := range wsResult { - if v2.UserID == v1 { - flag = true - temp.UserID = v1 - temp.Status = constant.OnlineStatus - temp.DetailPlatformStatus = append(temp.DetailPlatformStatus, v2.DetailPlatformStatus...) - } - - } - if !flag { - temp.UserID = v1 - temp.Status = constant.OfflineStatus - } - respResult = append(respResult, temp) - } - resp := api.GetUsersOnlineStatusResp{CommResp: api.CommResp{ErrCode: 0, ErrMsg: ""}, SuccessResult: respResult} - if len(respResult) == 0 { - resp.SuccessResult = []*msggateway.GetUsersOnlineStatusResp_SuccessResult{} - } - log.NewInfo(req.OperationID, "GetUsersOnlineStatus api return", resp) - c.JSON(http.StatusOK, resp) -} diff --git a/internal/api/msg.go b/internal/api/msg.go index 0cbb6e224..a6e73998f 100644 --- a/internal/api/msg.go +++ b/internal/api/msg.go @@ -2,23 +2,114 @@ package api import ( "OpenIM/internal/api/a2r" + "OpenIM/internal/apiresp" + "OpenIM/pkg/apistruct" "OpenIM/pkg/common/config" + "OpenIM/pkg/common/constant" + "OpenIM/pkg/common/log" "OpenIM/pkg/proto/msg" + "OpenIM/pkg/proto/sdkws" + "OpenIM/pkg/utils" "context" + "errors" "github.com/OpenIMSDK/openKeeper" "github.com/gin-gonic/gin" + "github.com/go-playground/validator/v10" + "github.com/golang/protobuf/proto" + "github.com/mitchellh/mapstructure" + "net/http" ) var _ context.Context // 解决goland编辑器bug -func NewMsg(zk *openKeeper.ZkClient) *Conversation { - return &Conversation{zk: zk} +func NewMsg(zk *openKeeper.ZkClient) *Msg { + return &Msg{zk: zk} } type Msg struct { zk *openKeeper.ZkClient } +var validate *validator.Validate + +func SetOptions(options map[string]bool, value bool) { + utils.SetSwitchFromOptions(options, constant.IsHistory, value) + utils.SetSwitchFromOptions(options, constant.IsPersistent, value) + utils.SetSwitchFromOptions(options, constant.IsSenderSync, value) + utils.SetSwitchFromOptions(options, constant.IsConversationUpdate, value) +} + +func newUserSendMsgReq(params *apistruct.ManagementSendMsgReq) *msg.SendMsgReq { + var newContent string + var err error + switch params.ContentType { + case constant.Text: + newContent = params.Content["text"].(string) + case constant.Picture: + fallthrough + case constant.Custom: + fallthrough + case constant.Voice: + fallthrough + case constant.Video: + fallthrough + case constant.File: + fallthrough + case constant.CustomNotTriggerConversation: + fallthrough + case constant.CustomOnlineOnly: + fallthrough + case constant.AdvancedRevoke: + newContent = utils.StructToJsonString(params.Content) + case constant.Revoke: + newContent = params.Content["revokeMsgClientID"].(string) + default: + } + options := make(map[string]bool, 5) + if params.IsOnlineOnly { + SetOptions(options, false) + } + if params.NotOfflinePush { + utils.SetSwitchFromOptions(options, constant.IsOfflinePush, false) + } + if params.ContentType == constant.CustomOnlineOnly { + SetOptions(options, false) + } else if params.ContentType == constant.CustomNotTriggerConversation { + utils.SetSwitchFromOptions(options, constant.IsConversationUpdate, false) + } + + pbData := msg.SendMsgReq{ + MsgData: &sdkws.MsgData{ + SendID: params.SendID, + GroupID: params.GroupID, + ClientMsgID: utils.GetMsgID(params.SendID), + SenderPlatformID: params.SenderPlatformID, + SenderNickname: params.SenderNickname, + SenderFaceURL: params.SenderFaceURL, + SessionType: params.SessionType, + MsgFrom: constant.SysMsgType, + ContentType: params.ContentType, + Content: []byte(newContent), + RecvID: params.RecvID, + CreateTime: utils.GetCurrentTimestampByMill(), + Options: options, + OfflinePushInfo: params.OfflinePushInfo, + }, + } + if params.ContentType == constant.OANotification { + var tips sdkws.TipsComm + tips.JsonDetail = utils.StructToJsonString(params.Content) + pbData.MsgData.Content, err = proto.Marshal(&tips) + if err != nil { + log.Error(params.OperationID, "Marshal failed ", err.Error(), tips.String()) + } + } + return &pbData +} +func init() { + validate = validator.New() +} + func (o *Msg) client() (msg.MsgClient, error) { conn, err := o.zk.GetConn(config.Config.RpcRegisterName.OpenImMsgName) if err != nil { @@ -28,19 +119,19 @@ func (o *Msg) client() (msg.MsgClient, error) { } func (o *Msg) GetSeq(c *gin.Context) { - a2r.Call(msg.MsgClient.GetSeq, o.client, c) + a2r.Call(msg.MsgClient.GetMaxAndMinSeq, o.client, c) } func (o *Msg) SendMsg(c *gin.Context) { a2r.Call(msg.MsgClient.SendMsg, o.client, c) } -func (o *Msg) PullMsgBySeqList(c *gin.Context) { - a2r.Call(msg.MsgClient.PullMsgBySeqList, o.client, c) +func (o *Msg) PullMsgBySeqs(c *gin.Context) { + a2r.Call(msg.MsgClient.PullMessageBySeqs, o.client, c) } func (o *Msg) DelMsg(c *gin.Context) { - a2r.Call(msg.MsgClient.DelMsg, o.client, c) + a2r.Call(msg.MsgClient.DelMsgs, o.client, c) } func (o *Msg) DelSuperGroupMsg(c *gin.Context) { @@ -51,16 +142,12 @@ func (o *Msg) ClearMsg(c *gin.Context) { a2r.Call(msg.MsgClient.ClearMsg, o.client, c) } -func (o *Msg) SetMsgMinSeq(c *gin.Context) { - a2r.Call(msg.MsgClient.SetMsgMinSeq, o.client, c) -} - func (o *Msg) SetMessageReactionExtensions(c *gin.Context) { a2r.Call(msg.MsgClient.SetMessageReactionExtensions, o.client, c) } func (o *Msg) GetMessageListReactionExtensions(c *gin.Context) { - a2r.Call(msg.MsgClient.GetMessageListReactionExtensions, o.client, c) + a2r.Call(msg.MsgClient.GetMessagesReactionExtensions, o.client, c) } func (o *Msg) AddMessageReactionExtensions(c *gin.Context) { @@ -72,13 +159,189 @@ func (o *Msg) DeleteMessageReactionExtensions(c *gin.Context) { } func (o *Msg) ManagementSendMsg(c *gin.Context) { - a2r.Call(msg.MsgClient.ManagementSendMsg, o.client, c) + var data interface{} + params := apistruct.ManagementSendMsgReq{} + if err := c.BindJSON(¶ms); err != nil { + apiresp.GinError(c, err) + return + } + switch params.ContentType { + case constant.Text: + data = TextElem{} + case constant.Picture: + data = PictureElem{} + case constant.Voice: + data = SoundElem{} + case constant.Video: + data = VideoElem{} + case constant.File: + data = FileElem{} + case constant.Custom: + data = CustomElem{} + case constant.Revoke: + data = RevokeElem{} + case constant.AdvancedRevoke: + data = MessageRevoked{} + case constant.OANotification: + data = OANotificationElem{} + params.SessionType = constant.NotificationChatType + case constant.CustomNotTriggerConversation: + data = CustomElem{} + case constant.CustomOnlineOnly: + data = CustomElem{} + //case constant.HasReadReceipt: + //case constant.Typing: + //case constant.Quote: + default: + apiresp.GinError(c, errors.New("wrong contentType")) + return + } + if err := mapstructure.WeakDecode(params.Content, &data); err != nil { + apiresp.GinError(c, constant.ErrData) + return + } else if err := validate.Struct(data); err != nil { + apiresp.GinError(c, constant.ErrData) + return + } + log.NewInfo(params.OperationID, data, params) + switch params.SessionType { + case constant.SingleChatType: + if len(params.RecvID) == 0 { + apiresp.GinError(c, constant.ErrData) + return + } + case constant.GroupChatType, constant.SuperGroupChatType: + if len(params.GroupID) == 0 { + apiresp.GinError(c, constant.ErrData) + return + } + } + log.NewInfo(params.OperationID, "Ws call success to ManagementSendMsgReq", params) + pbData := newUserSendMsgReq(¶ms) + conn, err := o.zk.GetConn(config.Config.RpcRegisterName.OpenImMsgName) + if err != nil { + apiresp.GinError(c, constant.ErrInternalServer) + return + } + client := msg.NewMsgClient(conn) + log.Info(params.OperationID, "", "api ManagementSendMsg call, api call rpc...") + //var status int32 + RpcResp, err := client.SendMsg(context.Background(), pbData) + if err != nil { + //status = constant.MsgSendFailed + apiresp.GinError(c, err) + return + } + //status = constant.MsgSendSuccessed + //_, err2 := client.SetSendMsgStatus(context.Background(), &msg.SetSendMsgStatusReq{OperationID: params.OperationID, Status: status}) + //if err2 != nil { + // log.NewError(params.OperationID, utils.GetSelfFuncName(), err2.Error()) + //} + log.Info(params.OperationID, "", "api ManagementSendMsg call end..., [data: %s] [reply: %s]", pbData.String(), RpcResp.String()) + resp := apistruct.ManagementSendMsgResp{ResultList: sdkws.UserSendMsgResp{ServerMsgID: RpcResp.ServerMsgID, ClientMsgID: RpcResp.ClientMsgID, SendTime: RpcResp.SendTime}} + log.Info(params.OperationID, "ManagementSendMsg return", resp) + c.JSON(http.StatusOK, resp) } func (o *Msg) ManagementBatchSendMsg(c *gin.Context) { - a2r.Call(msg.MsgClient.ManagementBatchSendMsg, o.client, c) + a2r.Call(msg.MsgClient.SendMsg, o.client, c) } func (o *Msg) CheckMsgIsSendSuccess(c *gin.Context) { - a2r.Call(msg.MsgClient.CheckMsgIsSendSuccess, o.client, c) + a2r.Call(msg.MsgClient.GetSendMsgStatus, o.client, c) +} + +func (o *Msg) GetUsersOnlineStatus(c *gin.Context) { + a2r.Call(msg.MsgClient.GetSendMsgStatus, o.client, c) +} + +func (o *Msg) AccountCheck(c *gin.Context) { + a2r.Call(msg.MsgClient.GetSendMsgStatus, o.client, c) +} + +type PictureBaseInfo struct { + UUID string `mapstructure:"uuid"` + Type string `mapstructure:"type" ` + Size int64 `mapstructure:"size" ` + Width int32 `mapstructure:"width" ` + Height int32 `mapstructure:"height"` + Url string `mapstructure:"url" ` +} + +type PictureElem struct { + SourcePath string `mapstructure:"sourcePath"` + SourcePicture PictureBaseInfo `mapstructure:"sourcePicture"` + BigPicture PictureBaseInfo `mapstructure:"bigPicture" ` + SnapshotPicture PictureBaseInfo `mapstructure:"snapshotPicture"` +} +type SoundElem struct { + UUID string `mapstructure:"uuid"` + SoundPath string `mapstructure:"soundPath"` + SourceURL string `mapstructure:"sourceUrl"` + DataSize int64 `mapstructure:"dataSize"` + Duration int64 `mapstructure:"duration"` +} +type VideoElem struct { + VideoPath string `mapstructure:"videoPath"` + VideoUUID string `mapstructure:"videoUUID"` + VideoURL string `mapstructure:"videoUrl"` + VideoType string `mapstructure:"videoType"` + VideoSize int64 `mapstructure:"videoSize"` + Duration int64 `mapstructure:"duration"` + SnapshotPath string `mapstructure:"snapshotPath"` + SnapshotUUID string `mapstructure:"snapshotUUID"` + SnapshotSize int64 `mapstructure:"snapshotSize"` + SnapshotURL string `mapstructure:"snapshotUrl"` + SnapshotWidth int32 `mapstructure:"snapshotWidth"` + SnapshotHeight int32 `mapstructure:"snapshotHeight"` +} +type FileElem struct { + FilePath string `mapstructure:"filePath"` + UUID string `mapstructure:"uuid"` + SourceURL string `mapstructure:"sourceUrl"` + FileName string `mapstructure:"fileName"` + FileSize int64 `mapstructure:"fileSize"` +} +type AtElem struct { + Text string `mapstructure:"text"` + AtUserList []string `mapstructure:"atUserList"` + IsAtSelf bool `mapstructure:"isAtSelf"` +} +type LocationElem struct { + Description string `mapstructure:"description"` + Longitude float64 `mapstructure:"longitude"` + Latitude float64 `mapstructure:"latitude"` +} +type CustomElem struct { + Data string `mapstructure:"data" validate:"required"` + Description string `mapstructure:"description"` + Extension string `mapstructure:"extension"` +} +type TextElem struct { + Text string `mapstructure:"text" validate:"required"` +} + +type RevokeElem struct { + RevokeMsgClientID string `mapstructure:"revokeMsgClientID" validate:"required"` +} +type OANotificationElem struct { + NotificationName string `mapstructure:"notificationName" json:"notificationName" validate:"required"` + NotificationFaceURL string `mapstructure:"notificationFaceURL" json:"notificationFaceURL"` + NotificationType int32 `mapstructure:"notificationType" json:"notificationType" validate:"required"` + Text string `mapstructure:"text" json:"text" validate:"required"` + Url string `mapstructure:"url" json:"url"` + MixType int32 `mapstructure:"mixType" json:"mixType"` + PictureElem PictureElem `mapstructure:"pictureElem" json:"pictureElem"` + SoundElem SoundElem `mapstructure:"soundElem" json:"soundElem"` + VideoElem VideoElem `mapstructure:"videoElem" json:"videoElem"` + FileElem FileElem `mapstructure:"fileElem" json:"fileElem"` + Ex string `mapstructure:"ex" json:"ex"` +} +type MessageRevoked struct { + RevokerID string `mapstructure:"revokerID" json:"revokerID" validate:"required"` + RevokerRole int32 `mapstructure:"revokerRole" json:"revokerRole" validate:"required"` + ClientMsgID string `mapstructure:"clientMsgID" json:"clientMsgID" validate:"required"` + RevokerNickname string `mapstructure:"revokerNickname" json:"revokerNickname"` + SessionType int32 `mapstructure:"sessionType" json:"sessionType" validate:"required"` + Seq uint32 `mapstructure:"seq" json:"seq" validate:"required"` } diff --git a/internal/api/route.go b/internal/api/route.go index a71bc9f08..91e6724fe 100644 --- a/internal/api/route.go +++ b/internal/api/route.go @@ -39,7 +39,7 @@ func NewGinRouter() *gin.Engine { userRouterGroup.POST("/update_user_info", u.UpdateUserInfo) //1 userRouterGroup.POST("/set_global_msg_recv_opt", u.SetGlobalRecvMessageOpt) userRouterGroup.POST("/get_users_info", u.GetUsersPublicInfo) //1 - //userRouterGroup.POST("/get_all_users_uid", manage.GetAllUsersUid) // todo + userRouterGroup.POST("/get_all_users_uid", u.GetAllUsersID) // todo //userRouterGroup.POST("/account_check", manage.AccountCheck) // todo userRouterGroup.POST("/get_users", u.GetUsers) } @@ -118,17 +118,19 @@ func NewGinRouter() *gin.Engine { ////Message chatGroup := r.Group("/msg") { - chatGroup.POST("/newest_seq", msg.GetSeq) - chatGroup.POST("/send_msg", msg.SendMsg) - chatGroup.POST("/pull_msg_by_seq", msg.PullMsgBySeqList) - chatGroup.POST("/del_msg", msg.DelMsg) - chatGroup.POST("/del_super_group_msg", msg.DelSuperGroupMsg) - chatGroup.POST("/clear_msg", msg.ClearMsg) - chatGroup.POST("/manage_send_msg", manage.ManagementSendMsg) - chatGroup.POST("/batch_send_msg", manage.ManagementBatchSendMsg) - chatGroup.POST("/check_msg_is_send_success", manage.CheckMsgIsSendSuccess) - chatGroup.POST("/set_msg_min_seq", msg.SetMsgMinSeq) + m := NewMsg(zk) + chatGroup.POST("/newest_seq", m.GetSeq) + chatGroup.POST("/send_msg", m.SendMsg) + chatGroup.POST("/pull_msg_by_seq", m.PullMsgBySeqs) + chatGroup.POST("/del_msg", m.DelMsg) + chatGroup.POST("/del_super_group_msg", m.DelSuperGroupMsg) + chatGroup.POST("/clear_msg", m.ClearMsg) + chatGroup.POST("/manage_send_msg", m.ManagementSendMsg) + chatGroup.POST("/batch_send_msg", m.ManagementBatchSendMsg) + chatGroup.POST("/check_msg_is_send_success", m.CheckMsgIsSendSuccess) + chatGroup.POST("/get_users_online_status", m.GetUsersOnlineStatus) + chatGroup.POST("/account_check", m.AccountCheck) //chatGroup.POST("/set_message_reaction_extensions", msg.SetMessageReactionExtensions) //chatGroup.POST("/get_message_list_reaction_extensions", msg.GetMessageListReactionExtensions) //chatGroup.POST("/add_message_reaction_extensions", msg.AddMessageReactionExtensions) diff --git a/internal/api/user.go b/internal/api/user.go index 8599840dc..9225a1418 100644 --- a/internal/api/user.go +++ b/internal/api/user.go @@ -43,13 +43,14 @@ func (o *User) GetUsersPublicInfo(c *gin.Context) { a2r.Call(user.UserClient.GetDesignateUsers, o.client, c) } -//func (u *User) GetAllUsersUid(c *gin.Context) { -// a2r.Call(user.UserClient.GetAllUsersUid, u.client, c) -//} +func (o *User) GetAllUsersID(c *gin.Context) { + a2r.Call(user.UserClient.GetDesignateUsers, o.client, c) +} + // -//func (u *User) AccountCheck(c *gin.Context) { -// a2r.Call(user.UserClient.AccountCheck, u.client, c) -//} +func (u *User) AccountCheck(c *gin.Context) { + a2r.Call(user.UserClient.AccountCheck, u.client, c) +} func (o *User) GetUsers(c *gin.Context) { a2r.Call(user.UserClient.GetPaginationUsers, o.client, c) diff --git a/pkg/apistruct/manage.go b/pkg/apistruct/manage.go index df781ce3b..018280bf9 100644 --- a/pkg/apistruct/manage.go +++ b/pkg/apistruct/manage.go @@ -59,7 +59,6 @@ type ManagementSendMsgReq struct { } type ManagementSendMsgResp struct { - CommResp ResultList sdkws.UserSendMsgResp `json:"data"` }