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"`
}
type ForceLogoutResp struct {
}
type ForceLogoutResp struct{}
type ParseTokenReq struct {
OperationID string `json:"operationID" binding:"required"`

View File

@ -68,16 +68,14 @@ type SetConversationReq struct {
OperationID string `json:"operationID" binding:"required"`
}
type SetConversationResp struct {
}
type SetConversationResp struct{}
type ModifyConversationFieldReq struct {
Conversation
FieldType int32 `json:"fieldType" binding:"required"`
UserIDList []string `json:"userIDList" binding:"required"`
OperationID string `json:"operationID" binding:"required"`
}
type ModifyConversationFieldResp struct {
}
type ModifyConversationFieldResp struct{}
type BatchSetConversationsReq struct {
Conversations []Conversation `json:"conversations" binding:"required"`
@ -130,5 +128,4 @@ type SetRecvMsgOptReq struct {
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"`
FromUserID string `json:"fromUserID" binding:"required"`
}
type AddBlacklistResp struct {
}
type AddBlacklistResp struct{}
type ImportFriendReq struct {
FriendUserIDList []string `json:"friendUserIDList" binding:"required"`
@ -212,15 +211,13 @@ type AddFriendResponseReq struct {
HandleResult int32 `json:"flag" binding:"required,oneof=-1 0 1"`
HandleMsg string `json:"handleMsg"`
}
type AddFriendResponseResp struct {
}
type AddFriendResponseResp struct{}
type DeleteFriendReq struct {
ToUserID string `json:"toUserID" binding:"required"`
FromUserID string `json:"fromUserID" binding:"required"`
}
type DeleteFriendResp struct {
}
type DeleteFriendResp struct{}
type GetBlackListReq struct {
FromUserID string `json:"fromUserID" binding:"required"`
@ -234,15 +231,13 @@ type SetFriendRemarkReq struct {
FromUserID string `json:"fromUserID" binding:"required"`
Remark string `json:"remark"`
}
type SetFriendRemarkResp struct {
}
type SetFriendRemarkResp struct{}
type RemoveBlacklistReq struct {
ToUserID string `json:"toUserID" binding:"required"`
FromUserID string `json:"fromUserID" binding:"required"`
}
type RemoveBlacklistResp struct {
}
type RemoveBlacklistResp struct{}
type IsFriendReq struct {
ToUserID string `json:"toUserID" binding:"required"`

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -16,9 +16,8 @@ package constant
// fixme 1<--->IOS 2<--->Android 3<--->Windows
// fixme 4<--->OSX 5<--->Web 6<--->MiniWeb 7<--->Linux
const (
//Platform ID
//Platform ID.
IOSPlatformID = 1
AndroidPlatformID = 2
WindowsPlatformID = 3
@ -30,7 +29,7 @@ const (
IPadPlatformID = 9
AdminPlatformID = 10
//Platform string match to Platform ID
//Platform string match to Platform ID.
IOSPlatformStr = "IOS"
AndroidPlatformStr = "Android"
WindowsPlatformStr = "Windows"
@ -42,7 +41,7 @@ const (
IPadPlatformStr = "IPad"
AdminPlatformStr = "Admin"
//terminal types
//terminal types.
TerminalPC = "PC"
TerminalMobile = "Mobile"
)
@ -59,6 +58,7 @@ var PlatformID2Name = map[int]string{
IPadPlatformID: IPadPlatformStr,
AdminPlatformID: AdminPlatformStr,
}
var PlatformName2ID = map[string]int{
IOSPlatformStr: IOSPlatformID,
AndroidPlatformStr: AndroidPlatformID,
@ -71,6 +71,7 @@ var PlatformName2ID = map[string]int{
IPadPlatformStr: IPadPlatformID,
AdminPlatformStr: AdminPlatformID,
}
var PlatformName2class = map[string]string{
IOSPlatformStr: TerminalMobile,
AndroidPlatformStr: TerminalMobile,
@ -80,6 +81,7 @@ var PlatformName2class = map[string]string{
OSXPlatformStr: TerminalPC,
LinuxPlatformStr: TerminalPC,
}
var PlatformID2class = map[int]string{
IOSPlatformID: TerminalMobile,
AndroidPlatformID: TerminalMobile,
@ -93,12 +95,15 @@ var PlatformID2class = map[int]string{
func PlatformIDToName(num int) string {
return PlatformID2Name[num]
}
func PlatformNameToID(name string) int {
return PlatformName2ID[name]
}
func PlatformNameToClass(name string) string {
return PlatformName2class[name]
}
func PlatformIDToClass(num int) string {
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 {
return context.WithValue(ctx, constant.OpUserID, opUserID)
}
func WithOpUserPlatformContext(ctx context.Context, platform string) context.Context {
return context.WithValue(ctx, constant.OpUserPlatform, platform)
}
func WithTriggerIDContext(ctx context.Context, triggerID string) context.Context {
return context.WithValue(ctx, constant.TriggerID, triggerID)
}
func NewCtx(operationID string) context.Context {
c := context.Background()
ctx := context.WithValue(c, constant.OperationID, operationID)
@ -59,6 +62,7 @@ func GetOperationID(ctx context.Context) string {
}
return ""
}
func GetOpUserID(ctx context.Context) string {
if ctx.Value(constant.OpUserID) != "" {
s, ok := ctx.Value(constant.OpUserID).(string)
@ -68,6 +72,7 @@ func GetOpUserID(ctx context.Context) string {
}
return ""
}
func GetConnID(ctx context.Context) string {
if ctx.Value(constant.ConnID) != "" {
s, ok := ctx.Value(constant.ConnID).(string)
@ -87,6 +92,7 @@ func GetTriggerID(ctx context.Context) string {
}
return ""
}
func GetOpUserPlatform(ctx context.Context) string {
if ctx.Value(constant.OpUserPlatform) != "" {
s, ok := ctx.Value(constant.OpUserPlatform).(string)
@ -96,6 +102,7 @@ func GetOpUserPlatform(ctx context.Context) string {
}
return ""
}
func GetRemoteAddr(ctx context.Context) string {
if ctx.Value(constant.RemoteAddr) != "" {
s, ok := ctx.Value(constant.RemoteAddr).(string)
@ -142,8 +149,6 @@ func WithMustInfoCtx(values []string) context.Context {
ctx := context.Background()
for i, v := range values {
ctx = context.WithValue(ctx, mapper[i], v)
}
return ctx
}

View File

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

View File

@ -61,7 +61,7 @@ sleep 1
cd ${msg_gateway_binary_root}
for ((i = 0; i < ${#ws_ports[@]}; i++)); do
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
#Check launched service process

View File

@ -55,9 +55,9 @@ sleep 1
cd ${msg_transfer_binary_root}
for ((i = 0; i < ${msg_transfer_service_num}; i++)); do
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
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
echo "==========================start msg_transfer server===========================">>$OPENIM_ROOT/logs/openIM.log
$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
#Start the service in the background
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
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
if [ $i -eq 0 -o $i -eq 1 ]; then
cmd="./${service_filename[$i]} --port ${service_ports[$j]}"