feat: script and make build

Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
This commit is contained in:
Xinwei Xiong(cubxxw-openim) 2023-07-13 17:37:51 +08:00
parent 6ecf253ef6
commit 99dc701ff6
16 changed files with 142 additions and 160 deletions

View File

@ -47,8 +47,7 @@ type ForceLogoutReq struct {
OperationID string `json:"operationID" binding:"required"` OperationID string `json:"operationID" binding:"required"`
} }
type ForceLogoutResp struct { type ForceLogoutResp struct{}
}
type ParseTokenReq struct { type ParseTokenReq struct {
OperationID string `json:"operationID" binding:"required"` OperationID string `json:"operationID" binding:"required"`

View File

@ -68,16 +68,14 @@ type SetConversationReq struct {
OperationID string `json:"operationID" binding:"required"` OperationID string `json:"operationID" binding:"required"`
} }
type SetConversationResp struct { type SetConversationResp struct{}
}
type ModifyConversationFieldReq struct { type ModifyConversationFieldReq struct {
Conversation Conversation
FieldType int32 `json:"fieldType" binding:"required"` FieldType int32 `json:"fieldType" binding:"required"`
UserIDList []string `json:"userIDList" binding:"required"` UserIDList []string `json:"userIDList" binding:"required"`
OperationID string `json:"operationID" binding:"required"` OperationID string `json:"operationID" binding:"required"`
} }
type ModifyConversationFieldResp struct { type ModifyConversationFieldResp struct{}
}
type BatchSetConversationsReq struct { type BatchSetConversationsReq struct {
Conversations []Conversation `json:"conversations" binding:"required"` Conversations []Conversation `json:"conversations" binding:"required"`
@ -130,5 +128,4 @@ type SetRecvMsgOptReq struct {
NotificationType int32 `json:"notificationType"` NotificationType int32 `json:"notificationType"`
} }
type SetRecvMsgOptResp struct { type SetRecvMsgOptResp struct{}
}

View File

@ -185,8 +185,7 @@ type AddBlacklistReq struct {
ToUserID string `json:"toUserID" binding:"required"` ToUserID string `json:"toUserID" binding:"required"`
FromUserID string `json:"fromUserID" binding:"required"` FromUserID string `json:"fromUserID" binding:"required"`
} }
type AddBlacklistResp struct { type AddBlacklistResp struct{}
}
type ImportFriendReq struct { type ImportFriendReq struct {
FriendUserIDList []string `json:"friendUserIDList" binding:"required"` FriendUserIDList []string `json:"friendUserIDList" binding:"required"`
@ -212,15 +211,13 @@ type AddFriendResponseReq struct {
HandleResult int32 `json:"flag" binding:"required,oneof=-1 0 1"` HandleResult int32 `json:"flag" binding:"required,oneof=-1 0 1"`
HandleMsg string `json:"handleMsg"` HandleMsg string `json:"handleMsg"`
} }
type AddFriendResponseResp struct { type AddFriendResponseResp struct{}
}
type DeleteFriendReq struct { type DeleteFriendReq struct {
ToUserID string `json:"toUserID" binding:"required"` ToUserID string `json:"toUserID" binding:"required"`
FromUserID string `json:"fromUserID" binding:"required"` FromUserID string `json:"fromUserID" binding:"required"`
} }
type DeleteFriendResp struct { type DeleteFriendResp struct{}
}
type GetBlackListReq struct { type GetBlackListReq struct {
FromUserID string `json:"fromUserID" binding:"required"` FromUserID string `json:"fromUserID" binding:"required"`
@ -234,15 +231,13 @@ type SetFriendRemarkReq struct {
FromUserID string `json:"fromUserID" binding:"required"` FromUserID string `json:"fromUserID" binding:"required"`
Remark string `json:"remark"` Remark string `json:"remark"`
} }
type SetFriendRemarkResp struct { type SetFriendRemarkResp struct{}
}
type RemoveBlacklistReq struct { type RemoveBlacklistReq struct {
ToUserID string `json:"toUserID" binding:"required"` ToUserID string `json:"toUserID" binding:"required"`
FromUserID string `json:"fromUserID" binding:"required"` FromUserID string `json:"fromUserID" binding:"required"`
} }
type RemoveBlacklistResp struct { type RemoveBlacklistResp struct{}
}
type IsFriendReq struct { type IsFriendReq struct {
ToUserID string `json:"toUserID" binding:"required"` ToUserID string `json:"toUserID" binding:"required"`

View File

@ -25,7 +25,6 @@ type KickGroupMemberReq struct {
OperationID string `json:"operationID" binding:"required"` OperationID string `json:"operationID" binding:"required"`
} }
type KickGroupMemberResp struct { type KickGroupMemberResp struct {
// UserIDResultList []*UserIDResult `json:"data"` // UserIDResultList []*UserIDResult `json:"data"`
} }
@ -46,7 +45,6 @@ type InviteUserToGroupReq struct {
OperationID string `json:"operationID" binding:"required"` OperationID string `json:"operationID" binding:"required"`
} }
type InviteUserToGroupResp struct { type InviteUserToGroupResp struct {
// UserIDResultList []*UserIDResult `json:"data"` // UserIDResultList []*UserIDResult `json:"data"`
} }
@ -116,6 +114,7 @@ type GetGroupApplicationListReq struct {
OperationID string `json:"operationID" binding:"required"` OperationID string `json:"operationID" binding:"required"`
FromUserID string `json:"fromUserID" binding:"required"` // 作为管理员或群主收到的 进群申请 FromUserID string `json:"fromUserID" binding:"required"` // 作为管理员或群主收到的 进群申请
} }
type GetGroupApplicationListResp struct { type GetGroupApplicationListResp struct {
GroupRequestList []*sdkws.GroupRequest `json:"-"` GroupRequestList []*sdkws.GroupRequest `json:"-"`
Data []map[string]interface{} `json:"data" swaggerignore:"true"` Data []map[string]interface{} `json:"data" swaggerignore:"true"`
@ -167,8 +166,7 @@ type ApplicationGroupResponseReq struct {
HandledMsg string `json:"handledMsg"` HandledMsg string `json:"handledMsg"`
HandleResult int32 `json:"handleResult" binding:"required,oneof=-1 1"` HandleResult int32 `json:"handleResult" binding:"required,oneof=-1 1"`
} }
type ApplicationGroupResponseResp struct { type ApplicationGroupResponseResp struct{}
}
type JoinGroupReq struct { type JoinGroupReq struct {
GroupID string `json:"groupID" binding:"required"` GroupID string `json:"groupID" binding:"required"`
@ -178,15 +176,13 @@ type JoinGroupReq struct {
InviterUserID string `json:"inviterUserID"` InviterUserID string `json:"inviterUserID"`
} }
type JoinGroupResp struct { type JoinGroupResp struct{}
}
type QuitGroupReq struct { type QuitGroupReq struct {
GroupID string `json:"groupID" binding:"required"` GroupID string `json:"groupID" binding:"required"`
OperationID string `json:"operationID" binding:"required"` OperationID string `json:"operationID" binding:"required"`
} }
type QuitGroupResp struct { type QuitGroupResp struct{}
}
type SetGroupInfoReq struct { type SetGroupInfoReq struct {
GroupID string `json:"groupID" binding:"required"` GroupID string `json:"groupID" binding:"required"`
@ -201,8 +197,7 @@ type SetGroupInfoReq struct {
ApplyMemberFriend *int32 `json:"applyMemberFriend"` ApplyMemberFriend *int32 `json:"applyMemberFriend"`
} }
type SetGroupInfoResp struct { type SetGroupInfoResp struct{}
}
type TransferGroupOwnerReq struct { type TransferGroupOwnerReq struct {
GroupID string `json:"groupID" binding:"required"` GroupID string `json:"groupID" binding:"required"`
@ -210,15 +205,13 @@ type TransferGroupOwnerReq struct {
NewOwnerUserID string `json:"newOwnerUserID" binding:"required"` NewOwnerUserID string `json:"newOwnerUserID" binding:"required"`
OperationID string `json:"operationID" binding:"required"` OperationID string `json:"operationID" binding:"required"`
} }
type TransferGroupOwnerResp struct { type TransferGroupOwnerResp struct{}
}
type DismissGroupReq struct { type DismissGroupReq struct {
GroupID string `json:"groupID" binding:"required"` GroupID string `json:"groupID" binding:"required"`
OperationID string `json:"operationID" binding:"required"` OperationID string `json:"operationID" binding:"required"`
} }
type DismissGroupResp struct { type DismissGroupResp struct{}
}
type MuteGroupMemberReq struct { type MuteGroupMemberReq struct {
OperationID string `json:"operationID" binding:"required"` OperationID string `json:"operationID" binding:"required"`
@ -226,30 +219,26 @@ type MuteGroupMemberReq struct {
UserID string `json:"userID" binding:"required"` UserID string `json:"userID" binding:"required"`
MutedSeconds uint32 `json:"mutedSeconds" binding:"required"` MutedSeconds uint32 `json:"mutedSeconds" binding:"required"`
} }
type MuteGroupMemberResp struct { type MuteGroupMemberResp struct{}
}
type CancelMuteGroupMemberReq struct { type CancelMuteGroupMemberReq struct {
OperationID string `json:"operationID" binding:"required"` OperationID string `json:"operationID" binding:"required"`
GroupID string `json:"groupID" binding:"required"` GroupID string `json:"groupID" binding:"required"`
UserID string `json:"userID" binding:"required"` UserID string `json:"userID" binding:"required"`
} }
type CancelMuteGroupMemberResp struct { type CancelMuteGroupMemberResp struct{}
}
type MuteGroupReq struct { type MuteGroupReq struct {
OperationID string `json:"operationID" binding:"required"` OperationID string `json:"operationID" binding:"required"`
GroupID string `json:"groupID" binding:"required"` GroupID string `json:"groupID" binding:"required"`
} }
type MuteGroupResp struct { type MuteGroupResp struct{}
}
type CancelMuteGroupReq struct { type CancelMuteGroupReq struct {
OperationID string `json:"operationID" binding:"required"` OperationID string `json:"operationID" binding:"required"`
GroupID string `json:"groupID" binding:"required"` GroupID string `json:"groupID" binding:"required"`
} }
type CancelMuteGroupResp struct { type CancelMuteGroupResp struct{}
}
type SetGroupMemberNicknameReq struct { type SetGroupMemberNicknameReq struct {
OperationID string `json:"operationID" binding:"required"` OperationID string `json:"operationID" binding:"required"`
@ -258,8 +247,7 @@ type SetGroupMemberNicknameReq struct {
Nickname string `json:"nickname"` Nickname string `json:"nickname"`
} }
type SetGroupMemberNicknameResp struct { type SetGroupMemberNicknameResp struct{}
}
type SetGroupMemberInfoReq struct { type SetGroupMemberInfoReq struct {
OperationID string `json:"operationID" binding:"required"` OperationID string `json:"operationID" binding:"required"`
@ -271,8 +259,7 @@ type SetGroupMemberInfoReq struct {
Ex *string `json:"ex"` Ex *string `json:"ex"`
} }
type SetGroupMemberInfoResp struct { type SetGroupMemberInfoResp struct{}
}
type GetGroupAbstractInfoReq struct { type GetGroupAbstractInfoReq struct {
OperationID string `json:"operationID"` OperationID string `json:"operationID"`

View File

@ -36,15 +36,14 @@ type GetUsersOnlineStatusReq struct {
UserIDList []string `json:"userIDList" binding:"required,lte=200"` UserIDList []string `json:"userIDList" binding:"required,lte=200"`
} }
type GetUsersOnlineStatusResp struct { type GetUsersOnlineStatusResp struct {
// SuccessResult []*msggateway.GetUsersOnlineStatusResp_SuccessResult `json:"data"` // SuccessResult []*msggateway.GetUsersOnlineStatusResp_SuccessResult `json:"data"`
} }
type AccountCheckReq struct { type AccountCheckReq struct {
OperationID string `json:"operationID" binding:"required"` OperationID string `json:"operationID" binding:"required"`
CheckUserIDList []string `json:"checkUserIDList" binding:"required,lte=100"` CheckUserIDList []string `json:"checkUserIDList" binding:"required,lte=100"`
} }
type AccountCheckResp struct { type AccountCheckResp struct{}
}
type ManagementSendMsg struct { type ManagementSendMsg struct {
SendID string `json:"sendID" binding:"required"` SendID string `json:"sendID" binding:"required"`

View File

@ -20,16 +20,14 @@ type DelMsgReq struct {
OperationID string `json:"operationID,omitempty" binding:"required"` OperationID string `json:"operationID,omitempty" binding:"required"`
} }
type DelMsgResp struct { type DelMsgResp struct{}
}
type CleanUpMsgReq struct { type CleanUpMsgReq struct {
UserID string `json:"userID" binding:"required"` UserID string `json:"userID" binding:"required"`
OperationID string `json:"operationID" binding:"required"` OperationID string `json:"operationID" binding:"required"`
} }
type CleanUpMsgResp struct { type CleanUpMsgResp struct{}
}
type DelSuperGroupMsgReq struct { type DelSuperGroupMsgReq struct {
UserID string `json:"userID" binding:"required"` UserID string `json:"userID" binding:"required"`
@ -39,8 +37,7 @@ type DelSuperGroupMsgReq struct {
OperationID string `json:"operationID" binding:"required"` OperationID string `json:"operationID" binding:"required"`
} }
type DelSuperGroupMsgResp struct { type DelSuperGroupMsgResp struct{}
}
type MsgDeleteNotificationElem struct { type MsgDeleteNotificationElem struct {
GroupID string `json:"groupID"` GroupID string `json:"groupID"`
@ -55,8 +52,7 @@ type SetMsgMinSeqReq struct {
OperationID string `json:"operationID" binding:"required"` OperationID string `json:"operationID" binding:"required"`
} }
type SetMsgMinSeqResp struct { type SetMsgMinSeqResp struct{}
}
type PictureBaseInfo struct { type PictureBaseInfo struct {
UUID string `mapstructure:"uuid"` UUID string `mapstructure:"uuid"`

View File

@ -58,8 +58,7 @@ type UploadUpdateAppReq struct {
UpdateLog string `form:"updateLog" binding:"required"` UpdateLog string `form:"updateLog" binding:"required"`
} }
type UploadUpdateAppResp struct { type UploadUpdateAppResp struct{}
}
type GetDownloadURLReq struct { type GetDownloadURLReq struct {
OperationID string `json:"operationID" binding:"required"` OperationID string `json:"operationID" binding:"required"`
@ -111,7 +110,7 @@ type GetRTCInvitationInfoStartAppResp struct {
} }
/** /**
* FCM第三方上报Token * FCM第三方上报Token.
*/ */
type FcmUpdateTokenReq struct { type FcmUpdateTokenReq struct {
OperationID string `json:"operationID" binding:"required"` OperationID string `json:"operationID" binding:"required"`
@ -119,13 +118,11 @@ type FcmUpdateTokenReq struct {
FcmToken string `json:"fcmToken" binding:"required"` FcmToken string `json:"fcmToken" binding:"required"`
} }
type FcmUpdateTokenResp struct { type FcmUpdateTokenResp struct{}
}
type SetAppBadgeReq struct { type SetAppBadgeReq struct {
OperationID string `json:"operationID" binding:"required"` OperationID string `json:"operationID" binding:"required"`
FromUserID string `json:"fromUserID" binding:"required"` FromUserID string `json:"fromUserID" binding:"required"`
AppUnreadCount int32 `json:"appUnreadCount"` AppUnreadCount int32 `json:"appUnreadCount"`
} }
type SetAppBadgeResp struct { type SetAppBadgeResp struct{}
}

View File

@ -17,7 +17,7 @@ package constant
const ( const (
///ContentType ///ContentType
//UserRelated //UserRelated.
ContentTypeBegin = 100 ContentTypeBegin = 100
Text = 101 Text = 101
Picture = 102 Picture = 102
@ -45,7 +45,7 @@ const (
SignalMsg = 202 SignalMsg = 202
CustomNotification = 203 CustomNotification = 203
//SysRelated //SysRelated.
NotificationBegin = 1000 NotificationBegin = 1000
FriendApplicationApprovedNotification = 1201 // add_friend_response FriendApplicationApprovedNotification = 1201 // add_friend_response
@ -113,37 +113,37 @@ const (
NotificationEnd = 5000 NotificationEnd = 5000
//status //status.
MsgNormal = 1 MsgNormal = 1
MsgDeleted = 4 MsgDeleted = 4
//MsgFrom //MsgFrom.
UserMsgType = 100 UserMsgType = 100
SysMsgType = 200 SysMsgType = 200
//SessionType //SessionType.
SingleChatType = 1 SingleChatType = 1
GroupChatType = 2 GroupChatType = 2
SuperGroupChatType = 3 SuperGroupChatType = 3
NotificationChatType = 4 NotificationChatType = 4
//token //token.
NormalToken = 0 NormalToken = 0
InValidToken = 1 InValidToken = 1
KickedToken = 2 KickedToken = 2
ExpiredToken = 3 ExpiredToken = 3
//MultiTerminalLogin //MultiTerminalLogin.
DefalutNotKick = 0 DefalutNotKick = 0
//Full-end login, but the same end is mutually exclusive //Full-end login, but the same end is mutually exclusive.
AllLoginButSameTermKick = 1 AllLoginButSameTermKick = 1
//Only one of the endpoints can log in //Only one of the endpoints can log in.
SingleTerminalLogin = 2 SingleTerminalLogin = 2
//The web side can be online at the same time, and the other side can only log in at one end //The web side can be online at the same time, and the other side can only log in at one end.
WebAndOther = 3 WebAndOther = 3
// The PC side is mutually exclusive, and the mobile side is mutually exclusive, but the web side can be online at // The PC side is mutually exclusive, and the mobile side is mutually exclusive, but the web side can be online at
// the same time // the same time.
PcMobileAndWeb = 4 PcMobileAndWeb = 4
//The PC terminal can be online at the same time,but other terminal only one of the endpoints can login //The PC terminal can be online at the same time,but other terminal only one of the endpoints can login.
PCAndOther = 5 PCAndOther = 5
OnlineStatus = "online" OnlineStatus = "online"
@ -151,12 +151,12 @@ const (
Registered = "registered" Registered = "registered"
UnRegistered = "unregistered" UnRegistered = "unregistered"
//MsgReceiveOpt //MsgReceiveOpt.
ReceiveMessage = 0 ReceiveMessage = 0
NotReceiveMessage = 1 NotReceiveMessage = 1
ReceiveNotNotifyMessage = 2 ReceiveNotNotifyMessage = 2
//OptionsKey //OptionsKey.
IsHistory = "history" IsHistory = "history"
IsPersistent = "persistent" IsPersistent = "persistent"
IsOfflinePush = "offlinePush" IsOfflinePush = "offlinePush"
@ -170,13 +170,13 @@ const (
IsNotNotification = "isNotNotification" IsNotNotification = "isNotNotification"
IsSendMsg = "isSendMsg" IsSendMsg = "isSendMsg"
//GroupStatus //GroupStatus.
GroupOk = 0 GroupOk = 0
GroupBanChat = 1 GroupBanChat = 1
GroupStatusDismissed = 2 GroupStatusDismissed = 2
GroupStatusMuted = 3 GroupStatusMuted = 3
//GroupType //GroupType.
NormalGroup = 0 NormalGroup = 0
SuperGroup = 1 SuperGroup = 1
WorkingGroup = 2 WorkingGroup = 2
@ -184,19 +184,19 @@ const (
GroupBaned = 3 GroupBaned = 3
GroupBanPrivateChat = 4 GroupBanPrivateChat = 4
//UserJoinGroupSource //UserJoinGroupSource.
JoinByAdmin = 1 JoinByAdmin = 1
JoinByInvitation = 2 JoinByInvitation = 2
JoinBySearch = 3 JoinBySearch = 3
JoinByQRCode = 4 JoinByQRCode = 4
//Minio //Minio.
MinioDurationTimes = 3600 MinioDurationTimes = 3600
//Aws //Aws.
AwsDurationTimes = 3600 AwsDurationTimes = 3600
//callbackCommand //callbackCommand.
CallbackBeforeSendSingleMsgCommand = "callbackBeforeSendSingleMsgCommand" CallbackBeforeSendSingleMsgCommand = "callbackBeforeSendSingleMsgCommand"
CallbackAfterSendSingleMsgCommand = "callbackAfterSendSingleMsgCommand" CallbackAfterSendSingleMsgCommand = "callbackAfterSendSingleMsgCommand"
CallbackBeforeSendGroupMsgCommand = "callbackBeforeSendGroupMsgCommand" CallbackBeforeSendGroupMsgCommand = "callbackBeforeSendGroupMsgCommand"
@ -217,19 +217,19 @@ const (
CallbackGetMessageListReactionExtensionsCommand = "callbackGetMessageListReactionExtensionsCommand" CallbackGetMessageListReactionExtensionsCommand = "callbackGetMessageListReactionExtensionsCommand"
CallbackAddMessageListReactionExtensionsCommand = "callbackAddMessageListReactionExtensionsCommand" CallbackAddMessageListReactionExtensionsCommand = "callbackAddMessageListReactionExtensionsCommand"
//callback actionCode //callback actionCode.
ActionAllow = 0 ActionAllow = 0
ActionForbidden = 1 ActionForbidden = 1
//callback callbackHandleCode //callback callbackHandleCode.
CallbackHandleSuccess = 0 CallbackHandleSuccess = 0
CallbackHandleFailed = 1 CallbackHandleFailed = 1
// minioUpload // minioUpload.
OtherType = 1 OtherType = 1
VideoType = 2 VideoType = 2
ImageType = 3 ImageType = 3
// sendMsgStaus // sendMsgStaus.
MsgStatusNotExist = 0 MsgStatusNotExist = 0
MsgIsSending = 1 MsgIsSending = 1
MsgSendSuccessed = 2 MsgSendSuccessed = 2
@ -299,15 +299,17 @@ const (
Female = 2 Female = 2
) )
const OperationID = "operationID" const (
const OpUserID = "opUserID" OperationID = "operationID"
const ConnID = "connID" OpUserID = "opUserID"
const OpUserPlatform = "platform" ConnID = "connID"
const Token = "token" OpUserPlatform = "platform"
const RpcCustomHeader = "customHeader" // rpc中间件自定义ctx参数 Token = "token"
const CheckKey = "CheckKey" RpcCustomHeader = "customHeader" // rpc中间件自定义ctx参数
const TriggerID = "triggerID" CheckKey = "CheckKey"
const RemoteAddr = "remoteAddr" TriggerID = "triggerID"
RemoteAddr = "remoteAddr"
)
const ( const (
BecomeFriendByImport = 1 // 管理员导入 BecomeFriendByImport = 1 // 管理员导入
@ -345,7 +347,7 @@ const LogFileName = "OpenIM.log"
const LocalHost = "0.0.0.0" const LocalHost = "0.0.0.0"
// flag parse // flag parse.
const ( const (
FlagPort = "port" FlagPort = "port"
FlagWsPort = "ws_port" FlagWsPort = "ws_port"

View File

@ -16,9 +16,8 @@ package constant
// fixme 1<--->IOS 2<--->Android 3<--->Windows // fixme 1<--->IOS 2<--->Android 3<--->Windows
// fixme 4<--->OSX 5<--->Web 6<--->MiniWeb 7<--->Linux // fixme 4<--->OSX 5<--->Web 6<--->MiniWeb 7<--->Linux
const ( const (
//Platform ID //Platform ID.
IOSPlatformID = 1 IOSPlatformID = 1
AndroidPlatformID = 2 AndroidPlatformID = 2
WindowsPlatformID = 3 WindowsPlatformID = 3
@ -30,7 +29,7 @@ const (
IPadPlatformID = 9 IPadPlatformID = 9
AdminPlatformID = 10 AdminPlatformID = 10
//Platform string match to Platform ID //Platform string match to Platform ID.
IOSPlatformStr = "IOS" IOSPlatformStr = "IOS"
AndroidPlatformStr = "Android" AndroidPlatformStr = "Android"
WindowsPlatformStr = "Windows" WindowsPlatformStr = "Windows"
@ -42,7 +41,7 @@ const (
IPadPlatformStr = "IPad" IPadPlatformStr = "IPad"
AdminPlatformStr = "Admin" AdminPlatformStr = "Admin"
//terminal types //terminal types.
TerminalPC = "PC" TerminalPC = "PC"
TerminalMobile = "Mobile" TerminalMobile = "Mobile"
) )
@ -59,6 +58,7 @@ var PlatformID2Name = map[int]string{
IPadPlatformID: IPadPlatformStr, IPadPlatformID: IPadPlatformStr,
AdminPlatformID: AdminPlatformStr, AdminPlatformID: AdminPlatformStr,
} }
var PlatformName2ID = map[string]int{ var PlatformName2ID = map[string]int{
IOSPlatformStr: IOSPlatformID, IOSPlatformStr: IOSPlatformID,
AndroidPlatformStr: AndroidPlatformID, AndroidPlatformStr: AndroidPlatformID,
@ -71,6 +71,7 @@ var PlatformName2ID = map[string]int{
IPadPlatformStr: IPadPlatformID, IPadPlatformStr: IPadPlatformID,
AdminPlatformStr: AdminPlatformID, AdminPlatformStr: AdminPlatformID,
} }
var PlatformName2class = map[string]string{ var PlatformName2class = map[string]string{
IOSPlatformStr: TerminalMobile, IOSPlatformStr: TerminalMobile,
AndroidPlatformStr: TerminalMobile, AndroidPlatformStr: TerminalMobile,
@ -80,6 +81,7 @@ var PlatformName2class = map[string]string{
OSXPlatformStr: TerminalPC, OSXPlatformStr: TerminalPC,
LinuxPlatformStr: TerminalPC, LinuxPlatformStr: TerminalPC,
} }
var PlatformID2class = map[int]string{ var PlatformID2class = map[int]string{
IOSPlatformID: TerminalMobile, IOSPlatformID: TerminalMobile,
AndroidPlatformID: TerminalMobile, AndroidPlatformID: TerminalMobile,
@ -93,12 +95,15 @@ var PlatformID2class = map[int]string{
func PlatformIDToName(num int) string { func PlatformIDToName(num int) string {
return PlatformID2Name[num] return PlatformID2Name[num]
} }
func PlatformNameToID(name string) int { func PlatformNameToID(name string) int {
return PlatformName2ID[name] return PlatformName2ID[name]
} }
func PlatformNameToClass(name string) string { func PlatformNameToClass(name string) string {
return PlatformName2class[name] return PlatformName2class[name]
} }
func PlatformIDToClass(num int) string { func PlatformIDToClass(num int) string {
return PlatformID2class[num] return PlatformID2class[num]
} }

View File

@ -26,12 +26,15 @@ var mapper = []string{constant.OperationID, constant.OpUserID, constant.OpUserPl
func WithOpUserIDContext(ctx context.Context, opUserID string) context.Context { func WithOpUserIDContext(ctx context.Context, opUserID string) context.Context {
return context.WithValue(ctx, constant.OpUserID, opUserID) return context.WithValue(ctx, constant.OpUserID, opUserID)
} }
func WithOpUserPlatformContext(ctx context.Context, platform string) context.Context { func WithOpUserPlatformContext(ctx context.Context, platform string) context.Context {
return context.WithValue(ctx, constant.OpUserPlatform, platform) return context.WithValue(ctx, constant.OpUserPlatform, platform)
} }
func WithTriggerIDContext(ctx context.Context, triggerID string) context.Context { func WithTriggerIDContext(ctx context.Context, triggerID string) context.Context {
return context.WithValue(ctx, constant.TriggerID, triggerID) return context.WithValue(ctx, constant.TriggerID, triggerID)
} }
func NewCtx(operationID string) context.Context { func NewCtx(operationID string) context.Context {
c := context.Background() c := context.Background()
ctx := context.WithValue(c, constant.OperationID, operationID) ctx := context.WithValue(c, constant.OperationID, operationID)
@ -59,6 +62,7 @@ func GetOperationID(ctx context.Context) string {
} }
return "" return ""
} }
func GetOpUserID(ctx context.Context) string { func GetOpUserID(ctx context.Context) string {
if ctx.Value(constant.OpUserID) != "" { if ctx.Value(constant.OpUserID) != "" {
s, ok := ctx.Value(constant.OpUserID).(string) s, ok := ctx.Value(constant.OpUserID).(string)
@ -68,6 +72,7 @@ func GetOpUserID(ctx context.Context) string {
} }
return "" return ""
} }
func GetConnID(ctx context.Context) string { func GetConnID(ctx context.Context) string {
if ctx.Value(constant.ConnID) != "" { if ctx.Value(constant.ConnID) != "" {
s, ok := ctx.Value(constant.ConnID).(string) s, ok := ctx.Value(constant.ConnID).(string)
@ -87,6 +92,7 @@ func GetTriggerID(ctx context.Context) string {
} }
return "" return ""
} }
func GetOpUserPlatform(ctx context.Context) string { func GetOpUserPlatform(ctx context.Context) string {
if ctx.Value(constant.OpUserPlatform) != "" { if ctx.Value(constant.OpUserPlatform) != "" {
s, ok := ctx.Value(constant.OpUserPlatform).(string) s, ok := ctx.Value(constant.OpUserPlatform).(string)
@ -96,6 +102,7 @@ func GetOpUserPlatform(ctx context.Context) string {
} }
return "" return ""
} }
func GetRemoteAddr(ctx context.Context) string { func GetRemoteAddr(ctx context.Context) string {
if ctx.Value(constant.RemoteAddr) != "" { if ctx.Value(constant.RemoteAddr) != "" {
s, ok := ctx.Value(constant.RemoteAddr).(string) s, ok := ctx.Value(constant.RemoteAddr).(string)
@ -142,8 +149,6 @@ func WithMustInfoCtx(values []string) context.Context {
ctx := context.Background() ctx := context.Background()
for i, v := range values { for i, v := range values {
ctx = context.WithValue(ctx, mapper[i], v) ctx = context.WithValue(ctx, mapper[i], v)
} }
return ctx return ctx
} }

View File

@ -14,7 +14,7 @@
package errs package errs
// UnknownCode 没有解析到code或解析的code=0 // UnknownCode 没有解析到code或解析的code=0.
const UnknownCode = 1000 const UnknownCode = 1000
const ( const (
@ -34,7 +34,7 @@ const (
InvitationError = 10014 InvitationError = 10014
) )
// 通用错误码 // 通用错误码.
const ( const (
NoError = 0 // 无错误 NoError = 0 // 无错误
DatabaseError = 90002 // redis/mysql等db错误 DatabaseError = 90002 // redis/mysql等db错误
@ -43,18 +43,18 @@ const (
CallbackError = 80000 CallbackError = 80000
//通用错误码 //通用错误码.
ServerInternalError = 500 //服务器内部错误 ServerInternalError = 500 //服务器内部错误
ArgsError = 1001 //输入参数错误 ArgsError = 1001 //输入参数错误
NoPermissionError = 1002 //权限不足 NoPermissionError = 1002 //权限不足
DuplicateKeyError = 1003 DuplicateKeyError = 1003
RecordNotFoundError = 1004 // 记录不存在 RecordNotFoundError = 1004 // 记录不存在
// 账号错误码 // 账号错误码.
UserIDNotFoundError = 1101 // UserID不存在 或未注册 UserIDNotFoundError = 1101 // UserID不存在 或未注册
RegisteredAlreadyError = 1102 // 用户已经注册过了 RegisteredAlreadyError = 1102 // 用户已经注册过了
// 群组错误码 // 群组错误码.
GroupIDNotFoundError = 1201 // GroupID不存在 GroupIDNotFoundError = 1201 // GroupID不存在
GroupIDExisted = 1202 // GroupID已存在 GroupIDExisted = 1202 // GroupID已存在
NotInGroupYetError = 1203 // 不在群组中 NotInGroupYetError = 1203 // 不在群组中
@ -62,19 +62,19 @@ const (
GroupTypeNotSupport = 1205 GroupTypeNotSupport = 1205
GroupRequestHandled = 1206 GroupRequestHandled = 1206
// 关系链错误码 // 关系链错误码.
CanNotAddYourselfError = 1301 // 不能添加自己为好友 CanNotAddYourselfError = 1301 // 不能添加自己为好友
BlockedByPeer = 1302 // 被对方拉黑 BlockedByPeer = 1302 // 被对方拉黑
NotPeersFriend = 1303 // 不是对方的好友 NotPeersFriend = 1303 // 不是对方的好友
RelationshipAlreadyError = 1304 // 已经是好友关系 RelationshipAlreadyError = 1304 // 已经是好友关系
// 消息错误码 // 消息错误码.
MessageHasReadDisable = 1401 MessageHasReadDisable = 1401
MutedInGroup = 1402 // 群成员被禁言 MutedInGroup = 1402 // 群成员被禁言
MutedGroup = 1403 // 群被禁言 MutedGroup = 1403 // 群被禁言
MsgAlreadyRevoke = 1404 // 消息已撤回 MsgAlreadyRevoke = 1404 // 消息已撤回
// token错误码 // token错误码.
TokenExpiredError = 1501 TokenExpiredError = 1501
TokenInvalidError = 1502 TokenInvalidError = 1502
TokenMalformedError = 1503 TokenMalformedError = 1503
@ -83,10 +83,10 @@ const (
TokenKickedError = 1506 TokenKickedError = 1506
TokenNotExistError = 1507 TokenNotExistError = 1507
// 长连接网关错误码 // 长连接网关错误码.
ConnOverMaxNumLimit = 1601 ConnOverMaxNumLimit = 1601
ConnArgsErr = 1602 ConnArgsErr = 1602
// S3错误码 // S3错误码.
FileUploadedExpiredError = 1701 // 上传过期 FileUploadedExpiredError = 1701 // 上传过期
) )

View File

@ -61,7 +61,7 @@ sleep 1
cd ${msg_gateway_binary_root} cd ${msg_gateway_binary_root}
for ((i = 0; i < ${#ws_ports[@]}; i++)); do for ((i = 0; i < ${#ws_ports[@]}; i++)); do
echo "==========================start msg_gateway server===========================">>$OPENIM_ROOT/logs/openIM.log echo "==========================start msg_gateway server===========================">>$OPENIM_ROOT/logs/openIM.log
nohup ./${openim_msggateway} --port ${rpc_ports[$i]} --ws_port ${ws_ports[$i]} --prometheus_port ${prome_ports[$i]} --config_folder_path ${configfile_path} --configFolderPath ${log_path} >>$OPENIM_ROOT/logs/openIM.log 2>&1 & nohup ./${openim_msggateway} --port ${rpc_ports[$i]} --ws_port ${ws_ports[$i]} --prometheus_port ${prome_ports[$i]} --config_folder_path ${configfile_path} >>$OPENIM_ROOT/logs/openIM.log 2>&1 &
done done
#Check launched service process #Check launched service process

View File

@ -55,9 +55,9 @@ sleep 1
cd ${msg_transfer_binary_root} cd ${msg_transfer_binary_root}
for ((i = 0; i < ${msg_transfer_service_num}; i++)); do for ((i = 0; i < ${msg_transfer_service_num}; i++)); do
prome_port=${prome_ports[$i]} prome_port=${prome_ports[$i]}
cmd="nohup ./${openim_msgtransfer} --config_folder_path ${configfile_path} --configFolderPath ${log_path}" cmd="nohup ./${openim_msgtransfer} --config_folder_path ${configfile_path} "
if [ $prome_port != "" ]; then if [ $prome_port != "" ]; then
cmd="$cmd --prometheus_port $prome_port --config_folder_path ${configfile_path} --configFolderPath ${log_path}" cmd="$cmd --prometheus_port $prome_port --config_folder_path ${configfile_path} "
fi fi
echo "==========================start msg_transfer server===========================">>$OPENIM_ROOT/logs/openIM.log echo "==========================start msg_transfer server===========================">>$OPENIM_ROOT/logs/openIM.log
$cmd >>$OPENIM_ROOT/logs/openIM.log 2>&1 & $cmd >>$OPENIM_ROOT/logs/openIM.log 2>&1 &

View File

@ -100,9 +100,9 @@ for ((i = 0; i < ${#service_filename[*]}; i++)); do
for ((j = 0; j < ${#service_ports[*]}; j++)); do for ((j = 0; j < ${#service_ports[*]}; j++)); do
#Start the service in the background #Start the service in the background
if [ -z "${prome_ports[$j]}" ]; then if [ -z "${prome_ports[$j]}" ]; then
cmd="./${service_filename[$i]} --port ${service_ports[$j]} --config_folder_path ${configfile_path} --configFolderPath ${log_path}" cmd="./${service_filename[$i]} --port ${service_ports[$j]} --config_folder_path ${configfile_path} "
else else
cmd="./${service_filename[$i]} --port ${service_ports[$j]} --prometheus_port ${prome_ports[$j]} --config_folder_path ${configfile_path} --configFolderPath ${log_path}" cmd="./${service_filename[$i]} --port ${service_ports[$j]} --prometheus_port ${prome_ports[$j]} --config_folder_path ${configfile_path} "
fi fi
if [ $i -eq 0 -o $i -eq 1 ]; then if [ $i -eq 0 -o $i -eq 1 ]; then
cmd="./${service_filename[$i]} --port ${service_ports[$j]}" cmd="./${service_filename[$i]} --port ${service_ports[$j]}"