Merge branch 'errcode' of github.com:OpenIMSDK/Open-IM-Server into errcode

 Conflicts:
	internal/api/auth.go
	internal/api/route.go
	internal/api/user.go
	internal/rpc/third/third.go
This commit is contained in:
wangchuxiao
2023-03-03 17:45:15 +08:00
38 changed files with 1710 additions and 2227 deletions
+53 -30
View File
@@ -1,14 +1,13 @@
package api
import (
"OpenIM/internal/api/conversation"
"OpenIM/internal/api/manage"
"OpenIM/internal/api/msg"
"OpenIM/internal/api/third"
"OpenIM/pkg/common/config"
"OpenIM/pkg/common/log"
"OpenIM/pkg/common/middleware"
"OpenIM/pkg/common/prome"
"github.com/OpenIMSDK/openKeeper"
"github.com/gin-gonic/gin"
"io"
"os"
@@ -31,9 +30,11 @@ func NewGinRouter() *gin.Engine {
r.GET("/metrics", prome.PrometheusHandler())
}
var zk *openKeeper.ZkClient
userRouterGroup := r.Group("/user")
{
u := NewUser(nil)
u := NewUser(zk)
userRouterGroup.POST("/user_register", u.UserRegister)
userRouterGroup.POST("/update_user_info", u.UpdateUserInfo) //1
userRouterGroup.POST("/set_global_msg_recv_opt", u.SetGlobalRecvMessageOpt)
@@ -50,23 +51,23 @@ func NewGinRouter() *gin.Engine {
////friend routing group
friendRouterGroup := r.Group("/friend")
{
f := NewFriend(nil)
friendRouterGroup.POST("/add_friend", f.AddFriend) //1
f := NewFriend(zk)
friendRouterGroup.POST("/add_friend", f.ApplyToAddFriend) //1
friendRouterGroup.POST("/delete_friend", f.DeleteFriend) //1
friendRouterGroup.POST("/get_friend_apply_list", f.GetFriendApplyList) //1
friendRouterGroup.POST("/get_self_friend_apply_list", f.GetSelfApplyList) //1
friendRouterGroup.POST("/get_friend_list", f.GetFriendList) //1
friendRouterGroup.POST("/add_friend_response", f.AddFriendResponse) //1
friendRouterGroup.POST("/add_friend_response", f.RespondFriendApply) //1
friendRouterGroup.POST("/set_friend_remark", f.SetFriendRemark) //1
friendRouterGroup.POST("/add_black", f.AddBlack) //1
friendRouterGroup.POST("/get_black_list", f.GetBlacklist) //1
friendRouterGroup.POST("/remove_black", f.RemoveBlacklist) //1
friendRouterGroup.POST("/import_friend", f.ImportFriend) //1
friendRouterGroup.POST("/get_black_list", f.GetPaginationBlacks) //1
friendRouterGroup.POST("/remove_black", f.RemoveBlack) //1
friendRouterGroup.POST("/import_friend", f.ImportFriends) //1
friendRouterGroup.POST("/is_friend", f.IsFriend) //1
}
groupRouterGroup := r.Group("/group")
g := NewGroup(nil)
g := NewGroup(zk)
{
groupRouterGroup.POST("/create_group", g.NewCreateGroup) //1
groupRouterGroup.POST("/set_group_info", g.NewSetGroupInfo) //1
@@ -99,8 +100,8 @@ func NewGinRouter() *gin.Engine {
////certificate
authRouterGroup := r.Group("/auth")
{
a := NewAuth(nil)
u := NewUser(nil)
a := NewAuth(zk)
u := NewUser(zk)
authRouterGroup.POST("/user_register", u.UserRegister) //1
authRouterGroup.POST("/user_token", a.UserToken) //1
authRouterGroup.POST("/parse_token", a.ParseToken) //1
@@ -109,17 +110,16 @@ func NewGinRouter() *gin.Engine {
////Third service
thirdGroup := r.Group("/third")
{
thirdGroup.POST("/tencent_cloud_storage_credential", third.TencentCloudStorageCredential)
thirdGroup.POST("/ali_oss_credential", third.AliOSSCredential)
thirdGroup.POST("/minio_storage_credential", third.MinioStorageCredential)
thirdGroup.POST("/minio_upload", third.MinioUploadFile)
thirdGroup.POST("/upload_update_app", third.UploadUpdateApp)
thirdGroup.POST("/get_download_url", third.GetDownloadURL)
thirdGroup.POST("/get_rtc_invitation_info", third.GetRTCInvitationInfo)
thirdGroup.POST("/get_rtc_invitation_start_app", third.GetRTCInvitationInfoStartApp)
thirdGroup.POST("/fcm_update_token", third.FcmUpdateToken)
thirdGroup.POST("/aws_storage_credential", third.AwsStorageCredential)
thirdGroup.POST("/set_app_badge", third.SetAppBadge)
t := NewThird(zk)
thirdGroup.POST("/get_rtc_invitation_info", t.GetSignalInvitationInfo)
thirdGroup.POST("/get_rtc_invitation_start_app", t.GetSignalInvitationInfoStartApp)
thirdGroup.POST("/fcm_update_token", t.FcmUpdateToken)
thirdGroup.POST("/set_app_badge", t.SetAppBadge)
thirdGroup.POST("/apply_put", t.ApplyPut)
thirdGroup.POST("/get_put", t.GetPut)
thirdGroup.POST("/confirm_put", t.ConfirmPut)
}
////Message
chatGroup := r.Group("/msg")
@@ -143,13 +143,36 @@ func NewGinRouter() *gin.Engine {
////Conversation
conversationGroup := r.Group("/conversation")
{ //1
conversationGroup.POST("/get_all_conversations", conversation.GetAllConversations)
conversationGroup.POST("/get_conversation", conversation.GetConversation)
conversationGroup.POST("/get_conversations", conversation.GetConversations)
conversationGroup.POST("/set_conversation", conversation.SetConversation)
conversationGroup.POST("/batch_set_conversation", conversation.BatchSetConversations)
conversationGroup.POST("/set_recv_msg_opt", conversation.SetRecvMsgOpt)
conversationGroup.POST("/modify_conversation_field", conversation.ModifyConversationField)
c := NewConversation(zk)
conversationGroup.POST("/get_all_conversations", c.GetAllConversations)
conversationGroup.POST("/get_conversation", c.GetConversation)
conversationGroup.POST("/get_conversations", c.GetConversations)
conversationGroup.POST("/set_conversation", c.SetConversation)
conversationGroup.POST("/batch_set_conversation", c.BatchSetConversations)
conversationGroup.POST("/set_recv_msg_opt", c.SetRecvMsgOpt)
conversationGroup.POST("/modify_conversation_field", c.ModifyConversationField)
}
return r
}
/*
{
GetSeq
SendMsg
PullMsgBySeqList
DelMsg
DelSuperGroupMsg
ClearMsg
SetMsgMinSeq
SetMessageReactionExtensions
GetMessageListReactionExtensions
AddMessageReactionExtensions
DeleteMessageReactionExtensions
ManagementSendMsg
ManagementBatchSendMsg
CheckMsgIsSendSuccess
}
*/