diff --git a/cmd/open_im_api/Makefile b/cmd/api/Makefile similarity index 100% rename from cmd/open_im_api/Makefile rename to cmd/api/Makefile diff --git a/cmd/open_im_api/docs/docs.go b/cmd/api/docs/docs.go similarity index 99% rename from cmd/open_im_api/docs/docs.go rename to cmd/api/docs/docs.go index 8b711dfe1..346f3f771 100644 --- a/cmd/open_im_api/docs/docs.go +++ b/cmd/api/docs/docs.go @@ -496,7 +496,7 @@ const docTemplate = `{ "data": { "type": "array", "items": { - "$ref": "#/definitions/server_api_params.PublicUserInfo" + "$ref": "#/definitions/sdkws.PublicUserInfo" } } } @@ -565,7 +565,7 @@ const docTemplate = `{ "data": { "type": "array", "items": { - "$ref": "#/definitions/server_api_params.FriendRequest" + "$ref": "#/definitions/sdkws.FriendRequest" } } } @@ -634,7 +634,7 @@ const docTemplate = `{ "data": { "type": "array", "items": { - "$ref": "#/definitions/server_api_params.FriendInfo" + "$ref": "#/definitions/sdkws.FriendInfo" } } } @@ -703,7 +703,7 @@ const docTemplate = `{ "data": { "type": "array", "items": { - "$ref": "#/definitions/server_api_params.FriendRequest" + "$ref": "#/definitions/sdkws.FriendRequest" } } } @@ -1094,7 +1094,7 @@ const docTemplate = `{ "type": "object", "properties": { "data": { - "$ref": "#/definitions/server_api_params.GroupInfo" + "$ref": "#/definitions/sdkws.GroupInfo" } } } @@ -1216,7 +1216,7 @@ const docTemplate = `{ "data": { "type": "array", "items": { - "$ref": "#/definitions/server_api_params.GroupMemberFullInfo" + "$ref": "#/definitions/sdkws.GroupMemberFullInfo" } } } @@ -1285,7 +1285,7 @@ const docTemplate = `{ "data": { "type": "array", "items": { - "$ref": "#/definitions/server_api_params.GroupMemberFullInfo" + "$ref": "#/definitions/sdkws.GroupMemberFullInfo" } } } @@ -1408,7 +1408,7 @@ const docTemplate = `{ "data": { "type": "array", "items": { - "$ref": "#/definitions/server_api_params.GroupInfo" + "$ref": "#/definitions/sdkws.GroupInfo" } } } @@ -1477,7 +1477,7 @@ const docTemplate = `{ "data": { "type": "array", "items": { - "$ref": "#/definitions/server_api_params.GroupRequest" + "$ref": "#/definitions/sdkws.GroupRequest" } } } @@ -1546,7 +1546,7 @@ const docTemplate = `{ "data": { "type": "array", "items": { - "$ref": "#/definitions/server_api_params.GroupRequest" + "$ref": "#/definitions/sdkws.GroupRequest" } } } @@ -3428,7 +3428,7 @@ const docTemplate = `{ "type": "object", "properties": { "data": { - "$ref": "#/definitions/server_api_params.Department" + "$ref": "#/definitions/sdkws.Department" } } } @@ -3766,7 +3766,7 @@ const docTemplate = `{ "data": { "type": "array", "items": { - "$ref": "#/definitions/server_api_params.UserDepartmentMember" + "$ref": "#/definitions/sdkws.UserDepartmentMember" } } } @@ -3835,7 +3835,7 @@ const docTemplate = `{ "data": { "type": "array", "items": { - "$ref": "#/definitions/server_api_params.Department" + "$ref": "#/definitions/sdkws.Department" } } } @@ -3902,7 +3902,7 @@ const docTemplate = `{ "type": "object", "properties": { "data": { - "$ref": "#/definitions/server_api_params.UserInDepartment" + "$ref": "#/definitions/sdkws.UserInDepartment" } } } @@ -4304,7 +4304,7 @@ const docTemplate = `{ "type": "object", "properties": { "data": { - "$ref": "#/definitions/server_api_params.UserInfo" + "$ref": "#/definitions/sdkws.UserInfo" } } } @@ -4372,7 +4372,7 @@ const docTemplate = `{ "Data": { "type": "array", "items": { - "$ref": "#/definitions/server_api_params.PublicUserInfo" + "$ref": "#/definitions/sdkws.PublicUserInfo" } } } @@ -6770,7 +6770,7 @@ const docTemplate = `{ "type": "boolean" }, "offlinePushInfo": { - "$ref": "#/definitions/server_api_params.OfflinePushInfo" + "$ref": "#/definitions/sdkws.OfflinePushInfo" }, "operationID": { "type": "string" @@ -6823,7 +6823,7 @@ const docTemplate = `{ "type": "boolean" }, "offlinePushInfo": { - "$ref": "#/definitions/server_api_params.OfflinePushInfo" + "$ref": "#/definitions/sdkws.OfflinePushInfo" }, "operationID": { "type": "string" @@ -6852,7 +6852,7 @@ const docTemplate = `{ "type": "object", "properties": { "data": { - "$ref": "#/definitions/server_api_params.UserSendMsgResp" + "$ref": "#/definitions/sdkws.UserSendMsgResp" }, "errCode": { "type": "integer" @@ -8110,7 +8110,7 @@ const docTemplate = `{ } } }, - "server_api_params.Department": { + "sdkws.Department": { "type": "object", "properties": { "createTime": { @@ -8145,7 +8145,7 @@ const docTemplate = `{ } } }, - "server_api_params.DepartmentMember": { + "sdkws.DepartmentMember": { "type": "object", "properties": { "departmentID": { @@ -8171,7 +8171,7 @@ const docTemplate = `{ } } }, - "server_api_params.FriendInfo": { + "sdkws.FriendInfo": { "type": "object", "properties": { "addSource": { @@ -8184,7 +8184,7 @@ const docTemplate = `{ "type": "string" }, "friendUser": { - "$ref": "#/definitions/server_api_params.UserInfo" + "$ref": "#/definitions/sdkws.UserInfo" }, "operatorUserID": { "type": "string" @@ -8197,7 +8197,7 @@ const docTemplate = `{ } } }, - "server_api_params.FriendRequest": { + "sdkws.FriendRequest": { "type": "object", "properties": { "createTime": { @@ -8247,7 +8247,7 @@ const docTemplate = `{ } } }, - "server_api_params.GroupInfo": { + "sdkws.GroupInfo": { "type": "object", "properties": { "applyMemberFriend": { @@ -8303,7 +8303,7 @@ const docTemplate = `{ } } }, - "server_api_params.GroupMemberFullInfo": { + "sdkws.GroupMemberFullInfo": { "type": "object", "properties": { "appMangerLevel": { @@ -8344,14 +8344,14 @@ const docTemplate = `{ } } }, - "server_api_params.GroupRequest": { + "sdkws.GroupRequest": { "type": "object", "properties": { "ex": { "type": "string" }, "groupInfo": { - "$ref": "#/definitions/server_api_params.GroupInfo" + "$ref": "#/definitions/sdkws.GroupInfo" }, "handleMsg": { "type": "string" @@ -8378,11 +8378,11 @@ const docTemplate = `{ "type": "integer" }, "userInfo": { - "$ref": "#/definitions/server_api_params.PublicUserInfo" + "$ref": "#/definitions/sdkws.PublicUserInfo" } } }, - "server_api_params.OfflinePushInfo": { + "sdkws.OfflinePushInfo": { "type": "object", "properties": { "desc": { @@ -8402,7 +8402,7 @@ const docTemplate = `{ } } }, - "server_api_params.OrganizationUser": { + "sdkws.OrganizationUser": { "type": "object", "properties": { "birth": { @@ -8440,7 +8440,7 @@ const docTemplate = `{ } } }, - "server_api_params.PublicUserInfo": { + "sdkws.PublicUserInfo": { "type": "object", "properties": { "ex": { @@ -8460,32 +8460,32 @@ const docTemplate = `{ } } }, - "server_api_params.UserDepartmentMember": { + "sdkws.UserDepartmentMember": { "type": "object", "properties": { "departmentMember": { - "$ref": "#/definitions/server_api_params.DepartmentMember" + "$ref": "#/definitions/sdkws.DepartmentMember" }, "organizationUser": { - "$ref": "#/definitions/server_api_params.OrganizationUser" + "$ref": "#/definitions/sdkws.OrganizationUser" } } }, - "server_api_params.UserInDepartment": { + "sdkws.UserInDepartment": { "type": "object", "properties": { "departmentMemberList": { "type": "array", "items": { - "$ref": "#/definitions/server_api_params.DepartmentMember" + "$ref": "#/definitions/sdkws.DepartmentMember" } }, "organizationUser": { - "$ref": "#/definitions/server_api_params.OrganizationUser" + "$ref": "#/definitions/sdkws.OrganizationUser" } } }, - "server_api_params.UserInfo": { + "sdkws.UserInfo": { "type": "object", "properties": { "appMangerLevel": { @@ -8523,7 +8523,7 @@ const docTemplate = `{ } } }, - "server_api_params.UserSendMsgResp": { + "sdkws.UserSendMsgResp": { "type": "object", "properties": { "clientMsgID": { diff --git a/cmd/open_im_api/docs/swagger.json b/cmd/api/docs/swagger.json similarity index 99% rename from cmd/open_im_api/docs/swagger.json rename to cmd/api/docs/swagger.json index c9b06c636..29d6c7041 100644 --- a/cmd/open_im_api/docs/swagger.json +++ b/cmd/api/docs/swagger.json @@ -488,7 +488,7 @@ "data": { "type": "array", "items": { - "$ref": "#/definitions/server_api_params.PublicUserInfo" + "$ref": "#/definitions/sdkws.PublicUserInfo" } } } @@ -557,7 +557,7 @@ "data": { "type": "array", "items": { - "$ref": "#/definitions/server_api_params.FriendRequest" + "$ref": "#/definitions/sdkws.FriendRequest" } } } @@ -626,7 +626,7 @@ "data": { "type": "array", "items": { - "$ref": "#/definitions/server_api_params.FriendInfo" + "$ref": "#/definitions/sdkws.FriendInfo" } } } @@ -695,7 +695,7 @@ "data": { "type": "array", "items": { - "$ref": "#/definitions/server_api_params.FriendRequest" + "$ref": "#/definitions/sdkws.FriendRequest" } } } @@ -1086,7 +1086,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/definitions/server_api_params.GroupInfo" + "$ref": "#/definitions/sdkws.GroupInfo" } } } @@ -1208,7 +1208,7 @@ "data": { "type": "array", "items": { - "$ref": "#/definitions/server_api_params.GroupMemberFullInfo" + "$ref": "#/definitions/sdkws.GroupMemberFullInfo" } } } @@ -1277,7 +1277,7 @@ "data": { "type": "array", "items": { - "$ref": "#/definitions/server_api_params.GroupMemberFullInfo" + "$ref": "#/definitions/sdkws.GroupMemberFullInfo" } } } @@ -1400,7 +1400,7 @@ "data": { "type": "array", "items": { - "$ref": "#/definitions/server_api_params.GroupInfo" + "$ref": "#/definitions/sdkws.GroupInfo" } } } @@ -1469,7 +1469,7 @@ "data": { "type": "array", "items": { - "$ref": "#/definitions/server_api_params.GroupRequest" + "$ref": "#/definitions/sdkws.GroupRequest" } } } @@ -1538,7 +1538,7 @@ "data": { "type": "array", "items": { - "$ref": "#/definitions/server_api_params.GroupRequest" + "$ref": "#/definitions/sdkws.GroupRequest" } } } @@ -3420,7 +3420,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/definitions/server_api_params.Department" + "$ref": "#/definitions/sdkws.Department" } } } @@ -3758,7 +3758,7 @@ "data": { "type": "array", "items": { - "$ref": "#/definitions/server_api_params.UserDepartmentMember" + "$ref": "#/definitions/sdkws.UserDepartmentMember" } } } @@ -3827,7 +3827,7 @@ "data": { "type": "array", "items": { - "$ref": "#/definitions/server_api_params.Department" + "$ref": "#/definitions/sdkws.Department" } } } @@ -3894,7 +3894,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/definitions/server_api_params.UserInDepartment" + "$ref": "#/definitions/sdkws.UserInDepartment" } } } @@ -4296,7 +4296,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/definitions/server_api_params.UserInfo" + "$ref": "#/definitions/sdkws.UserInfo" } } } @@ -4364,7 +4364,7 @@ "Data": { "type": "array", "items": { - "$ref": "#/definitions/server_api_params.PublicUserInfo" + "$ref": "#/definitions/sdkws.PublicUserInfo" } } } @@ -6762,7 +6762,7 @@ "type": "boolean" }, "offlinePushInfo": { - "$ref": "#/definitions/server_api_params.OfflinePushInfo" + "$ref": "#/definitions/sdkws.OfflinePushInfo" }, "operationID": { "type": "string" @@ -6815,7 +6815,7 @@ "type": "boolean" }, "offlinePushInfo": { - "$ref": "#/definitions/server_api_params.OfflinePushInfo" + "$ref": "#/definitions/sdkws.OfflinePushInfo" }, "operationID": { "type": "string" @@ -6844,7 +6844,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/definitions/server_api_params.UserSendMsgResp" + "$ref": "#/definitions/sdkws.UserSendMsgResp" }, "errCode": { "type": "integer" @@ -8102,7 +8102,7 @@ } } }, - "server_api_params.Department": { + "sdkws.Department": { "type": "object", "properties": { "createTime": { @@ -8137,7 +8137,7 @@ } } }, - "server_api_params.DepartmentMember": { + "sdkws.DepartmentMember": { "type": "object", "properties": { "departmentID": { @@ -8163,7 +8163,7 @@ } } }, - "server_api_params.FriendInfo": { + "sdkws.FriendInfo": { "type": "object", "properties": { "addSource": { @@ -8176,7 +8176,7 @@ "type": "string" }, "friendUser": { - "$ref": "#/definitions/server_api_params.UserInfo" + "$ref": "#/definitions/sdkws.UserInfo" }, "operatorUserID": { "type": "string" @@ -8189,7 +8189,7 @@ } } }, - "server_api_params.FriendRequest": { + "sdkws.FriendRequest": { "type": "object", "properties": { "createTime": { @@ -8239,7 +8239,7 @@ } } }, - "server_api_params.GroupInfo": { + "sdkws.GroupInfo": { "type": "object", "properties": { "applyMemberFriend": { @@ -8295,7 +8295,7 @@ } } }, - "server_api_params.GroupMemberFullInfo": { + "sdkws.GroupMemberFullInfo": { "type": "object", "properties": { "appMangerLevel": { @@ -8336,14 +8336,14 @@ } } }, - "server_api_params.GroupRequest": { + "sdkws.GroupRequest": { "type": "object", "properties": { "ex": { "type": "string" }, "groupInfo": { - "$ref": "#/definitions/server_api_params.GroupInfo" + "$ref": "#/definitions/sdkws.GroupInfo" }, "handleMsg": { "type": "string" @@ -8370,11 +8370,11 @@ "type": "integer" }, "userInfo": { - "$ref": "#/definitions/server_api_params.PublicUserInfo" + "$ref": "#/definitions/sdkws.PublicUserInfo" } } }, - "server_api_params.OfflinePushInfo": { + "sdkws.OfflinePushInfo": { "type": "object", "properties": { "desc": { @@ -8394,7 +8394,7 @@ } } }, - "server_api_params.OrganizationUser": { + "sdkws.OrganizationUser": { "type": "object", "properties": { "birth": { @@ -8432,7 +8432,7 @@ } } }, - "server_api_params.PublicUserInfo": { + "sdkws.PublicUserInfo": { "type": "object", "properties": { "ex": { @@ -8452,32 +8452,32 @@ } } }, - "server_api_params.UserDepartmentMember": { + "sdkws.UserDepartmentMember": { "type": "object", "properties": { "departmentMember": { - "$ref": "#/definitions/server_api_params.DepartmentMember" + "$ref": "#/definitions/sdkws.DepartmentMember" }, "organizationUser": { - "$ref": "#/definitions/server_api_params.OrganizationUser" + "$ref": "#/definitions/sdkws.OrganizationUser" } } }, - "server_api_params.UserInDepartment": { + "sdkws.UserInDepartment": { "type": "object", "properties": { "departmentMemberList": { "type": "array", "items": { - "$ref": "#/definitions/server_api_params.DepartmentMember" + "$ref": "#/definitions/sdkws.DepartmentMember" } }, "organizationUser": { - "$ref": "#/definitions/server_api_params.OrganizationUser" + "$ref": "#/definitions/sdkws.OrganizationUser" } } }, - "server_api_params.UserInfo": { + "sdkws.UserInfo": { "type": "object", "properties": { "appMangerLevel": { @@ -8515,7 +8515,7 @@ } } }, - "server_api_params.UserSendMsgResp": { + "sdkws.UserSendMsgResp": { "type": "object", "properties": { "clientMsgID": { diff --git a/cmd/open_im_api/docs/swagger.yaml b/cmd/api/docs/swagger.yaml similarity index 98% rename from cmd/open_im_api/docs/swagger.yaml rename to cmd/api/docs/swagger.yaml index 6c649c751..e3a90d694 100644 --- a/cmd/open_im_api/docs/swagger.yaml +++ b/cmd/api/docs/swagger.yaml @@ -1459,7 +1459,7 @@ definitions: notOfflinePush: type: boolean offlinePushInfo: - $ref: '#/definitions/server_api_params.OfflinePushInfo' + $ref: '#/definitions/sdkws.OfflinePushInfo' operationID: type: string recvIDList: @@ -1495,7 +1495,7 @@ definitions: notOfflinePush: type: boolean offlinePushInfo: - $ref: '#/definitions/server_api_params.OfflinePushInfo' + $ref: '#/definitions/sdkws.OfflinePushInfo' operationID: type: string recvID: @@ -1519,7 +1519,7 @@ definitions: api_struct.ManagementSendMsgResp: properties: data: - $ref: '#/definitions/server_api_params.UserSendMsgResp' + $ref: '#/definitions/sdkws.UserSendMsgResp' errCode: type: integer errMsg: @@ -2358,7 +2358,7 @@ definitions: userID: type: string type: object - server_api_params.Department: + sdkws.Department: properties: createTime: type: integer @@ -2381,7 +2381,7 @@ definitions: subDepartmentNum: type: integer type: object - server_api_params.DepartmentMember: + sdkws.DepartmentMember: properties: departmentID: type: string @@ -2398,7 +2398,7 @@ definitions: userID: type: string type: object - server_api_params.FriendInfo: + sdkws.FriendInfo: properties: addSource: type: integer @@ -2407,7 +2407,7 @@ definitions: ex: type: string friendUser: - $ref: '#/definitions/server_api_params.UserInfo' + $ref: '#/definitions/sdkws.UserInfo' operatorUserID: type: string ownerUserID: @@ -2415,7 +2415,7 @@ definitions: remark: type: string type: object - server_api_params.FriendRequest: + sdkws.FriendRequest: properties: createTime: type: integer @@ -2448,7 +2448,7 @@ definitions: toUserID: type: string type: object - server_api_params.GroupInfo: + sdkws.GroupInfo: properties: applyMemberFriend: type: integer @@ -2485,7 +2485,7 @@ definitions: status: type: integer type: object - server_api_params.GroupMemberFullInfo: + sdkws.GroupMemberFullInfo: properties: appMangerLevel: type: integer @@ -2512,12 +2512,12 @@ definitions: userID: type: string type: object - server_api_params.GroupRequest: + sdkws.GroupRequest: properties: ex: type: string groupInfo: - $ref: '#/definitions/server_api_params.GroupInfo' + $ref: '#/definitions/sdkws.GroupInfo' handleMsg: type: string handleResult: @@ -2535,9 +2535,9 @@ definitions: reqTime: type: integer userInfo: - $ref: '#/definitions/server_api_params.PublicUserInfo' + $ref: '#/definitions/sdkws.PublicUserInfo' type: object - server_api_params.OfflinePushInfo: + sdkws.OfflinePushInfo: properties: desc: type: string @@ -2550,7 +2550,7 @@ definitions: title: type: string type: object - server_api_params.OrganizationUser: + sdkws.OrganizationUser: properties: birth: type: integer @@ -2575,7 +2575,7 @@ definitions: userID: type: string type: object - server_api_params.PublicUserInfo: + sdkws.PublicUserInfo: properties: ex: type: string @@ -2588,23 +2588,23 @@ definitions: userID: type: string type: object - server_api_params.UserDepartmentMember: + sdkws.UserDepartmentMember: properties: departmentMember: - $ref: '#/definitions/server_api_params.DepartmentMember' + $ref: '#/definitions/sdkws.DepartmentMember' organizationUser: - $ref: '#/definitions/server_api_params.OrganizationUser' + $ref: '#/definitions/sdkws.OrganizationUser' type: object - server_api_params.UserInDepartment: + sdkws.UserInDepartment: properties: departmentMemberList: items: - $ref: '#/definitions/server_api_params.DepartmentMember' + $ref: '#/definitions/sdkws.DepartmentMember' type: array organizationUser: - $ref: '#/definitions/server_api_params.OrganizationUser' + $ref: '#/definitions/sdkws.OrganizationUser' type: object - server_api_params.UserInfo: + sdkws.UserInfo: properties: appMangerLevel: type: integer @@ -2629,7 +2629,7 @@ definitions: userID: type: string type: object - server_api_params.UserSendMsgResp: + sdkws.UserSendMsgResp: properties: clientMsgID: type: string @@ -2968,7 +2968,7 @@ paths: - properties: data: items: - $ref: '#/definitions/server_api_params.PublicUserInfo' + $ref: '#/definitions/sdkws.PublicUserInfo' type: array type: object "400": @@ -3011,7 +3011,7 @@ paths: - properties: data: items: - $ref: '#/definitions/server_api_params.FriendRequest' + $ref: '#/definitions/sdkws.FriendRequest' type: array type: object "400": @@ -3054,7 +3054,7 @@ paths: - properties: data: items: - $ref: '#/definitions/server_api_params.FriendInfo' + $ref: '#/definitions/sdkws.FriendInfo' type: array type: object "400": @@ -3097,7 +3097,7 @@ paths: - properties: data: items: - $ref: '#/definitions/server_api_params.FriendRequest' + $ref: '#/definitions/sdkws.FriendRequest' type: array type: object "400": @@ -3357,7 +3357,7 @@ paths: - $ref: '#/definitions/api_struct.CreateGroupResp' - properties: data: - $ref: '#/definitions/server_api_params.GroupInfo' + $ref: '#/definitions/sdkws.GroupInfo' type: object "400": description: errCode为400 一般为参数输入错误, token未带上等 @@ -3435,7 +3435,7 @@ paths: - properties: data: items: - $ref: '#/definitions/server_api_params.GroupMemberFullInfo' + $ref: '#/definitions/sdkws.GroupMemberFullInfo' type: array type: object "400": @@ -3478,7 +3478,7 @@ paths: - properties: data: items: - $ref: '#/definitions/server_api_params.GroupMemberFullInfo' + $ref: '#/definitions/sdkws.GroupMemberFullInfo' type: array type: object "400": @@ -3557,7 +3557,7 @@ paths: - properties: data: items: - $ref: '#/definitions/server_api_params.GroupInfo' + $ref: '#/definitions/sdkws.GroupInfo' type: array type: object "400": @@ -3600,7 +3600,7 @@ paths: - properties: data: items: - $ref: '#/definitions/server_api_params.GroupRequest' + $ref: '#/definitions/sdkws.GroupRequest' type: array type: object "400": @@ -3643,7 +3643,7 @@ paths: - properties: data: items: - $ref: '#/definitions/server_api_params.GroupRequest' + $ref: '#/definitions/sdkws.GroupRequest' type: array type: object "400": @@ -4884,7 +4884,7 @@ paths: - $ref: '#/definitions/api_struct.CreateDepartmentResp' - properties: data: - $ref: '#/definitions/server_api_params.Department' + $ref: '#/definitions/sdkws.Department' type: object "400": description: errCode为400 一般为参数输入错误, token未带上等 @@ -5106,7 +5106,7 @@ paths: - properties: data: items: - $ref: '#/definitions/server_api_params.UserDepartmentMember' + $ref: '#/definitions/sdkws.UserDepartmentMember' type: array type: object "400": @@ -5149,7 +5149,7 @@ paths: - properties: data: items: - $ref: '#/definitions/server_api_params.Department' + $ref: '#/definitions/sdkws.Department' type: array type: object "400": @@ -5191,7 +5191,7 @@ paths: - $ref: '#/definitions/api_struct.GetUserInDepartmentResp' - properties: data: - $ref: '#/definitions/server_api_params.UserInDepartment' + $ref: '#/definitions/sdkws.UserInDepartment' type: object "400": description: errCode为400 一般为参数输入错误, token未带上等 @@ -5457,7 +5457,7 @@ paths: - $ref: '#/definitions/api_struct.GetSelfUserInfoResp' - properties: data: - $ref: '#/definitions/server_api_params.UserInfo' + $ref: '#/definitions/sdkws.UserInfo' type: object "400": description: errCode为400 一般为参数输入错误, token未带上等 @@ -5499,7 +5499,7 @@ paths: - properties: Data: items: - $ref: '#/definitions/server_api_params.PublicUserInfo' + $ref: '#/definitions/sdkws.PublicUserInfo' type: array type: object "400": diff --git a/cmd/open_im_api/main.go b/cmd/api/main.go similarity index 100% rename from cmd/open_im_api/main.go rename to cmd/api/main.go diff --git a/cmd/open_im_cms_api/Makefile b/cmd/cmsapi/Makefile similarity index 100% rename from cmd/open_im_cms_api/Makefile rename to cmd/cmsapi/Makefile diff --git a/cmd/open_im_cms_api/main.go b/cmd/cmsapi/main.go similarity index 100% rename from cmd/open_im_cms_api/main.go rename to cmd/cmsapi/main.go diff --git a/cmd/open_im_cron_task/Makefile b/cmd/crontask/Makefile similarity index 100% rename from cmd/open_im_cron_task/Makefile rename to cmd/crontask/Makefile diff --git a/cmd/open_im_cron_task/main.go b/cmd/crontask/main.go similarity index 100% rename from cmd/open_im_cron_task/main.go rename to cmd/crontask/main.go diff --git a/cmd/open_im_msg_gateway/Makefile b/cmd/msggateway/Makefile similarity index 100% rename from cmd/open_im_msg_gateway/Makefile rename to cmd/msggateway/Makefile diff --git a/cmd/open_im_msg_gateway/main.go b/cmd/msggateway/main.go similarity index 100% rename from cmd/open_im_msg_gateway/main.go rename to cmd/msggateway/main.go diff --git a/cmd/open_im_msg_transfer/Makefile b/cmd/msgtransfer/Makefile similarity index 100% rename from cmd/open_im_msg_transfer/Makefile rename to cmd/msgtransfer/Makefile diff --git a/cmd/open_im_msg_transfer/main.go b/cmd/msgtransfer/main.go similarity index 100% rename from cmd/open_im_msg_transfer/main.go rename to cmd/msgtransfer/main.go diff --git a/cmd/open_im_demo/Makefile b/cmd/open_im_demo/Makefile deleted file mode 100644 index 45829acd8..000000000 --- a/cmd/open_im_demo/Makefile +++ /dev/null @@ -1,25 +0,0 @@ -.PHONY: all build run gotool install clean help - -BINARY_NAME=open_im_demo -BIN_DIR=../../bin/ - - -all: gotool build - -build: - CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" - -run: - @go run ./ - -gotool: - go fmt ./ - go vet ./ - -install: - make build - mv ${BINARY_NAME} ${BIN_DIR} - -clean: - @if [ -f ${BINARY_NAME} ] ; then rm ${BINARY_NAME} ; fi - diff --git a/cmd/open_im_demo/main.go b/cmd/open_im_demo/main.go deleted file mode 100644 index 945c586d2..000000000 --- a/cmd/open_im_demo/main.go +++ /dev/null @@ -1,62 +0,0 @@ -package main - -import ( - "Open_IM/internal/demo/register" - "Open_IM/pkg/utils" - "flag" - "fmt" - "io" - "os" - "strconv" - - "Open_IM/pkg/common/config" - "Open_IM/pkg/common/constant" - "Open_IM/pkg/common/log" - - promePkg "Open_IM/pkg/common/prometheus" - - "github.com/gin-gonic/gin" -) - -func main() { - log.NewPrivateLog(constant.LogFileName) - gin.SetMode(gin.ReleaseMode) - f, _ := os.Create("../logs/api.log") - gin.DefaultWriter = io.MultiWriter(f) - r := gin.Default() - r.Use(utils.CorsHandler()) - if config.Config.Prometheus.Enable { - r.GET("/metrics", promePkg.PrometheusHandler()) - } - authRouterGroup := r.Group("/demo") - { - authRouterGroup.POST("/code", register.SendVerificationCode) - authRouterGroup.POST("/verify", register.Verify) - authRouterGroup.POST("/password", register.SetPassword) - authRouterGroup.POST("/login", register.Login) - authRouterGroup.POST("/reset_password", register.ResetPassword) - } - demoRouterGroup := r.Group("/auth") - { - demoRouterGroup.POST("/code", register.SendVerificationCode) - demoRouterGroup.POST("/verify", register.Verify) - demoRouterGroup.POST("/password", register.SetPassword) - demoRouterGroup.POST("/login", register.Login) - demoRouterGroup.POST("/reset_password", register.ResetPassword) - } - - defaultPorts := config.Config.Demo.Port - ginPort := flag.Int("port", defaultPorts[0], "get ginServerPort from cmd,default 10004 as port") - flag.Parse() - address := "0.0.0.0:" + strconv.Itoa(*ginPort) - if config.Config.Api.ListenIP != "" { - address = config.Config.Api.ListenIP + ":" + strconv.Itoa(*ginPort) - } - address = config.Config.CmsApi.ListenIP + ":" + strconv.Itoa(*ginPort) - fmt.Println("start demo api server address: ", address, ", OpenIM version: ", constant.CurrentVersion, "\n") - go register.ImportFriendRoutine() - err := r.Run(address) - if err != nil { - log.Error("", "run failed ", *ginPort, err.Error()) - } -} diff --git a/cmd/open_im_push/Makefile b/cmd/push/Makefile similarity index 100% rename from cmd/open_im_push/Makefile rename to cmd/push/Makefile diff --git a/cmd/open_im_push/main.go b/cmd/push/main.go similarity index 100% rename from cmd/open_im_push/main.go rename to cmd/push/main.go diff --git a/cmd/rpc/open_im_admin_cms/Makefile b/cmd/rpc/admincms/Makefile similarity index 100% rename from cmd/rpc/open_im_admin_cms/Makefile rename to cmd/rpc/admincms/Makefile diff --git a/cmd/rpc/open_im_admin_cms/main.go b/cmd/rpc/admincms/main.go similarity index 100% rename from cmd/rpc/open_im_admin_cms/main.go rename to cmd/rpc/admincms/main.go diff --git a/cmd/rpc/open_im_auth/Makefile b/cmd/rpc/auth/Makefile similarity index 100% rename from cmd/rpc/open_im_auth/Makefile rename to cmd/rpc/auth/Makefile diff --git a/cmd/rpc/open_im_auth/main.go b/cmd/rpc/auth/main.go similarity index 100% rename from cmd/rpc/open_im_auth/main.go rename to cmd/rpc/auth/main.go diff --git a/cmd/rpc/open_im_conversation/Makefile b/cmd/rpc/conversation/Makefile similarity index 100% rename from cmd/rpc/open_im_conversation/Makefile rename to cmd/rpc/conversation/Makefile diff --git a/cmd/rpc/open_im_conversation/main.go b/cmd/rpc/conversation/main.go similarity index 100% rename from cmd/rpc/open_im_conversation/main.go rename to cmd/rpc/conversation/main.go diff --git a/cmd/rpc/open_im_friend/Makefile b/cmd/rpc/friend/Makefile similarity index 100% rename from cmd/rpc/open_im_friend/Makefile rename to cmd/rpc/friend/Makefile diff --git a/cmd/rpc/open_im_friend/main.go b/cmd/rpc/friend/main.go similarity index 100% rename from cmd/rpc/open_im_friend/main.go rename to cmd/rpc/friend/main.go diff --git a/cmd/rpc/open_im_group/Makefile b/cmd/rpc/group/Makefile similarity index 100% rename from cmd/rpc/open_im_group/Makefile rename to cmd/rpc/group/Makefile diff --git a/cmd/rpc/open_im_group/main.go b/cmd/rpc/group/main.go similarity index 100% rename from cmd/rpc/open_im_group/main.go rename to cmd/rpc/group/main.go diff --git a/cmd/rpc/open_im_msg/Makefile b/cmd/rpc/msg/Makefile similarity index 100% rename from cmd/rpc/open_im_msg/Makefile rename to cmd/rpc/msg/Makefile diff --git a/cmd/rpc/open_im_msg/main.go b/cmd/rpc/msg/main.go similarity index 100% rename from cmd/rpc/open_im_msg/main.go rename to cmd/rpc/msg/main.go diff --git a/cmd/rpc/open_im_office/Makefile b/cmd/rpc/office/Makefile similarity index 100% rename from cmd/rpc/open_im_office/Makefile rename to cmd/rpc/office/Makefile diff --git a/cmd/rpc/open_im_office/main.go b/cmd/rpc/office/main.go similarity index 100% rename from cmd/rpc/open_im_office/main.go rename to cmd/rpc/office/main.go diff --git a/cmd/rpc/open_im_user/Makefile b/cmd/rpc/user/Makefile similarity index 100% rename from cmd/rpc/open_im_user/Makefile rename to cmd/rpc/user/Makefile diff --git a/cmd/rpc/open_im_user/main.go b/cmd/rpc/user/main.go similarity index 100% rename from cmd/rpc/open_im_user/main.go rename to cmd/rpc/user/main.go diff --git a/cmdutils/mongo/mongo_utils.go b/cmdutils/mongo/mongo_utils.go index f53a6384c..21d9ea929 100644 --- a/cmdutils/mongo/mongo_utils.go +++ b/cmdutils/mongo/mongo_utils.go @@ -2,7 +2,7 @@ package mongo import ( "Open_IM/pkg/common/config" - server_api_params "Open_IM/pkg/proto/sdk_ws" + sdkws "Open_IM/pkg/proto/sdkws" "context" "fmt" "github.com/golang/protobuf/proto" @@ -42,7 +42,7 @@ func GetUserAllChat(uid string) { } for _, userChat := range userChatList { for _, msg := range userChat.Msg { - msgData := &server_api_params.MsgData{} + msgData := &sdkws.MsgData{} err := proto.Unmarshal(msg.Msg, msgData) if err != nil { fmt.Println(err.Error(), msg) diff --git a/config/config.yaml b/config/config.yaml index 01c8dd4cd..c3810750b 100644 --- a/config/config.yaml +++ b/config/config.yaml @@ -185,7 +185,6 @@ rpcregistername: #rpc注册服务名,默认即可 openImAdminCMSName: AdminCMS openImOfficeName: Office openImConversationName: Conversation - openImCacheName: Cache openImRealTimeCommName: RealTimeComm log: storageLocation: ../logs/ diff --git a/deploy_k8s/cache/cache.Dockerfile b/deploy_k8s/cache/cache.Dockerfile deleted file mode 100644 index 13c5278bd..000000000 --- a/deploy_k8s/cache/cache.Dockerfile +++ /dev/null @@ -1,19 +0,0 @@ -FROM ubuntu - -# 设置固定的项目路径 -ENV WORKDIR /Open-IM-Server -ENV CMDDIR $WORKDIR/cmd -ENV CONFIG_NAME $WORKDIR/config/config.yaml - - -# 将可执行文件复制到目标目录 -ADD ./open_im_cache $WORKDIR/cmd/main - -# 创建用于挂载的几个目录,添加可执行权限 -RUN mkdir $WORKDIR/logs $WORKDIR/config $WORKDIR/script && \ - chmod +x $WORKDIR/cmd/main - -VOLUME ["/Open-IM-Server/logs","/Open-IM-Server/config","/Open-IM-Server/script"] - -WORKDIR $CMDDIR -CMD ./main \ No newline at end of file diff --git a/deploy_k8s/cache/deployment.yaml b/deploy_k8s/cache/deployment.yaml deleted file mode 100644 index 9dd2129da..000000000 --- a/deploy_k8s/cache/deployment.yaml +++ /dev/null @@ -1,42 +0,0 @@ ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: cache-deployment -spec: - selector: - matchLabels: - app: cache # 选择这个指定标签执行 - replicas: 1 # 运行pod数量 - template: - metadata: - labels: - app: cache # 标签 - spec: - containers: - - name: cache - image: openim/cache:v2.3.4 - # imagePullPolicy: Always - ports: - - containerPort: 10240 - volumeMounts: - - name: config - mountPath: /Open-IM-Server/config - readOnly: true - - name: usualConfig - mountPath: /Open-IM-Server/config - readOnly: true - env: - - name: CONFIG_NAME - value: "/Open-IM-Server" - - name: USUAL_CONFIG_NAME - value: "/Open-IM-Server" - volumes: - - name: config - configMap: - name: openim-config - - name: usualConfig - configMap: - name: openim-usualConfig - strategy: #更新策略 - type: RollingUpdate # 滚动更新 \ No newline at end of file diff --git a/deploy_k8s/demo/demo.Dockerfile b/deploy_k8s/demo/demo.Dockerfile deleted file mode 100644 index 8b829dde0..000000000 --- a/deploy_k8s/demo/demo.Dockerfile +++ /dev/null @@ -1,19 +0,0 @@ -FROM ubuntu - -# 设置固定的项目路径 -ENV WORKDIR /Open-IM-Server -ENV CMDDIR $WORKDIR/cmd -ENV CONFIG_NAME $WORKDIR/config/config.yaml - -# 将可执行文件复制到目标目录 -ADD ./open_im_demo $WORKDIR/cmd/main - -# 创建用于挂载的几个目录,添加可执行权限 -RUN mkdir $WORKDIR/logs $WORKDIR/config $WORKDIR/script && \ - chmod +x $WORKDIR/cmd/main - -VOLUME ["/Open-IM-Server/logs","/Open-IM-Server/config","/Open-IM-Server/script"] - - -WORKDIR $CMDDIR -CMD ./main \ No newline at end of file diff --git a/deploy_k8s/demo/deployment.yaml b/deploy_k8s/demo/deployment.yaml deleted file mode 100644 index 205bb0d51..000000000 --- a/deploy_k8s/demo/deployment.yaml +++ /dev/null @@ -1,56 +0,0 @@ ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: demo-deployment -spec: - selector: - matchLabels: - app: demo # 选择这个指定标签执行 - replicas: 1 # 运行pod数量 - template: - metadata: - labels: - app: demo # 标签 - spec: - containers: - - name: demo - image: openim/demo:v2.3.4 - imagePullPolicy: Always - ports: - - containerPort: 10004 - volumeMounts: - - name: config - mountPath: /Open-IM-Server/config - readOnly: true - - name: usualConfig - mountPath: /Open-IM-Server/config - readOnly: true - env: - - name: CONFIG_NAME - value: "/Open-IM-Server" - - name: USUAL_CONFIG_NAME - value: "/Open-IM-Server" - volumes: - - name: config - configMap: - name: openim-config - - name: usualConfig - configMap: - name: openim-usualConfig - strategy: #更新策略 - type: RollingUpdate # 滚动更新 ---- -apiVersion: v1 -kind: Service -metadata: - name: demo -spec: - ports: - - name: demo - protocol: TCP - port: 10004 - targetPort: 10004 - selector: - app: demo - type: NodePort \ No newline at end of file diff --git a/deploy_k8s/organization/deployment.yaml b/deploy_k8s/organization/deployment.yaml deleted file mode 100644 index 7a5174cd0..000000000 --- a/deploy_k8s/organization/deployment.yaml +++ /dev/null @@ -1,42 +0,0 @@ ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: organization-deployment -spec: - selector: - matchLabels: - app: organization # 选择这个指定标签执行 - replicas: 1 # 运行pod数量 - template: - metadata: - labels: - app: organization # 标签 - spec: - containers: - - name: organization - image: openim/organization:v2.3.4 - # imagePullPolicy: Always - ports: - - containerPort: 10220 - volumeMounts: - - name: config - mountPath: /Open-IM-Server/config - readOnly: true - - name: usualConfig - mountPath: /Open-IM-Server/config - readOnly: true - env: - - name: CONFIG_NAME - value: "/Open-IM-Server" - - name: USUAL_CONFIG_NAME - value: "/Open-IM-Server" - volumes: - - name: config - configMap: - name: openim-config - - name: usualConfig - configMap: - name: openim-usualConfig - strategy: #更新策略 - type: RollingUpdate # 滚动更新 \ No newline at end of file diff --git a/deploy_k8s/organization/organization.Dockerfile b/deploy_k8s/organization/organization.Dockerfile deleted file mode 100644 index 9a824f1fe..000000000 --- a/deploy_k8s/organization/organization.Dockerfile +++ /dev/null @@ -1,20 +0,0 @@ -FROM ubuntu - -# 设置固定的项目路径 -ENV WORKDIR /Open-IM-Server -ENV CMDDIR $WORKDIR/cmd -ENV CONFIG_NAME $WORKDIR/config/config.yaml - -# 将可执行文件复制到目标目录 -ADD ./open_im_organization $WORKDIR/cmd/main - - -# 创建用于挂载的几个目录,添加可执行权限 -RUN mkdir $WORKDIR/logs $WORKDIR/config $WORKDIR/script && \ - chmod +x $WORKDIR/cmd/main - -VOLUME ["/Open-IM-Server/logs","/Open-IM-Server/config","/Open-IM-Server/script"] - - -WORKDIR $CMDDIR -CMD ./main \ No newline at end of file diff --git a/deploy_k8s/admin_cms/admin_cms.Dockerfile b/deployk8s/admincms/admin_cms.Dockerfile similarity index 100% rename from deploy_k8s/admin_cms/admin_cms.Dockerfile rename to deployk8s/admincms/admin_cms.Dockerfile diff --git a/deploy_k8s/admin_cms/deployment.yaml b/deployk8s/admincms/deployment.yaml similarity index 100% rename from deploy_k8s/admin_cms/deployment.yaml rename to deployk8s/admincms/deployment.yaml diff --git a/deploy_k8s/api/api.Dockerfile b/deployk8s/api/api.Dockerfile similarity index 100% rename from deploy_k8s/api/api.Dockerfile rename to deployk8s/api/api.Dockerfile diff --git a/deploy_k8s/api/deployment.yaml b/deployk8s/api/deployment.yaml similarity index 100% rename from deploy_k8s/api/deployment.yaml rename to deployk8s/api/deployment.yaml diff --git a/deploy_k8s/auth/auth.Dockerfile b/deployk8s/auth/auth.Dockerfile similarity index 100% rename from deploy_k8s/auth/auth.Dockerfile rename to deployk8s/auth/auth.Dockerfile diff --git a/deploy_k8s/auth/deployment.yaml b/deployk8s/auth/deployment.yaml similarity index 100% rename from deploy_k8s/auth/deployment.yaml rename to deployk8s/auth/deployment.yaml diff --git a/deploy_k8s/build_push_all_images.sh b/deployk8s/build_push_all_images.sh similarity index 100% rename from deploy_k8s/build_push_all_images.sh rename to deployk8s/build_push_all_images.sh diff --git a/deploy_k8s/cms_api/cms_api.Dockerfile b/deployk8s/cmsapi/cms_api.Dockerfile similarity index 100% rename from deploy_k8s/cms_api/cms_api.Dockerfile rename to deployk8s/cmsapi/cms_api.Dockerfile diff --git a/deploy_k8s/cms_api/deployment.yaml b/deployk8s/cmsapi/deployment.yaml similarity index 100% rename from deploy_k8s/cms_api/deployment.yaml rename to deployk8s/cmsapi/deployment.yaml diff --git a/deploy_k8s/conversation/conversation.Dockerfile b/deployk8s/conversation/conversation.Dockerfile similarity index 100% rename from deploy_k8s/conversation/conversation.Dockerfile rename to deployk8s/conversation/conversation.Dockerfile diff --git a/deploy_k8s/conversation/deployment.yaml b/deployk8s/conversation/deployment.yaml similarity index 100% rename from deploy_k8s/conversation/deployment.yaml rename to deployk8s/conversation/deployment.yaml diff --git a/deploy_k8s/friend/deployment.yaml b/deployk8s/friend/deployment.yaml similarity index 100% rename from deploy_k8s/friend/deployment.yaml rename to deployk8s/friend/deployment.yaml diff --git a/deploy_k8s/friend/friend.Dockerfile b/deployk8s/friend/friend.Dockerfile similarity index 100% rename from deploy_k8s/friend/friend.Dockerfile rename to deployk8s/friend/friend.Dockerfile diff --git a/deploy_k8s/group/deployment.yaml b/deployk8s/group/deployment.yaml similarity index 100% rename from deploy_k8s/group/deployment.yaml rename to deployk8s/group/deployment.yaml diff --git a/deploy_k8s/group/group.Dockerfile b/deployk8s/group/group.Dockerfile similarity index 100% rename from deploy_k8s/group/group.Dockerfile rename to deployk8s/group/group.Dockerfile diff --git a/deploy_k8s/ingress.yaml b/deployk8s/ingress.yaml similarity index 100% rename from deploy_k8s/ingress.yaml rename to deployk8s/ingress.yaml diff --git a/deploy_k8s/k8s_openim_deploy.md b/deployk8s/k8s_openim_deploy.md similarity index 100% rename from deploy_k8s/k8s_openim_deploy.md rename to deployk8s/k8s_openim_deploy.md diff --git a/deploy_k8s/kubectl_start_all.sh b/deployk8s/kubectl_start_all.sh old mode 100755 new mode 100644 similarity index 100% rename from deploy_k8s/kubectl_start_all.sh rename to deployk8s/kubectl_start_all.sh diff --git a/deploy_k8s/kubectl_stop_all.sh b/deployk8s/kubectl_stop_all.sh old mode 100755 new mode 100644 similarity index 100% rename from deploy_k8s/kubectl_stop_all.sh rename to deployk8s/kubectl_stop_all.sh diff --git a/deploy_k8s/msg/deployment.yaml b/deployk8s/msg/deployment.yaml similarity index 100% rename from deploy_k8s/msg/deployment.yaml rename to deployk8s/msg/deployment.yaml diff --git a/deploy_k8s/msg/msg.Dockerfile b/deployk8s/msg/msg.Dockerfile similarity index 100% rename from deploy_k8s/msg/msg.Dockerfile rename to deployk8s/msg/msg.Dockerfile diff --git a/deploy_k8s/msg_gateway/deployment.yaml b/deployk8s/msggateway/deployment.yaml similarity index 100% rename from deploy_k8s/msg_gateway/deployment.yaml rename to deployk8s/msggateway/deployment.yaml diff --git a/deploy_k8s/msg_gateway/msg_gateway.Dockerfile b/deployk8s/msggateway/msg_gateway.Dockerfile similarity index 100% rename from deploy_k8s/msg_gateway/msg_gateway.Dockerfile rename to deployk8s/msggateway/msg_gateway.Dockerfile diff --git a/deploy_k8s/msg_transfer/deployment.yaml b/deployk8s/msgtransfer/deployment.yaml similarity index 100% rename from deploy_k8s/msg_transfer/deployment.yaml rename to deployk8s/msgtransfer/deployment.yaml diff --git a/deploy_k8s/msg_transfer/msg_transfer.Dockerfile b/deployk8s/msgtransfer/msg_transfer.Dockerfile similarity index 100% rename from deploy_k8s/msg_transfer/msg_transfer.Dockerfile rename to deployk8s/msgtransfer/msg_transfer.Dockerfile diff --git a/deploy_k8s/office/deployment.yaml b/deployk8s/office/deployment.yaml similarity index 100% rename from deploy_k8s/office/deployment.yaml rename to deployk8s/office/deployment.yaml diff --git a/deploy_k8s/office/office.Dockerfile b/deployk8s/office/office.Dockerfile similarity index 100% rename from deploy_k8s/office/office.Dockerfile rename to deployk8s/office/office.Dockerfile diff --git a/deploy_k8s/path_info.cfg b/deployk8s/path_info.cfg similarity index 58% rename from deploy_k8s/path_info.cfg rename to deployk8s/path_info.cfg index 193ffd320..a5a0c0431 100644 --- a/deploy_k8s/path_info.cfg +++ b/deployk8s/path_info.cfg @@ -2,21 +2,18 @@ service=( #api service file api - cms_api + cmsapi #rpc service file user friend group auth - admin_cms + admincms office - organization conversation - cache - msg_gateway - msg_transfer + msggateway + msgtransfer msg push - sdk_server - demo + sdkserver ) \ No newline at end of file diff --git a/deploy_k8s/push/deployment.yaml b/deployk8s/push/deployment.yaml similarity index 100% rename from deploy_k8s/push/deployment.yaml rename to deployk8s/push/deployment.yaml diff --git a/deploy_k8s/push/push.Dockerfile b/deployk8s/push/push.Dockerfile similarity index 100% rename from deploy_k8s/push/push.Dockerfile rename to deployk8s/push/push.Dockerfile diff --git a/deploy_k8s/sdk_server/deployment.yaml b/deployk8s/sdkserver/deployment.yaml similarity index 89% rename from deploy_k8s/sdk_server/deployment.yaml rename to deployk8s/sdkserver/deployment.yaml index bee3dc4bf..1bc147f24 100644 --- a/deploy_k8s/sdk_server/deployment.yaml +++ b/deployk8s/sdkserver/deployment.yaml @@ -29,7 +29,7 @@ spec: - name: CONFIG_NAME value: "/Open-IM-Server" command: ["/Open-IM-Server/main"] - args: ["-openIM_ws_address", "ws_addr", "-sdk_ws_port", "10003", "-openIM_api_address", "api_address", "-openIM_log_level", "6"] + args: ["-openIM_ws_address", "ws_addr", "-sdkws_port", "10003", "-openIM_api_address", "api_address", "-openIM_log_level", "6"] volumes: - name: config configMap: diff --git a/deploy_k8s/sdk_server/sdk_server.Dockerfile b/deployk8s/sdkserver/sdk_server.Dockerfile similarity index 100% rename from deploy_k8s/sdk_server/sdk_server.Dockerfile rename to deployk8s/sdkserver/sdk_server.Dockerfile diff --git a/deploy_k8s/user/deployment.yaml b/deployk8s/user/deployment.yaml similarity index 100% rename from deploy_k8s/user/deployment.yaml rename to deployk8s/user/deployment.yaml diff --git a/deploy_k8s/user/user.Dockerfile b/deployk8s/user/user.Dockerfile similarity index 100% rename from deploy_k8s/user/user.Dockerfile rename to deployk8s/user/user.Dockerfile diff --git a/internal/api/auth/auth.go b/internal/api/auth/auth.go index d699fbf63..c82c02b7c 100644 --- a/internal/api/auth/auth.go +++ b/internal/api/auth/auth.go @@ -8,7 +8,7 @@ import ( "Open_IM/pkg/common/tokenverify" "Open_IM/pkg/getcdv3" rpc "Open_IM/pkg/proto/auth" - open_im_sdk "Open_IM/pkg/proto/sdk_ws" + open_im_sdk "Open_IM/pkg/proto/sdkws" "Open_IM/pkg/utils" "context" "net/http" diff --git a/internal/api/client_init/init_config.go b/internal/api/client_init/init_config.go deleted file mode 100644 index 61a4f074b..000000000 --- a/internal/api/client_init/init_config.go +++ /dev/null @@ -1,73 +0,0 @@ -package clientInit - -import ( - api "Open_IM/pkg/api_struct" - imdb "Open_IM/pkg/common/db/mysql_model/im_mysql_model" - "Open_IM/pkg/common/log" - "Open_IM/pkg/common/tokenverify" - "Open_IM/pkg/utils" - "net/http" - - "github.com/gin-gonic/gin" -) - -func SetClientInitConfig(c *gin.Context) { - var req api.SetClientInitConfigReq - var resp api.SetClientInitConfigResp - if err := c.BindJSON(&req); err != nil { - log.NewError("0", utils.GetSelfFuncName(), err.Error()) - c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) - return - } - log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req) - err, _ := tokenverify.ParseTokenGetUserID(c.Request.Header.Get("token"), req.OperationID) - if err != nil { - errMsg := "ParseTokenGetUserID failed " + err.Error() + c.Request.Header.Get("token") - log.NewError(req.OperationID, errMsg, errMsg) - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) - return - } - m := make(map[string]interface{}) - if req.DiscoverPageURL != nil { - m["discover_page_url"] = *req.DiscoverPageURL - } - if len(m) > 0 { - err := imdb.SetClientInitConfig(m) - if err != nil { - log.NewError(req.OperationID, utils.GetSelfFuncName(), err.Error()) - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": err.Error()}) - return - } - } - log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp) - c.JSON(http.StatusOK, resp) -} - -func GetClientInitConfig(c *gin.Context) { - var req api.GetClientInitConfigReq - var resp api.GetClientInitConfigResp - if err := c.BindJSON(&req); err != nil { - log.NewError("0", utils.GetSelfFuncName(), err.Error()) - c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) - return - } - log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req) - err, _ := tokenverify.ParseTokenGetUserID(c.Request.Header.Get("token"), req.OperationID) - if err != nil { - errMsg := "ParseTokenGetUserID failed " + err.Error() + c.Request.Header.Get("token") - log.NewError(req.OperationID, errMsg, errMsg) - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) - return - } - config, err := imdb.GetClientInitConfig() - if err != nil { - log.NewError(req.OperationID, utils.GetSelfFuncName(), err.Error()) - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": err.Error()}) - return - - } - resp.Data.DiscoverPageURL = config.DiscoverPageURL - log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp ", resp) - c.JSON(http.StatusOK, resp) - -} diff --git a/internal/api/friend/friend.go b/internal/api/friend/friend.go index 0c0fa3d60..f1531d395 100644 --- a/internal/api/friend/friend.go +++ b/internal/api/friend/friend.go @@ -8,7 +8,7 @@ package friend // "Open_IM/pkg/common/tokenverify" // "Open_IM/pkg/getcdv3" // rpc "Open_IM/pkg/proto/friend" -// open_im_sdk "Open_IM/pkg/proto/sdk_ws" +// open_im_sdk "Open_IM/pkg/proto/sdkws" // "Open_IM/pkg/utils" // "context" // "github.com/gin-gonic/gin" diff --git a/internal/api/manage/management_chat.go b/internal/api/manage/management_chat.go index 8a06f6468..8efb1996a 100644 --- a/internal/api/manage/management_chat.go +++ b/internal/api/manage/management_chat.go @@ -15,7 +15,7 @@ import ( "Open_IM/pkg/common/tokenverify" "Open_IM/pkg/getcdv3" pbChat "Open_IM/pkg/proto/msg" - open_im_sdk "Open_IM/pkg/proto/sdk_ws" + open_im_sdk "Open_IM/pkg/proto/sdkws" "Open_IM/pkg/utils" "context" "net/http" diff --git a/internal/api/msg/del_msg.go b/internal/api/msg/del_msg.go index e27298726..877062404 100644 --- a/internal/api/msg/del_msg.go +++ b/internal/api/msg/del_msg.go @@ -8,7 +8,7 @@ import ( "Open_IM/pkg/common/tokenverify" "Open_IM/pkg/getcdv3" rpc "Open_IM/pkg/proto/msg" - pbCommon "Open_IM/pkg/proto/sdk_ws" + pbCommon "Open_IM/pkg/proto/sdkws" "Open_IM/pkg/utils" "context" "github.com/gin-gonic/gin" diff --git a/internal/api/msg/get_max_min_seq.go b/internal/api/msg/get_max_min_seq.go index 9945bb220..b6cecdfe3 100644 --- a/internal/api/msg/get_max_min_seq.go +++ b/internal/api/msg/get_max_min_seq.go @@ -6,7 +6,7 @@ import ( "Open_IM/pkg/common/tokenverify" "Open_IM/pkg/getcdv3" pbChat "Open_IM/pkg/proto/msg" - sdk_ws "Open_IM/pkg/proto/sdk_ws" + sdkws "Open_IM/pkg/proto/sdkws" "context" "github.com/gin-gonic/gin" "net/http" @@ -32,7 +32,7 @@ func GetSeq(c *gin.Context) { c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "token validate err" + err.Error()}) return } - pbData := sdk_ws.GetMaxAndMinSeqReq{} + pbData := sdkws.GetMaxAndMinSeqReq{} pbData.UserID = params.SendID pbData.OperationID = params.OperationID grpcConn := rpc.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImMsgName, pbData.OperationID) diff --git a/internal/api/msg/pull_msg.go b/internal/api/msg/pull_msg.go index 1971b428d..d82ee6ebf 100644 --- a/internal/api/msg/pull_msg.go +++ b/internal/api/msg/pull_msg.go @@ -6,7 +6,7 @@ import ( "Open_IM/pkg/common/tokenverify" "Open_IM/pkg/getcdv3" "Open_IM/pkg/proto/msg" - open_im_sdk "Open_IM/pkg/proto/sdk_ws" + open_im_sdk "Open_IM/pkg/proto/sdkws" "Open_IM/pkg/utils" "context" "github.com/gin-gonic/gin" diff --git a/internal/api/msg/send_msg.go b/internal/api/msg/send_msg.go index da9e5ba4f..1f38de3bb 100644 --- a/internal/api/msg/send_msg.go +++ b/internal/api/msg/send_msg.go @@ -4,7 +4,7 @@ import ( "Open_IM/pkg/common/config" "Open_IM/pkg/common/log" pbChat "Open_IM/pkg/proto/msg" - open_im_sdk "Open_IM/pkg/proto/sdk_ws" + open_im_sdk "Open_IM/pkg/proto/sdkws" "context" "Open_IM/pkg/getcdv3" diff --git a/internal/api/office/tag.go b/internal/api/office/tag.go index b6fa5e281..f9d2d2683 100644 --- a/internal/api/office/tag.go +++ b/internal/api/office/tag.go @@ -7,7 +7,7 @@ import ( "Open_IM/pkg/common/tokenverify" "Open_IM/pkg/getcdv3" pbOffice "Open_IM/pkg/proto/office" - pbCommon "Open_IM/pkg/proto/sdk_ws" + pbCommon "Open_IM/pkg/proto/sdkws" "Open_IM/pkg/utils" "context" "github.com/gin-gonic/gin" diff --git a/internal/api/office/work_moments.go b/internal/api/office/work_moments.go index ab07fa0bd..137ccacc8 100644 --- a/internal/api/office/work_moments.go +++ b/internal/api/office/work_moments.go @@ -7,7 +7,7 @@ import ( "Open_IM/pkg/common/tokenverify" "Open_IM/pkg/getcdv3" pbOffice "Open_IM/pkg/proto/office" - pbCommon "Open_IM/pkg/proto/sdk_ws" + pbCommon "Open_IM/pkg/proto/sdkws" "Open_IM/pkg/utils" "context" "github.com/gin-gonic/gin" diff --git a/internal/api/user/user.go b/internal/api/user/user.go index 5a0b39e01..5d45021a3 100644 --- a/internal/api/user/user.go +++ b/internal/api/user/user.go @@ -10,7 +10,7 @@ import ( "Open_IM/pkg/getcdv3" cacheRpc "Open_IM/pkg/proto/cache" pbRelay "Open_IM/pkg/proto/relay" - open_im_sdk "Open_IM/pkg/proto/sdk_ws" + open_im_sdk "Open_IM/pkg/proto/sdkws" rpc "Open_IM/pkg/proto/user" "Open_IM/pkg/utils" "context" diff --git a/internal/cmsapi/admin/admin.go b/internal/cmsapi/admin/admin.go index 0523644a8..5eadf975d 100644 --- a/internal/cmsapi/admin/admin.go +++ b/internal/cmsapi/admin/admin.go @@ -7,7 +7,7 @@ import ( "Open_IM/pkg/common/log" "Open_IM/pkg/getcdv3" pbAdmin "Open_IM/pkg/proto/admin_cms" - pbCommon "Open_IM/pkg/proto/sdk_ws" + pbCommon "Open_IM/pkg/proto/sdkws" "Open_IM/pkg/utils" "context" "net/http" diff --git a/internal/cmsapi/friend/friend.go b/internal/cmsapi/friend/friend.go index b3cf55832..a301b3e01 100644 --- a/internal/cmsapi/friend/friend.go +++ b/internal/cmsapi/friend/friend.go @@ -6,7 +6,7 @@ import ( "Open_IM/pkg/common/log" "Open_IM/pkg/getcdv3" pbAdmin "Open_IM/pkg/proto/admin_cms" - pbCommon "Open_IM/pkg/proto/sdk_ws" + pbCommon "Open_IM/pkg/proto/sdkws" "Open_IM/pkg/utils" "context" "net/http" diff --git a/internal/cmsapi/group/group.go b/internal/cmsapi/group/group.go index 3ca499646..ff923c415 100644 --- a/internal/cmsapi/group/group.go +++ b/internal/cmsapi/group/group.go @@ -5,7 +5,7 @@ import ( "Open_IM/pkg/common/config" "Open_IM/pkg/common/log" "Open_IM/pkg/getcdv3" - common "Open_IM/pkg/proto/sdk_ws" + common "Open_IM/pkg/proto/sdkws" "Open_IM/pkg/utils" "context" "net/http" diff --git a/internal/cmsapi/message_cms/message.go b/internal/cmsapi/message_cms/message.go index 367d0b388..01b7d0916 100644 --- a/internal/cmsapi/message_cms/message.go +++ b/internal/cmsapi/message_cms/message.go @@ -6,7 +6,7 @@ import ( "Open_IM/pkg/common/log" "Open_IM/pkg/getcdv3" pbAdminCMS "Open_IM/pkg/proto/admin_cms" - pbCommon "Open_IM/pkg/proto/sdk_ws" + pbCommon "Open_IM/pkg/proto/sdkws" "Open_IM/pkg/utils" "context" "net/http" diff --git a/internal/cmsapi/user/user.go b/internal/cmsapi/user/user.go index a432ef2c7..ea9976b01 100644 --- a/internal/cmsapi/user/user.go +++ b/internal/cmsapi/user/user.go @@ -7,7 +7,7 @@ import ( "Open_IM/pkg/common/log" "Open_IM/pkg/getcdv3" pbAdminCms "Open_IM/pkg/proto/admin_cms" - common "Open_IM/pkg/proto/sdk_ws" + common "Open_IM/pkg/proto/sdkws" pb "Open_IM/pkg/proto/user" "Open_IM/pkg/utils" "context" diff --git a/internal/common/check/friend.go b/internal/common/check/friend.go index ac85cb5dd..c48a42931 100644 --- a/internal/common/check/friend.go +++ b/internal/common/check/friend.go @@ -1,11 +1,11 @@ package check import ( - server_api_params "Open_IM/pkg/proto/sdk_ws" + sdkws "Open_IM/pkg/proto/sdkws" "context" "errors" ) -func GetFriendsInfo(ctx context.Context, ownerUserID, friendUserID string) (*server_api_params.FriendInfo, error) { +func GetFriendsInfo(ctx context.Context, ownerUserID, friendUserID string) (*sdkws.FriendInfo, error) { return nil, errors.New("TODO:GetUserInfo") } diff --git a/internal/common/check/group.go b/internal/common/check/group.go index 56df95e76..43ed85d1a 100644 --- a/internal/common/check/group.go +++ b/internal/common/check/group.go @@ -1,7 +1,7 @@ package check import ( - server_api_params "Open_IM/pkg/proto/sdk_ws" + sdkws "Open_IM/pkg/proto/sdkws" "errors" ) @@ -12,6 +12,6 @@ func NewGroupChecker() *GroupChecker { return &GroupChecker{} } -func (g *GroupChecker) GetGroupInfo(groupID string) (*server_api_params.GroupInfo, error) { +func (g *GroupChecker) GetGroupInfo(groupID string) (*sdkws.GroupInfo, error) { return nil, errors.New("TODO:GetUserInfo") } diff --git a/internal/common/check/user.go b/internal/common/check/user.go index 75abdb440..66f75198f 100644 --- a/internal/common/check/user.go +++ b/internal/common/check/user.go @@ -1,11 +1,11 @@ package check import ( - server_api_params "Open_IM/pkg/proto/sdk_ws" + sdkws "Open_IM/pkg/proto/sdkws" "context" "errors" ) -func GetUsersInfo(ctx context.Context, args ...interface{}) ([]*server_api_params.UserInfo, error) { +func GetUsersInfo(ctx context.Context, args ...interface{}) ([]*sdkws.UserInfo, error) { return nil, errors.New("TODO:GetUserInfo") } diff --git a/internal/common/convert/convert.go b/internal/common/convert/convert.go index a829f053e..9d4f31f46 100644 --- a/internal/common/convert/convert.go +++ b/internal/common/convert/convert.go @@ -2,7 +2,7 @@ package convert import ( "Open_IM/pkg/common/db/table/relation" - sdk "Open_IM/pkg/proto/sdk_ws" + sdk "Open_IM/pkg/proto/sdkws" utils "github.com/OpenIMSDK/open_utils" "time" ) diff --git a/internal/crontask/clear_msg.go b/internal/crontask/clear_msg.go index 3ccfb4819..72dc74abf 100644 --- a/internal/crontask/clear_msg.go +++ b/internal/crontask/clear_msg.go @@ -6,7 +6,7 @@ import ( "Open_IM/pkg/common/db" "Open_IM/pkg/common/db/mongo" "Open_IM/pkg/common/log" - server_api_params "Open_IM/pkg/proto/sdk_ws" + sdkws "Open_IM/pkg/proto/sdkws" "Open_IM/pkg/utils" "math" "strconv" @@ -109,7 +109,7 @@ func deleteMongoMsg(operationID string, ID string, index int64, delStruct *delMs } if msgs.Msg[len(msgs.Msg)-1].SendTime+(int64(config.Config.Mongo.DBRetainChatRecords)*24*60*60*1000) > utils.GetCurrentTimestampByMill() && msgListIsFull(msgs) { delStruct.delUidList = append(delStruct.delUidList, msgs.UID) - lastMsgPb := &server_api_params.MsgData{} + lastMsgPb := &sdkws.MsgData{} err = proto.Unmarshal(msgs.Msg[len(msgs.Msg)-1].Msg, lastMsgPb) if err != nil { log.NewError(operationID, utils.GetSelfFuncName(), err.Error(), len(msgs.Msg)-1, msgs.UID) @@ -119,7 +119,7 @@ func deleteMongoMsg(operationID string, ID string, index int64, delStruct *delMs } else { var hasMarkDelFlag bool for _, msg := range msgs.Msg { - msgPb := &server_api_params.MsgData{} + msgPb := &sdkws.MsgData{} err = proto.Unmarshal(msg.Msg, msgPb) if err != nil { log.NewError(operationID, utils.GetSelfFuncName(), err.Error(), len(msgs.Msg)-1, msgs.UID) diff --git a/internal/crontask/clear_msg_test.go b/internal/crontask/clear_msg_test.go index c0dda262d..0079c01a2 100644 --- a/internal/crontask/clear_msg_test.go +++ b/internal/crontask/clear_msg_test.go @@ -3,7 +3,7 @@ package cronTask import ( "Open_IM/pkg/common/constant" mongo2 "Open_IM/pkg/common/db/mongo" - server_api_params "Open_IM/pkg/proto/sdk_ws" + sdkws "Open_IM/pkg/proto/sdkws" "context" "fmt" "strconv" @@ -25,7 +25,7 @@ var ( func GenUserChat(startSeq, stopSeq, delSeq, index uint32, userID string) *mongo2.UserChat { chat := &mongo2.UserChat{UID: userID + strconv.Itoa(int(index))} for i := startSeq; i <= stopSeq; i++ { - msg := server_api_params.MsgData{ + msg := sdkws.MsgData{ SendID: "sendID1", RecvID: "recvID1", GroupID: "", diff --git a/internal/msggateway/gate/batch_push.go b/internal/msggateway/batch_push.go similarity index 82% rename from internal/msggateway/gate/batch_push.go rename to internal/msggateway/batch_push.go index a0a91c692..a215ddd0a 100644 --- a/internal/msggateway/gate/batch_push.go +++ b/internal/msggateway/batch_push.go @@ -1,12 +1,11 @@ -package gate +package msggateway import ( "Open_IM/pkg/common/config" "Open_IM/pkg/common/db" "Open_IM/pkg/common/log" - "Open_IM/pkg/getcdv3" pbChat "Open_IM/pkg/proto/msg" - sdk_ws "Open_IM/pkg/proto/sdk_ws" + sdkws "Open_IM/pkg/proto/sdkws" "Open_IM/pkg/utils" "context" "strings" @@ -34,8 +33,8 @@ func (r *RPCServer) GenPullSeqList(currentSeq uint32, operationID string, userID return seqList, nil } -func (r *RPCServer) GetSingleUserMsgForPushPlatforms(operationID string, msgData *sdk_ws.MsgData, pushToUserID string, platformIDList []int) map[int]*sdk_ws.MsgDataList { - user2PushMsg := make(map[int]*sdk_ws.MsgDataList, 0) +func (r *RPCServer) GetSingleUserMsgForPushPlatforms(operationID string, msgData *sdkws.MsgData, pushToUserID string, platformIDList []int) map[int]*sdkws.MsgDataList { + user2PushMsg := make(map[int]*sdkws.MsgDataList, 0) for _, v := range platformIDList { user2PushMsg[v] = r.GetSingleUserMsgForPush(operationID, msgData, pushToUserID, v) //log.Info(operationID, "GetSingleUserMsgForPush", msgData.Seq, pushToUserID, v, "len:", len(user2PushMsg[v])) @@ -43,14 +42,14 @@ func (r *RPCServer) GetSingleUserMsgForPushPlatforms(operationID string, msgData return user2PushMsg } -func (r *RPCServer) GetSingleUserMsgForPush(operationID string, msgData *sdk_ws.MsgData, pushToUserID string, platformID int) *sdk_ws.MsgDataList { +func (r *RPCServer) GetSingleUserMsgForPush(operationID string, msgData *sdkws.MsgData, pushToUserID string, platformID int) *sdkws.MsgDataList { //msgData.MsgDataList = nil - return &sdk_ws.MsgDataList{MsgDataList: []*sdk_ws.MsgData{msgData}} + return &sdkws.MsgDataList{MsgDataList: []*sdkws.MsgData{msgData}} //userConn := ws.getUserConn(pushToUserID, platformID) //if userConn == nil { // log.Debug(operationID, "userConn == nil") - // return []*sdk_ws.MsgData{msgData} + // return []*sdkws.MsgData{msgData} //} // //if msgData.Seq <= userConn.PushedMaxSeq { @@ -62,7 +61,7 @@ func (r *RPCServer) GetSingleUserMsgForPush(operationID string, msgData *sdk_ws. //if msgList == nil { // log.Debug(operationID, "GetSingleUserMsg msgList == nil", msgData.Seq, userConn.PushedMaxSeq) // userConn.PushedMaxSeq = msgData.Seq - // return []*sdk_ws.MsgData{msgData} + // return []*sdkws.MsgData{msgData} //} //msgList = append(msgList, msgData) // @@ -75,7 +74,7 @@ func (r *RPCServer) GetSingleUserMsgForPush(operationID string, msgData *sdk_ws. //return msgList } -func (r *RPCServer) GetSingleUserMsg(operationID string, currentMsgSeq uint32, userID string) []*sdk_ws.MsgData { +func (r *RPCServer) GetSingleUserMsg(operationID string, currentMsgSeq uint32, userID string) []*sdkws.MsgData { seqList, err := r.GenPullSeqList(currentMsgSeq, operationID, userID) if err != nil { log.Error(operationID, "GenPullSeqList failed ", err.Error(), currentMsgSeq, userID) @@ -85,7 +84,7 @@ func (r *RPCServer) GetSingleUserMsg(operationID string, currentMsgSeq uint32, u log.Error(operationID, "GenPullSeqList len == 0 ", currentMsgSeq, userID) return nil } - rpcReq := sdk_ws.PullMessageBySeqListReq{} + rpcReq := sdkws.PullMessageBySeqListReq{} rpcReq.SeqList = seqList rpcReq.UserID = userID rpcReq.OperationID = operationID @@ -108,8 +107,8 @@ func (r *RPCServer) GetSingleUserMsg(operationID string, currentMsgSeq uint32, u return reply.List } -//func (r *RPCServer) GetBatchUserMsgForPush(operationID string, msgData *sdk_ws.MsgData, pushToUserIDList []string, platformID int) map[string][]*sdk_ws.MsgData { -// user2PushMsg := make(map[string][]*sdk_ws.MsgData, 0) +//func (r *RPCServer) GetBatchUserMsgForPush(operationID string, msgData *sdkws.MsgData, pushToUserIDList []string, platformID int) map[string][]*sdkws.MsgData { +// user2PushMsg := make(map[string][]*sdkws.MsgData, 0) // for _, v := range pushToUserIDList { // user2PushMsg[v] = r.GetSingleUserMsgForPush(operationID, msgData, v, platformID) // } diff --git a/internal/msggateway/gate/callback.go b/internal/msggateway/callback.go similarity index 99% rename from internal/msggateway/gate/callback.go rename to internal/msggateway/callback.go index 345e8c732..6c709514b 100644 --- a/internal/msggateway/gate/callback.go +++ b/internal/msggateway/callback.go @@ -1,4 +1,4 @@ -package gate +package msggateway import ( cbApi "Open_IM/pkg/callback_struct" diff --git a/internal/msggateway/gate/open_im_media/room.go b/internal/msggateway/gate/open_im_media/room.go deleted file mode 100644 index b840de39a..000000000 --- a/internal/msggateway/gate/open_im_media/room.go +++ /dev/null @@ -1,22 +0,0 @@ -package open_im_media - -const ( - // Address gRPC服务地址 - Address = "127.0.0.1:11300" -) - -type Media struct { -} - -func NewMedia() *Media { - return &Media{} -} - -func init() { - -} - -func (m *Media) CreateRoom(roomName string) (error, error) { - return nil, nil - -} diff --git a/internal/msggateway/gate/init.go b/internal/msggateway/init.go similarity index 98% rename from internal/msggateway/gate/init.go rename to internal/msggateway/init.go index 88ef3d12d..d68a359f3 100644 --- a/internal/msggateway/gate/init.go +++ b/internal/msggateway/init.go @@ -1,4 +1,4 @@ -package gate +package msggateway import ( "Open_IM/pkg/common/config" diff --git a/internal/msggateway/gate/logic.go b/internal/msggateway/logic.go similarity index 94% rename from internal/msggateway/gate/logic.go rename to internal/msggateway/logic.go index 2ef6f7ac3..2109efe3d 100644 --- a/internal/msggateway/gate/logic.go +++ b/internal/msggateway/logic.go @@ -1,4 +1,4 @@ -package gate +package msggateway import ( "Open_IM/pkg/common/config" @@ -6,11 +6,10 @@ import ( "Open_IM/pkg/common/db" "Open_IM/pkg/common/log" promePkg "Open_IM/pkg/common/prometheus" - "Open_IM/pkg/getcdv3" pbChat "Open_IM/pkg/proto/msg" push "Open_IM/pkg/proto/push" pbRtc "Open_IM/pkg/proto/rtc" - sdk_ws "Open_IM/pkg/proto/sdk_ws" + sdkws "Open_IM/pkg/proto/sdkws" "Open_IM/pkg/utils" "bytes" "context" @@ -78,15 +77,15 @@ func (ws *WServer) msgParse(conn *UserConn, binaryMsg []byte) { func (ws *WServer) getSeqReq(conn *UserConn, m *Req) { log.NewInfo(m.OperationID, "Ws call success to getNewSeq", m.MsgIncr, m.SendID, m.ReqIdentifier) - nReply := new(sdk_ws.GetMaxAndMinSeqResp) + nReply := new(sdkws.GetMaxAndMinSeqResp) isPass, errCode, errMsg, data := ws.argsValidate(m, constant.WSGetNewestSeq, m.OperationID) log.Info(m.OperationID, "argsValidate ", isPass, errCode, errMsg) if isPass { - rpcReq := sdk_ws.GetMaxAndMinSeqReq{} - rpcReq.GroupIDList = data.(sdk_ws.GetMaxAndMinSeqReq).GroupIDList + rpcReq := sdkws.GetMaxAndMinSeqReq{} + rpcReq.GroupIDList = data.(sdkws.GetMaxAndMinSeqReq).GroupIDList rpcReq.UserID = m.SendID rpcReq.OperationID = m.OperationID - log.Debug(m.OperationID, "Ws call success to getMaxAndMinSeq", m.SendID, m.ReqIdentifier, m.MsgIncr, data.(sdk_ws.GetMaxAndMinSeqReq).GroupIDList) + log.Debug(m.OperationID, "Ws call success to getMaxAndMinSeq", m.SendID, m.ReqIdentifier, m.MsgIncr, data.(sdkws.GetMaxAndMinSeqReq).GroupIDList) grpcConn := rpc.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImMsgName, rpcReq.OperationID) if grpcConn == nil { errMsg := rpcReq.OperationID + "getcdv3.GetDefaultConn == nil" @@ -115,7 +114,7 @@ func (ws *WServer) getSeqReq(conn *UserConn, m *Req) { } } -func (ws *WServer) getSeqResp(conn *UserConn, m *Req, pb *sdk_ws.GetMaxAndMinSeqResp) { +func (ws *WServer) getSeqResp(conn *UserConn, m *Req, pb *sdkws.GetMaxAndMinSeqResp) { b, _ := proto.Marshal(pb) mReply := Resp{ @@ -133,15 +132,15 @@ func (ws *WServer) getSeqResp(conn *UserConn, m *Req, pb *sdk_ws.GetMaxAndMinSeq func (ws *WServer) pullMsgBySeqListReq(conn *UserConn, m *Req) { log.NewInfo(m.OperationID, "Ws call success to pullMsgBySeqListReq start", m.SendID, m.ReqIdentifier, m.MsgIncr, string(m.Data)) - nReply := new(sdk_ws.PullMessageBySeqListResp) + nReply := new(sdkws.PullMessageBySeqListResp) isPass, errCode, errMsg, data := ws.argsValidate(m, constant.WSPullMsgBySeqList, m.OperationID) if isPass { - rpcReq := sdk_ws.PullMessageBySeqListReq{} - rpcReq.SeqList = data.(sdk_ws.PullMessageBySeqListReq).SeqList + rpcReq := sdkws.PullMessageBySeqListReq{} + rpcReq.SeqList = data.(sdkws.PullMessageBySeqListReq).SeqList rpcReq.UserID = m.SendID rpcReq.OperationID = m.OperationID - rpcReq.GroupSeqList = data.(sdk_ws.PullMessageBySeqListReq).GroupSeqList - log.NewInfo(m.OperationID, "Ws call success to pullMsgBySeqListReq middle", m.SendID, m.ReqIdentifier, m.MsgIncr, data.(sdk_ws.PullMessageBySeqListReq).SeqList) + rpcReq.GroupSeqList = data.(sdkws.PullMessageBySeqListReq).GroupSeqList + log.NewInfo(m.OperationID, "Ws call success to pullMsgBySeqListReq middle", m.SendID, m.ReqIdentifier, m.MsgIncr, data.(sdkws.PullMessageBySeqListReq).SeqList) grpcConn := rpc.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImMsgName, m.OperationID) if grpcConn == nil { errMsg := rpcReq.OperationID + "getcdv3.GetDefaultConn == nil" @@ -169,7 +168,7 @@ func (ws *WServer) pullMsgBySeqListReq(conn *UserConn, m *Req) { ws.pullMsgBySeqListResp(conn, m, nReply) } } -func (ws *WServer) pullMsgBySeqListResp(conn *UserConn, m *Req, pb *sdk_ws.PullMessageBySeqListResp) { +func (ws *WServer) pullMsgBySeqListResp(conn *UserConn, m *Req, pb *sdkws.PullMessageBySeqListResp) { log.NewInfo(m.OperationID, "pullMsgBySeqListResp come here ", pb.String()) c, _ := proto.Marshal(pb) mReply := Resp{ @@ -229,7 +228,7 @@ func (ws *WServer) sendMsgReq(conn *UserConn, m *Req) { nReply := new(pbChat.SendMsgResp) isPass, errCode, errMsg, pData := ws.argsValidate(m, constant.WSSendMsg, m.OperationID) if isPass { - data := pData.(sdk_ws.MsgData) + data := pData.(sdkws.MsgData) pbData := pbChat.SendMsgReq{ Token: m.Token, OperationID: m.OperationID, @@ -265,7 +264,7 @@ func (ws *WServer) sendMsgReq(conn *UserConn, m *Req) { } func (ws *WServer) sendMsgResp(conn *UserConn, m *Req, pb *pbChat.SendMsgResp) { - var mReplyData sdk_ws.UserSendMsgResp + var mReplyData sdkws.UserSendMsgResp mReplyData.ClientMsgID = pb.GetClientMsgID() mReplyData.ServerMsgID = pb.GetServerMsgID() mReplyData.SendTime = pb.GetSendTime() @@ -307,7 +306,7 @@ func (ws *WServer) sendSignalMsgReq(conn *UserConn, m *Req) { return } signalResp.Payload = respPb.SignalResp.Payload - msgData := sdk_ws.MsgData{} + msgData := sdkws.MsgData{} utils.CopyStructFields(&msgData, respPb.MsgData) log.NewInfo(m.OperationID, utils.GetSelfFuncName(), respPb.String()) if respPb.IsPass { @@ -406,7 +405,7 @@ func SetTokenKicked(userID string, platformID int, operationID string) { func (ws *WServer) setUserDeviceBackground(conn *UserConn, m *Req) { isPass, errCode, errMsg, pData := ws.argsValidate(m, constant.WsSetBackgroundStatus, m.OperationID) if isPass { - req := pData.(*sdk_ws.SetAppBackgroundStatusReq) + req := pData.(*sdkws.SetAppBackgroundStatusReq) conn.IsBackground = req.IsBackground callbackResp := callbackUserOnline(m.OperationID, conn.userID, int(conn.PlatformID), conn.token, conn.IsBackground, conn.connID) if callbackResp.ErrCode != 0 { diff --git a/internal/msggateway/gate/relay_rpc_server.go b/internal/msggateway/relay_rpc_server.go similarity index 98% rename from internal/msggateway/gate/relay_rpc_server.go rename to internal/msggateway/relay_rpc_server.go index 2c96b65f3..04da8ff77 100644 --- a/internal/msggateway/gate/relay_rpc_server.go +++ b/internal/msggateway/relay_rpc_server.go @@ -1,4 +1,4 @@ -package gate +package msggateway import ( "Open_IM/pkg/common/config" @@ -6,9 +6,8 @@ import ( "Open_IM/pkg/common/log" promePkg "Open_IM/pkg/common/prometheus" "Open_IM/pkg/common/tokenverify" - "Open_IM/pkg/getcdv3" pbRelay "Open_IM/pkg/proto/relay" - sdk_ws "Open_IM/pkg/proto/sdk_ws" + sdkws "Open_IM/pkg/proto/sdkws" "Open_IM/pkg/utils" "bytes" "context" @@ -297,7 +296,7 @@ func (r *RPCServer) OnlineBatchPushOneMsg(_ context.Context, req *pbRelay.Online SinglePushResult: singleUserResult, }, nil } -func (r *RPCServer) encodeWsData(wsData *sdk_ws.MsgData, operationID string) (bytes.Buffer, error) { +func (r *RPCServer) encodeWsData(wsData *sdkws.MsgData, operationID string) (bytes.Buffer, error) { log.Debug(operationID, "encodeWsData begin", wsData.String()) msgBytes, err := proto.Marshal(wsData) if err != nil { diff --git a/internal/msggateway/gate/validate.go b/internal/msggateway/validate.go similarity index 98% rename from internal/msggateway/gate/validate.go rename to internal/msggateway/validate.go index 51a665122..8283d7945 100644 --- a/internal/msggateway/gate/validate.go +++ b/internal/msggateway/validate.go @@ -4,13 +4,13 @@ ** author("fg,Gordon@tuoyun.net"). ** time(2021/5/21 15:29). */ -package gate +package msggateway import ( "Open_IM/pkg/common/constant" "Open_IM/pkg/common/log" pbRtc "Open_IM/pkg/proto/rtc" - open_im_sdk "Open_IM/pkg/proto/sdk_ws" + open_im_sdk "Open_IM/pkg/proto/sdkws" "github.com/golang/protobuf/proto" ) diff --git a/internal/msggateway/gate/ws_server.go b/internal/msggateway/ws_server.go similarity index 99% rename from internal/msggateway/gate/ws_server.go rename to internal/msggateway/ws_server.go index 078cc08a5..99bc8fa28 100644 --- a/internal/msggateway/gate/ws_server.go +++ b/internal/msggateway/ws_server.go @@ -1,4 +1,4 @@ -package gate +package msggateway import ( "Open_IM/pkg/common/config" @@ -7,7 +7,6 @@ import ( "Open_IM/pkg/common/log" promePkg "Open_IM/pkg/common/prometheus" "Open_IM/pkg/common/tokenverify" - "Open_IM/pkg/getcdv3" pbRelay "Open_IM/pkg/proto/relay" "Open_IM/pkg/utils" "bytes" diff --git a/internal/msgtransfer/logic/db.go b/internal/msgtransfer/db.go similarity index 98% rename from internal/msgtransfer/logic/db.go rename to internal/msgtransfer/db.go index ee6e5ea2c..d403ecb47 100644 --- a/internal/msgtransfer/logic/db.go +++ b/internal/msgtransfer/db.go @@ -1,4 +1,4 @@ -package logic +package msgtransfer import ( "Open_IM/pkg/common/db" diff --git a/internal/msgtransfer/logic/init.go b/internal/msgtransfer/init.go similarity index 99% rename from internal/msgtransfer/logic/init.go rename to internal/msgtransfer/init.go index ebe0d1aa9..86a576c65 100644 --- a/internal/msgtransfer/logic/init.go +++ b/internal/msgtransfer/init.go @@ -1,4 +1,4 @@ -package logic +package msgtransfer import ( "Open_IM/pkg/common/config" diff --git a/internal/msgtransfer/logic/modify_msg_handler.go b/internal/msgtransfer/modify_msg_handler.go similarity index 94% rename from internal/msgtransfer/logic/modify_msg_handler.go rename to internal/msgtransfer/modify_msg_handler.go index 0c89f556d..796617175 100644 --- a/internal/msgtransfer/logic/modify_msg_handler.go +++ b/internal/msgtransfer/modify_msg_handler.go @@ -1,15 +1,13 @@ -package logic +package msgtransfer import ( - "Open_IM/pkg/api_struct" "Open_IM/pkg/common/config" "Open_IM/pkg/common/constant" "Open_IM/pkg/common/db" - "Open_IM/pkg/common/db/mongo" kfk "Open_IM/pkg/common/kafka" "Open_IM/pkg/common/log" pbMsg "Open_IM/pkg/proto/msg" - server_api_params "Open_IM/pkg/proto/sdk_ws" + sdkws "Open_IM/pkg/proto/sdkws" "Open_IM/pkg/utils" "encoding/json" "github.com/Shopify/sarama" @@ -90,9 +88,9 @@ func (mmc *ModifyMsgConsumerHandler) ModifyMsg(cMsg *sarama.ConsumerMessage, msg continue } } else { - var reactionExtensionList = make(map[string]*server_api_params.KeyValue) + var reactionExtensionList = make(map[string]*sdkws.KeyValue) for _, v := range notification.SuccessReactionExtensionList { - reactionExtensionList[v.TypeKey] = &server_api_params.KeyValue{ + reactionExtensionList[v.TypeKey] = &sdkws.KeyValue{ TypeKey: v.TypeKey, Value: v.Value, LatestUpdateTime: v.LatestUpdateTime, diff --git a/internal/msgtransfer/logic/online_history_msg_handler.go b/internal/msgtransfer/online_history_msg_handler.go similarity index 99% rename from internal/msgtransfer/logic/online_history_msg_handler.go rename to internal/msgtransfer/online_history_msg_handler.go index 3ff509c80..8536e45dc 100644 --- a/internal/msgtransfer/logic/online_history_msg_handler.go +++ b/internal/msgtransfer/online_history_msg_handler.go @@ -1,4 +1,4 @@ -package logic +package msgtransfer import ( "Open_IM/pkg/common/config" @@ -6,7 +6,6 @@ import ( "Open_IM/pkg/common/db" kfk "Open_IM/pkg/common/kafka" "Open_IM/pkg/common/log" - "Open_IM/pkg/getcdv3" pbMsg "Open_IM/pkg/proto/msg" pbPush "Open_IM/pkg/proto/push" "Open_IM/pkg/utils" @@ -164,8 +163,8 @@ func (och *OnlineHistoryRedisConsumerHandler) SendMessageToMongoCH(aggregationID // } // for _, v := range msgList { // if v.MsgData.ContentType == constant.DeleteMessageNotification { -// tips := server_api_params.TipsComm{} -// DeleteMessageTips := server_api_params.DeleteMessageTips{} +// tips := sdkws.TipsComm{} +// DeleteMessageTips := sdkws.DeleteMessageTips{} // err := proto.Unmarshal(v.MsgData.Content, &tips) // if err != nil { // log.NewError(triggerID, "tips unmarshal err:", err.Error(), v.String()) diff --git a/internal/msgtransfer/logic/online_msg_to_mongo_handler.go b/internal/msgtransfer/online_msg_to_mongo_handler.go similarity index 84% rename from internal/msgtransfer/logic/online_msg_to_mongo_handler.go rename to internal/msgtransfer/online_msg_to_mongo_handler.go index 4a6362a05..7c863e0c3 100644 --- a/internal/msgtransfer/logic/online_msg_to_mongo_handler.go +++ b/internal/msgtransfer/online_msg_to_mongo_handler.go @@ -1,4 +1,4 @@ -package logic +package msgtransfer import ( "Open_IM/pkg/common/config" @@ -7,7 +7,7 @@ import ( kfk "Open_IM/pkg/common/kafka" "Open_IM/pkg/common/log" pbMsg "Open_IM/pkg/proto/msg" - server_api_params "Open_IM/pkg/proto/sdk_ws" + sdkws "Open_IM/pkg/proto/sdkws" "Open_IM/pkg/utils" "github.com/Shopify/sarama" "github.com/golang/protobuf/proto" @@ -18,10 +18,10 @@ type OnlineHistoryMongoConsumerHandler struct { historyConsumerGroup *kfk.MConsumerGroup } -func (och *OnlineHistoryMongoConsumerHandler) Init() { - och.msgHandle = make(map[string]fcb) - och.msgHandle[config.Config.Kafka.MsgToMongo.Topic] = och.handleChatWs2Mongo - och.historyConsumerGroup = kfk.NewMConsumerGroup(&kfk.MConsumerGroupConfig{KafkaVersion: sarama.V2_0_0_0, +func (mc *OnlineHistoryMongoConsumerHandler) Init() { + mc.msgHandle = make(map[string]fcb) + mc.msgHandle[config.Config.Kafka.MsgToMongo.Topic] = mc.handleChatWs2Mongo + mc.historyConsumerGroup = kfk.NewMConsumerGroup(&kfk.MConsumerGroupConfig{KafkaVersion: sarama.V2_0_0_0, OffsetsInitial: sarama.OffsetNewest, IsReturnErr: false}, []string{config.Config.Kafka.MsgToMongo.Topic}, config.Config.Kafka.Ws2mschat.Addr, config.Config.Kafka.ConsumerGroupID.MsgToMongo) @@ -46,8 +46,8 @@ func (mc *OnlineHistoryMongoConsumerHandler) handleChatWs2Mongo(cMsg *sarama.Con } for _, v := range msgFromMQ.MessageList { if v.MsgData.ContentType == constant.DeleteMessageNotification { - tips := server_api_params.TipsComm{} - DeleteMessageTips := server_api_params.DeleteMessageTips{} + tips := sdkws.TipsComm{} + DeleteMessageTips := sdkws.DeleteMessageTips{} err := proto.Unmarshal(v.MsgData.Content, &tips) if err != nil { log.NewError(msgFromMQ.TriggerID, "tips unmarshal err:", err.Error(), v.String()) @@ -68,13 +68,13 @@ func (mc *OnlineHistoryMongoConsumerHandler) handleChatWs2Mongo(cMsg *sarama.Con func (OnlineHistoryMongoConsumerHandler) Setup(_ sarama.ConsumerGroupSession) error { return nil } func (OnlineHistoryMongoConsumerHandler) Cleanup(_ sarama.ConsumerGroupSession) error { return nil } -func (och *OnlineHistoryMongoConsumerHandler) ConsumeClaim(sess sarama.ConsumerGroupSession, +func (mc *OnlineHistoryMongoConsumerHandler) ConsumeClaim(sess sarama.ConsumerGroupSession, claim sarama.ConsumerGroupClaim) error { // a instance in the consumer group log.NewDebug("", "online new session msg come", claim.HighWaterMarkOffset(), claim.Topic(), claim.Partition()) for msg := range claim.Messages() { log.NewDebug("", "kafka get info to mongo", "msgTopic", msg.Topic, "msgPartition", msg.Partition, "msg", string(msg.Value), "key", string(msg.Key)) if len(msg.Value) != 0 { - och.msgHandle[msg.Topic](msg, string(msg.Key), sess) + mc.msgHandle[msg.Topic](msg, string(msg.Key), sess) } else { log.Error("", "mongo msg get from kafka but is nil", msg.Key) } diff --git a/internal/msgtransfer/logic/persistent_msg_handler.go b/internal/msgtransfer/persistent_msg_handler.go similarity index 92% rename from internal/msgtransfer/logic/persistent_msg_handler.go rename to internal/msgtransfer/persistent_msg_handler.go index 3bfa99255..946dd6c48 100644 --- a/internal/msgtransfer/logic/persistent_msg_handler.go +++ b/internal/msgtransfer/persistent_msg_handler.go @@ -4,7 +4,7 @@ ** author("fg,Gordon@tuoyun.net"). ** time(2021/5/11 15:37). */ -package logic +package msgtransfer import ( "Open_IM/pkg/common/config" @@ -98,3 +98,15 @@ func (pc *PersistentConsumerHandler) ConsumeClaim(sess sarama.ConsumerGroupSessi } return nil } + +1. 请求1 group Rpc 2. 请求2 发消息 sendMsg rpc +1 更改数据库 + +2. 删除哈希缓存 + 检测到哈希变了, 群成员还没来得及删除,有问题 +3. 删除群成员缓存 + +4. 删除对应群成员加群缓存 + +5. 删除数量缓存 + diff --git a/internal/push/content_struct/content.go b/internal/push/content_struct/content.go deleted file mode 100644 index c27b3f92a..000000000 --- a/internal/push/content_struct/content.go +++ /dev/null @@ -1,85 +0,0 @@ -/* -** description(""). -** copyright('open-im,www.open-im.io'). -** author("fg,Gordon@tuoyun.net"). -** time(2021/5/27 11:24). - */ -package content_struct - -import ( - "encoding/json" -) - -type Content struct { - IsDisplay int32 `json:"isDisplay"` - ID string `json:"id"` - Text string `json:"text"` -} - -func NewContentStructString(isDisplay int32, ID string, text string) string { - c := Content{IsDisplay: isDisplay, ID: ID, Text: text} - return c.contentToString() -} - -func (c *Content) contentToString() string { - data, _ := json.Marshal(c) - dataString := string(data) - return dataString -} - -type groupMemberFullInfo struct { - GroupId string `json:"groupID"` - UserId string `json:"userId"` - Role int `json:"role"` - JoinTime uint64 `json:"joinTime"` - NickName string `json:"nickName"` - FaceUrl string `json:"faceUrl"` -} - -type AgreeOrRejectGroupMember struct { - GroupId string `json:"groupID"` - UserId string `json:"userId"` - Role int `json:"role"` - JoinTime uint64 `json:"joinTime"` - NickName string `json:"nickName"` - FaceUrl string `json:"faceUrl"` - Reason string `json:"reason"` -} -type AtTextContent struct { - Text string `json:"text"` - AtUserList []string `json:"atUserList"` - IsAtSelf bool `json:"isAtSelf"` -} - -type CreateGroupSysMsg struct { - uIdCreator string `creatorUid` - initMemberList []groupMemberFullInfo `json: initMemberList` - CreateTime uint64 `json:"CreateTime"` - Text string `json:"text"` -} - -type NotificationContent struct { - IsDisplay int32 `json:"isDisplay"` - DefaultTips string `json:"defaultTips"` - Detail string `json:"detail"` -} - -func (c *NotificationContent) ContentToString() string { - data, _ := json.Marshal(c) - dataString := string(data) - return dataString -} - -type KickGroupMemberApiReq struct { - GroupID string `json:"groupID"` - UidList []string `json:"uidList"` - Reason string `json:"reason"` - OperationID string `json:"operationID"` -} - -func NewCreateGroupSysMsgString(create *CreateGroupSysMsg, text string) string { - create.Text = text - jstring, _ := json.Marshal(create) - - return string(jstring) -} diff --git a/internal/push/jpush/push.go b/internal/push/jpush/push.go index 0239d400c..6a5026301 100644 --- a/internal/push/jpush/push.go +++ b/internal/push/jpush/push.go @@ -35,24 +35,24 @@ func (j *JPush) SetAlias(cid, alias string) (resp string, err error) { func (j *JPush) Push(accounts []string, title, detailContent, operationID string, opts push.PushOpts) (string, error) { - var pf requestBody.Platform + var pf requestbody.Platform pf.SetAll() - var au requestBody.Audience + var au requestbody.Audience au.SetAlias(accounts) - var no requestBody.Notification + var no requestbody.Notification - var extras requestBody.Extras + var extras requestbody.Extras if opts.Signal.ClientMsgID != "" { extras.ClientMsgID = opts.Signal.ClientMsgID } no.IOSEnableMutableContent() no.SetExtras(extras) no.SetAlert(title) - var me requestBody.Message + var me requestbody.Message me.SetMsgContent(detailContent) - var o requestBody.Options + var o requestbody.Options o.SetApnsProduction(config.Config.IOSPush.Production) - var po requestBody.PushObj + var po requestbody.PushObj po.SetPlatform(&pf) po.SetAudience(&au) po.SetNotification(&no) diff --git a/internal/push/jpush/requestBody/audience.go b/internal/push/jpush/requestbody/audience.go similarity index 97% rename from internal/push/jpush/requestBody/audience.go rename to internal/push/jpush/requestbody/audience.go index dc20a83df..9ccdd2cec 100644 --- a/internal/push/jpush/requestBody/audience.go +++ b/internal/push/jpush/requestbody/audience.go @@ -1,4 +1,4 @@ -package requestBody +package requestbody const ( TAG = "tag" diff --git a/internal/push/jpush/requestBody/message.go b/internal/push/jpush/requestbody/message.go similarity index 96% rename from internal/push/jpush/requestBody/message.go rename to internal/push/jpush/requestbody/message.go index 6e6fe1eb9..5ed293f64 100644 --- a/internal/push/jpush/requestBody/message.go +++ b/internal/push/jpush/requestbody/message.go @@ -1,4 +1,4 @@ -package requestBody +package requestbody type Message struct { MsgContent string `json:"msg_content"` diff --git a/internal/push/jpush/requestBody/notification.go b/internal/push/jpush/requestbody/notification.go similarity index 98% rename from internal/push/jpush/requestBody/notification.go rename to internal/push/jpush/requestbody/notification.go index 56ada1551..67c37b1c7 100644 --- a/internal/push/jpush/requestBody/notification.go +++ b/internal/push/jpush/requestbody/notification.go @@ -1,4 +1,4 @@ -package requestBody +package requestbody import ( "Open_IM/pkg/common/config" diff --git a/internal/push/jpush/requestBody/options.go b/internal/push/jpush/requestbody/options.go similarity index 87% rename from internal/push/jpush/requestBody/options.go rename to internal/push/jpush/requestbody/options.go index f82ebd035..dd0733c1b 100644 --- a/internal/push/jpush/requestBody/options.go +++ b/internal/push/jpush/requestbody/options.go @@ -1,4 +1,4 @@ -package requestBody +package requestbody type Options struct { ApnsProduction bool `json:"apns_production"` diff --git a/internal/push/jpush/requestBody/platform.go b/internal/push/jpush/requestbody/platform.go similarity index 98% rename from internal/push/jpush/requestBody/platform.go rename to internal/push/jpush/requestbody/platform.go index 0f9d243cf..363e132d9 100644 --- a/internal/push/jpush/requestBody/platform.go +++ b/internal/push/jpush/requestbody/platform.go @@ -1,4 +1,4 @@ -package requestBody +package requestbody import ( "Open_IM/pkg/common/constant" diff --git a/internal/push/jpush/requestBody/pushObj.go b/internal/push/jpush/requestbody/pushobj.go similarity index 96% rename from internal/push/jpush/requestBody/pushObj.go rename to internal/push/jpush/requestbody/pushobj.go index 974161407..e29403109 100644 --- a/internal/push/jpush/requestBody/pushObj.go +++ b/internal/push/jpush/requestbody/pushobj.go @@ -1,4 +1,4 @@ -package requestBody +package requestbody type PushObj struct { Platform interface{} `json:"platform"` diff --git a/internal/push/logic/callback.go b/internal/push/logic/callback.go index 357f556f4..6dcc1cbc3 100644 --- a/internal/push/logic/callback.go +++ b/internal/push/logic/callback.go @@ -7,7 +7,7 @@ import ( "Open_IM/pkg/common/constant" "Open_IM/pkg/common/http" "Open_IM/pkg/common/log" - common "Open_IM/pkg/proto/sdk_ws" + common "Open_IM/pkg/proto/sdkws" "Open_IM/pkg/utils" http2 "net/http" ) diff --git a/internal/push/mobpush/push.go b/internal/push/mobpush/push.go index e8ac4ecfb..be28f1adb 100644 --- a/internal/push/mobpush/push.go +++ b/internal/push/mobpush/push.go @@ -26,23 +26,21 @@ func newGetuiClient() *MobPush { } func (j *MobPush) Push(accounts []string, alert, detailContent, operationID string, opts push.PushOpts) (string, error) { - - var target requestParams.PushTarget - + var target requestparams.PushTarget target.SetAlias(accounts) target.SetTarget(2) - var no requestParams.PushNotify + var no requestparams.PushNotify no.SetType(1) no.SetIosProduction(1) no.SetPlats([]int{1, 2}) no.SetContent(alert) - var forward requestParams.PushForward + var forward requestparams.PushForward forward.SetNextType(2) forward.SetScheme(config.Config.Push.Mob.Scheme) - var po requestParams.PushObj + var po requestparams.PushObj po.SetSource("webapi") po.SetAppkey(config.Config.Push.Mob.AppKey) po.SetPushTarget(&target) diff --git a/internal/push/mobpush/requestParams/pushForward.go b/internal/push/mobpush/requestparams/pushForward.go similarity index 91% rename from internal/push/mobpush/requestParams/pushForward.go rename to internal/push/mobpush/requestparams/pushForward.go index ffda49459..be448af09 100644 --- a/internal/push/mobpush/requestParams/pushForward.go +++ b/internal/push/mobpush/requestparams/pushForward.go @@ -1,4 +1,4 @@ -package requestParams +package requestparams type PushForward struct { NextType int `json:"nextType"` diff --git a/internal/push/mobpush/requestParams/pushNotify.go b/internal/push/mobpush/requestparams/pushNotify.go similarity index 95% rename from internal/push/mobpush/requestParams/pushNotify.go rename to internal/push/mobpush/requestparams/pushNotify.go index 0a6c92899..2c259b0d8 100644 --- a/internal/push/mobpush/requestParams/pushNotify.go +++ b/internal/push/mobpush/requestparams/pushNotify.go @@ -1,4 +1,4 @@ -package requestParams +package requestparams type PushNotify struct { Plats []int `json:"plats,omitempty"` diff --git a/internal/push/mobpush/requestParams/pushObj.go b/internal/push/mobpush/requestparams/pushObj.go similarity index 96% rename from internal/push/mobpush/requestParams/pushObj.go rename to internal/push/mobpush/requestparams/pushObj.go index 5fa9223da..b04d40d5a 100644 --- a/internal/push/mobpush/requestParams/pushObj.go +++ b/internal/push/mobpush/requestparams/pushObj.go @@ -1,4 +1,4 @@ -package requestParams +package requestparams type PushObj struct { Source interface{} `json:"source"` diff --git a/internal/push/mobpush/requestParams/pushTarget.go b/internal/push/mobpush/requestparams/pushTarget.go similarity index 92% rename from internal/push/mobpush/requestParams/pushTarget.go rename to internal/push/mobpush/requestparams/pushTarget.go index 3650d3a40..bd6a310e1 100644 --- a/internal/push/mobpush/requestParams/pushTarget.go +++ b/internal/push/mobpush/requestparams/pushTarget.go @@ -1,4 +1,4 @@ -package requestParams +package requestparams type PushTarget struct { Target interface{} `json:"target,omitempty"` diff --git a/internal/push/sdk/tpns-server-sdk-go/go/auth/auth.go b/internal/push/sdk/tpns-server-sdk-go/go/auth/auth.go deleted file mode 100644 index 5b8a486b0..000000000 --- a/internal/push/sdk/tpns-server-sdk-go/go/auth/auth.go +++ /dev/null @@ -1,62 +0,0 @@ -package auth - -import ( - "crypto/hmac" - "crypto/sha256" - "encoding/base64" - b64 "encoding/base64" - "encoding/hex" - "fmt" - "net/http" - "strconv" - "time" -) - -type Auther struct { - AccessID string - SecretKey string -} - -var UseSignAuthored = true - -func (a *Auther) Auth(req *http.Request, useSignAuthored bool, auth Auther, reqBody string) { - - if useSignAuthored { - now := time.Now() - timeStamp := now.Unix() - req.Header.Add("AccessId", auth.AccessID) - req.Header.Add("TimeStamp", strconv.Itoa(int(timeStamp))) - sign := GenSign(uint64(timeStamp), auth.AccessID, auth.SecretKey, reqBody) - req.Header.Add("Sign", sign) - } else { - author := makeAuthHeader(a.AccessID, a.SecretKey) - //log.Printf("author string:%v", author) - req.Header.Add("Authorization", author) - } - //req.Header.Add("Content-Type", "application/json") -} - -func makeAuthHeader(appID, secretKey string) string { - base64Str := base64.StdEncoding.EncodeToString( - []byte( - fmt.Sprintf("%s:%s", appID, secretKey), - ), - ) - return fmt.Sprintf("Basic %s", base64Str) -} - -func GenSign(timeStamp uint64, accessId string, secretKey, requestBody string) string { - signBody := strconv.Itoa(int(timeStamp)) + accessId + requestBody - // Create a new HMAC by defining the hash type and the key (as byte array) - h := hmac.New(sha256.New, []byte(secretKey)) - // Write Data to it - h.Write([]byte(signBody)) - - // Get result and encode as hexadecimal string - sha := hex.EncodeToString(h.Sum(nil)) - //fmt.Println() - //fmt.Println("timeStamp: " + strconv.Itoa(int(timeStamp)) + " accessID:" + accessId + " body:" + requestBody) - sEnc := b64.StdEncoding.EncodeToString([]byte(sha)) - //fmt.Println("final Result " + sEnc) - return sEnc -} diff --git a/internal/push/sdk/tpns-server-sdk-go/go/client/client.go b/internal/push/sdk/tpns-server-sdk-go/go/client/client.go deleted file mode 100644 index 848724402..000000000 --- a/internal/push/sdk/tpns-server-sdk-go/go/client/client.go +++ /dev/null @@ -1,18 +0,0 @@ -package client - -import ( - "net/http" - "time" -) - -func New() *http.Client { - return &http.Client{ - Transport: &http.Transport{ - MaxIdleConns: 100, - MaxIdleConnsPerHost: 100, - IdleConnTimeout: 30 * time.Second, - DisableCompression: false, - DisableKeepAlives: false, - }, - } -} diff --git a/internal/push/sdk/tpns-server-sdk-go/go/common/http_helper.go b/internal/push/sdk/tpns-server-sdk-go/go/common/http_helper.go deleted file mode 100644 index 6c010c4f4..000000000 --- a/internal/push/sdk/tpns-server-sdk-go/go/common/http_helper.go +++ /dev/null @@ -1,62 +0,0 @@ -package common - -import ( - tpns "Open_IM/internal/push/sdk/tpns-server-sdk-go/go" - "encoding/json" - "fmt" - "io/ioutil" - "net/http" -) - -func PushAndGetResult(pushReq *http.Request) { - c := &http.Client{} - rsp, err := c.Do(pushReq) - fmt.Println() - if err != nil { - //fmt.Printf("http err:%v", err) - return - } - defer rsp.Body.Close() - body, err := ioutil.ReadAll(rsp.Body) - //fmt.Printf("http ReadAll err:%v, body:%v ", err, string(body)) - if err != nil { - return - } - r := &tpns.CommonRsp{} - json.Unmarshal(body, r) - //fmt.Printf("push result: %+v", r) -} - -func UploadFile(req *http.Request) (int, error) { - client := &http.Client{} - resp, err := client.Do(req) - if err != nil { - return 0, err - } - - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return 0, err - } - - if resp.StatusCode != http.StatusOK { - return 0, fmt.Errorf("response error, status: %s, body: %s", resp.Status, string(body)) - } - - type uploadResponse struct { - RetCode int `json:"retCode"` - ErrMsg string `json:"errMsg"` - UploadId int `json:"uploadId"` - } - - var ur uploadResponse - if err := json.Unmarshal(body, &ur); err != nil { - return 0, err - } - - if ur.RetCode != 0 { - return 0, fmt.Errorf("response with %d:%s", ur.RetCode, ur.ErrMsg) - } - return ur.UploadId, nil -} diff --git a/internal/push/sdk/tpns-server-sdk-go/go/common/json_helper.go b/internal/push/sdk/tpns-server-sdk-go/go/common/json_helper.go deleted file mode 100644 index 368cfd843..000000000 --- a/internal/push/sdk/tpns-server-sdk-go/go/common/json_helper.go +++ /dev/null @@ -1,8 +0,0 @@ -package common - -import "encoding/json" - -func ToJson(v interface{}) string { - bs, _ := json.Marshal(v) - return string(bs) -} diff --git a/internal/push/sdk/tpns-server-sdk-go/go/def.go b/internal/push/sdk/tpns-server-sdk-go/go/def.go deleted file mode 100644 index 3e5d383e4..000000000 --- a/internal/push/sdk/tpns-server-sdk-go/go/def.go +++ /dev/null @@ -1,256 +0,0 @@ -package tpns - -type CommonRspEnv string - -const ( - // EnvProd - EnvProd CommonRspEnv = "product" - // EnvDev - EnvDev CommonRspEnv = "dev" -) - -type CommonRsp struct { - // TODO: doc this - Seq int64 `json:"seq"` - - PushID string `json:"push_id"` - - RetCode int `json:"ret_code"` - - Environment CommonRspEnv `json:"environment"` - - ErrMsg string `json:"err_msg,omitempty"` - - Result map[string]string `json:"result,omitempty"` -} - -type AudienceType string - -const ( - AdAll AudienceType = "all" - - AdTag AudienceType = "tag" - - AdToken AudienceType = "token" - - AdTokenList AudienceType = "token_list" - - AdAccount AudienceType = "account" - - AdAccountList AudienceType = "account_list" - - AdPackageAccount AudienceType = "package_account_push" - - AdPackageToken AudienceType = "package_token_push" -) - -// MessageType push API message_type -type MessageType string - -const ( - MsgTypeNotify MessageType = "notify" - - MsgTypeMessage MessageType = "message" -) - -type Request struct { - AudienceType AudienceType `json:"audience_type"` - - Message Message `json:"message"` - - MessageType MessageType `json:"message_type"` - - Tag []TagRule `json:"tag_rules,omitempty"` - - TokenList []string `json:"token_list,omitempty"` - - AccountList []string `json:"account_list,omitempty"` - - Environment CommonRspEnv `json:"environment,omitempty"` - - UploadId int `json:"upload_id,omitempty"` - - ExpireTime int `json:"expire_time,omitempty"` - - SendTime string `json:"send_time,omitempty"` - - MultiPkg bool `json:"multi_pkg,omitempty"` - - PlanId string `json:"plan_id,omitempty"` - - AccountPushType int `json:"account_push_type,omitempty"` - - PushSpeed int `json:"push_speed,omitempty"` - - CollapseId int `json:"collapse_id"` - - TPNSOnlinePushType int `json:"tpns_online_push_type"` - - ChannelRules []*ChannelDistributeRule `json:"channel_rules,omitempty"` - - LoopParam *PushLoopParam `json:"loop_param,omitempty"` - ForceCollapse bool `json:"force_collapse"` -} - -type TagListOperation string - -type ChannelDistributeRule struct { - ChannelName string `json:"channel"` - Disable bool `json:"disable"` -} - -type PushLoopParam struct { - StartDate string `json:"startDate"` - - EndDate string `json:"endDate"` - - LoopType PushLoopType `json:"loopType"` - - LoopDayIndexs []uint32 `json:"loopDayIndexs"` - - DayTimes []string `json:"dayTimes"` -} - -type PushLoopType int32 - -const ( - TagListOpAnd TagListOperation = "AND" - - TagListOpOr TagListOperation = "OR" -) - -type TagType string - -const ( - XGAutoProvince TagType = "xg_auto_province" - XGAutoActive TagType = "xg_auto_active" - XGUserDefine TagType = "xg_user_define" - XGAutoVersion TagType = "xg_auto_version" - XGAutoSdkversion TagType = "xg_auto_sdkversion" - XGAutoDevicebrand TagType = "xg_auto_devicebrand" - XGAutoDeviceversion TagType = "xg_auto_deviceversion" - XGAutoCountry TagType = "xg_auto_country" -) - -type TagRule struct { - TagItems []TagItem `json:"tag_items"` - - IsNot bool `json:"is_not"` - - Operator TagListOperation `json:"operator"` -} - -type TagItem struct { - // 标签 - Tags []string `json:"tags"` - IsNot bool `json:"is_not"` - TagsOperator TagListOperation `json:"tags_operator"` - ItemsOperator TagListOperation `json:"items_operator"` - TagType TagType `json:"tag_type"` -} - -type Message struct { - Title string `json:"title,omitempty"` - Content string `json:"content,omitempty"` - - AcceptTime []AcceptTimeItem `json:"accept_time,omitempty"` - - Android *AndroidParams `json:"android,omitempty"` - - IOS *IOSParams `json:"ios,omitempty"` - - ThreadId string `json:"thread_id,omitempty"` - - ThreadSumtext string `json:"thread_sumtext,omitempty"` - - XGMediaResources string `json:"xg_media_resources,omitempty"` - - XGMediaAudioResources string `json:"xg_media_audio_resources,omitempty"` -} - -type AcceptTimeItem struct { - Start HourAndMin `json:"start,omitempty"` - End HourAndMin `json:"end,omitempty"` -} - -type HourAndMin struct { - Hour string `json:"hour,omitempty"` - Min string `json:"min,omitempty"` -} - -type AndroidParams struct { - BuilderId *int `json:"builder_id,omitempty"` - - Ring *int `json:"ring,omitempty"` - - RingRaw string `json:"ring_raw,omitempty"` - - Vibrate *int `json:"vibrate,omitempty"` - - Lights *int `json:"lights,omitempty"` - - Clearable *int `json:"clearable,omitempty"` - - IconType *int `json:"icon_type"` - - IconRes string `json:"icon_res,omitempty"` - - StyleId *int `json:"style_id,omitempty"` - - SmallIcon string `json:"small_icon,omitempty"` - - Action *Action `json:"action,omitempty"` - - CustomContent string `json:"custom_content,omitempty"` - - ShowType *int `json:"show_type,omitempty"` - - NChId string `json:"n_ch_id,omitempty"` - - NChName string `json:"n_ch_name,omitempty"` - - HwChId string `json:"hw_ch_id,omitempty"` - - XmChId string `json:"xm_ch_id,omitempty"` - - OppoChId string `json:"oppo_ch_id,omitempty"` - - VivoChId string `json:"vivo_ch_id,omitempty"` - - BadgeType *int `json:"badge_type,omitempty"` - - IconColor *int `json:"icon_color,omitempty"` -} - -type Action struct { - ActionType *int `json:"action_type,omitempty"` - Activity string `json:"activity"` - AtyAttr AtyAttr `json:"aty_attr,omitempty"` - Intent string `json:"intent"` - Browser Browser `json:"browser,omitempty"` -} - -type Browser struct { - Url string `json:"url,omitempty"` - Confirm *int `json:"confirm,omitempty"` -} - -type AtyAttr struct { - AttrIf *int `json:"if,omitempty"` - Pf *int `json:"pf,omitempty"` -} - -type IOSParams struct { - Aps *Aps `json:"aps,omitempty"` - - CustomContent string `json:"custom_content,omitempty"` -} - -type Aps struct { - Alert map[string]string `json:"alert,omitempty"` - BadgeType *int `json:"badge_type,omitempty"` - Category string `json:"category,omitempty"` - ContentAvailableInt *int `json:"content-available,omitempty"` - MutableContent *int `json:"mutable-content,omitempty"` - Sound string `json:"sound,omitempty"` -} diff --git a/internal/push/sdk/tpns-server-sdk-go/go/req/req.go b/internal/push/sdk/tpns-server-sdk-go/go/req/req.go deleted file mode 100644 index 7afc07004..000000000 --- a/internal/push/sdk/tpns-server-sdk-go/go/req/req.go +++ /dev/null @@ -1,403 +0,0 @@ -package req - -import ( - tpns "Open_IM/internal/push/sdk/tpns-server-sdk-go/go" - "bytes" - "encoding/json" - "io" - "mime/multipart" - "net/http" - "os" - "path/filepath" -) - -var PushURL = "https://api.tpns.tencent.com/v3/push/app" - -//var PushURL = "https://test.api.tpns.tencent.com/v3/push/app" - -func URL(url string) { - PushURL = url -} - -type ReqOpt func(*tpns.Request) - -func NewPush(req *tpns.Request, opts ...ReqOpt) (*http.Request, string, error) { - return NewPushReq(req, opts...) -} - -func NewUploadFileRequest(host string, file string) (*http.Request, error) { - fp, err := os.Open(file) - if err != nil { - return nil, err - } - - defer fp.Close() - body := &bytes.Buffer{} - writer := multipart.NewWriter(body) - part, err := writer.CreateFormFile("file", filepath.Base(fp.Name())) - if err != nil { - return nil, err - } - - io.Copy(part, fp) - writer.Close() - url := host + "/v3/push/package/upload" - req, err := http.NewRequest("POST", url, body) - if err != nil { - return nil, err - } - req.Header.Add("Content-Type", writer.FormDataContentType()) - - return req, nil -} - -func NewSingleAccountPush( - message tpns.Message, - account string, - opts ...ReqOpt, -) (*http.Request, string, error) { - req := &tpns.Request{ - MessageType: tpns.MsgTypeNotify, - AudienceType: tpns.AdAccountList, - AccountList: []string{account}, - Message: message, - } - return NewPushReq(req, opts...) -} - -func NewListAccountPush( - accounts []string, message tpns.Message, - opts ...ReqOpt, -) (*http.Request, string, error) { - req := &tpns.Request{ - MessageType: tpns.MsgTypeNotify, - AudienceType: tpns.AdAccountList, - AccountList: accounts, - Message: message, - Environment: tpns.EnvDev, - } - return NewPushReq(req, opts...) -} - -func NewTokenPush( - tokens []string, message tpns.Message, - opts ...ReqOpt, -) (*http.Request, string, error) { - req := &tpns.Request{ - MessageType: tpns.MsgTypeNotify, - AudienceType: tpns.AdTokenList, - TokenList: tokens, - Message: message, - Environment: tpns.EnvProd, - } - //fmt.Printf("reqBody :%v", common.ToJson(req)) - //fmt.Println() - return NewPushReq(req, opts...) -} - -func NewTagsPush( - tagList []tpns.TagRule, message tpns.Message, - opts ...ReqOpt, -) (*http.Request, string, error) { - req := &tpns.Request{ - MessageType: tpns.MsgTypeNotify, - AudienceType: tpns.AdTag, - Tag: tagList, - Message: message, - } - //fmt.Printf("reqBody :%v", common.ToJson(req)) - //fmt.Println() - return NewPushReq(req, opts...) -} - -func NewAllPush( - message tpns.Message, - opts ...ReqOpt, -) (*http.Request, string, error) { - req := &tpns.Request{ - MessageType: tpns.MsgTypeNotify, - AudienceType: tpns.AdAll, - Message: message, - } - return NewPushReq(req, opts...) -} - -func NewAccountPackagePush( - message tpns.Message, - opts ...ReqOpt, -) (*http.Request, string, error) { - req := &tpns.Request{ - MessageType: tpns.MsgTypeNotify, - AudienceType: tpns.AdPackageAccount, - Message: message, - } - return NewPushReq(req, opts...) -} - -func NewTokenPackagePush( - message tpns.Message, - opts ...ReqOpt, -) (*http.Request, string, error) { - req := &tpns.Request{ - MessageType: tpns.MsgTypeNotify, - AudienceType: tpns.AdPackageToken, - Message: message, - } - return NewPushReq(req, opts...) -} - -func NewPushReq(req *tpns.Request, opts ...ReqOpt) (request *http.Request, reqBody string, err error) { - for _, opt := range opts { - opt(req) - } - bodyBytes, err := json.Marshal(req) - if err != nil { - return nil, "", err - } - reqBody = string(bodyBytes) - //fmt.Printf("NewPushReq req:%v", reqBody) - request, err = http.NewRequest("POST", PushURL, bytes.NewReader(bodyBytes)) - if err != nil { - return nil, "", err - } - request.Header.Add("Content-Type", "application/json") - return -} - -func EnvProd() ReqOpt { - return func(r *tpns.Request) { - r.Environment = tpns.EnvProd - } -} - -func EnvDev() ReqOpt { - return func(r *tpns.Request) { - r.Environment = tpns.EnvDev - } -} - -func Title(t string) ReqOpt { - return func(r *tpns.Request) { - r.Message.Title = t - if r.Message.IOS != nil { - if r.Message.IOS.Aps != nil { - r.Message.IOS.Aps.Alert["title"] = t - } else { - r.Message.IOS.Aps = &tpns.Aps{ - Alert: map[string]string{"title": t}, - } - } - } else { - r.Message.IOS = &tpns.IOSParams{ - Aps: &tpns.Aps{ - Alert: map[string]string{"title": t}, - }, - } - } - } -} - -func Content(c string) ReqOpt { - return func(r *tpns.Request) { - r.Message.Content = c - if r.Message.IOS != nil { - if r.Message.IOS.Aps != nil { - r.Message.IOS.Aps.Alert["body"] = c - } else { - r.Message.IOS.Aps = &tpns.Aps{ - Alert: map[string]string{"body": c}, - } - } - } else { - r.Message.IOS = &tpns.IOSParams{ - Aps: &tpns.Aps{ - Alert: map[string]string{"body": c}, - }, - } - } - } -} - -func Ring(ring *int) ReqOpt { - return func(r *tpns.Request) { - r.Message.Android.Ring = ring - } -} - -func RingRaw(rr string) ReqOpt { - return func(r *tpns.Request) { - r.Message.Android.RingRaw = rr - } -} - -func Vibrate(v *int) ReqOpt { - return func(r *tpns.Request) { - r.Message.Android.Vibrate = v - } -} - -func Lights(l *int) ReqOpt { - return func(r *tpns.Request) { - r.Message.Android.Lights = l - } -} - -func Clearable(c *int) ReqOpt { - return func(r *tpns.Request) { - r.Message.Android.Clearable = c - } -} - -func IconType(it *int) ReqOpt { - return func(r *tpns.Request) { - r.Message.Android.IconType = it - } -} - -func IconRes(ir string) ReqOpt { - return func(r *tpns.Request) { - r.Message.Android.IconRes = ir - } -} - -func AndroidCustomContent(ct string) ReqOpt { - return func(r *tpns.Request) { - r.Message.Android.CustomContent = ct - } -} - -func Aps(aps *tpns.Aps) ReqOpt { - return func(r *tpns.Request) { - r.Message.IOS.Aps = aps - } -} - -func AudienceType(at tpns.AudienceType) ReqOpt { - return func(r *tpns.Request) { - r.AudienceType = at - } -} - -func Message(m tpns.Message) ReqOpt { - return func(r *tpns.Request) { - r.Message = m - } -} - -func TokenList(tl []string) ReqOpt { - return func(r *tpns.Request) { - r.TokenList = tl - } -} - -func TokenListAdd(t string) ReqOpt { - return func(r *tpns.Request) { - if r.TokenList != nil { - r.TokenList = append(r.TokenList, t) - } else { - r.TokenList = []string{t} - } - } -} - -func AccountList(al []string) ReqOpt { - return func(r *tpns.Request) { - r.AccountList = al - } -} - -//ChannelDistributeRules -func AddChannelRules(ChannelRules []*tpns.ChannelDistributeRule) ReqOpt { - return func(r *tpns.Request) { - r.ChannelRules = ChannelRules - } -} - -//ChannelDistributeRules -func AddLoopParam(loopParam *tpns.PushLoopParam) ReqOpt { - return func(r *tpns.Request) { - r.LoopParam = loopParam - } -} - -func AccountListAdd(a string) ReqOpt { - return func(r *tpns.Request) { - if r.AccountList != nil { - r.AccountList = append(r.AccountList, a) - } else { - r.AccountList = []string{a} - } - } -} - -func MessageType(t tpns.MessageType) ReqOpt { - return func(r *tpns.Request) { - r.MessageType = t - } -} - -func AddMultiPkg(multipPkg bool) ReqOpt { - return func(r *tpns.Request) { - r.MultiPkg = multipPkg - } -} - -func AddForceCollapse(forceCollapse bool) ReqOpt { - return func(r *tpns.Request) { - r.ForceCollapse = forceCollapse - } -} - -func AddTPNSOnlinePushType(onlinePushType int) ReqOpt { - return func(r *tpns.Request) { - r.TPNSOnlinePushType = onlinePushType - } -} - -func AddCollapseId(collapseId int) ReqOpt { - return func(r *tpns.Request) { - r.CollapseId = collapseId - } -} - -func AddPushSpeed(pushSpeed int) ReqOpt { - return func(r *tpns.Request) { - r.PushSpeed = pushSpeed - } -} - -func AddAccountPushType(accountPushType int) ReqOpt { - return func(r *tpns.Request) { - r.AccountPushType = accountPushType - } -} - -func AddPlanId(planId string) ReqOpt { - return func(r *tpns.Request) { - r.PlanId = planId - } -} - -func AddSendTime(sendTime string) ReqOpt { - return func(r *tpns.Request) { - r.SendTime = sendTime - } -} - -func AddExpireTime(expireTime int) ReqOpt { - return func(r *tpns.Request) { - r.ExpireTime = expireTime - } -} - -func AddUploadId(UploadId int) ReqOpt { - return func(r *tpns.Request) { - r.UploadId = UploadId - } -} - -func AddEnvironment(Environment tpns.CommonRspEnv) ReqOpt { - return func(r *tpns.Request) { - r.Environment = Environment - } -} diff --git a/internal/rpc/admin_cms/admin_cms.go b/internal/rpc/admincms/admin_cms.go similarity index 99% rename from internal/rpc/admin_cms/admin_cms.go rename to internal/rpc/admincms/admin_cms.go index b171356e7..00043ae73 100644 --- a/internal/rpc/admin_cms/admin_cms.go +++ b/internal/rpc/admincms/admin_cms.go @@ -1,4 +1,4 @@ -package admin_cms +package admincms import ( "Open_IM/pkg/common/config" @@ -11,7 +11,7 @@ import ( "Open_IM/pkg/common/tokenverify" "Open_IM/pkg/common/tracelog" pbAdminCMS "Open_IM/pkg/proto/admin_cms" - common "Open_IM/pkg/proto/sdk_ws" + common "Open_IM/pkg/proto/sdkws" grpcPrometheus "github.com/grpc-ecosystem/go-grpc-prometheus" diff --git a/internal/rpc/fault_tolerant/conn.go b/internal/rpc/fault_tolerant/conn.go deleted file mode 100644 index 5ba212400..000000000 --- a/internal/rpc/fault_tolerant/conn.go +++ /dev/null @@ -1,96 +0,0 @@ -package fault_tolerant - -import ( - "Open_IM/pkg/common/config" - "Open_IM/pkg/common/log" - "Open_IM/pkg/common/middleware" - "Open_IM/pkg/utils" - "github.com/OpenIMSDK/getcdv3" - "google.golang.org/grpc" - "strings" -) - -func GetConfigConn(serviceName string, operationID string) *grpc.ClientConn { - rpcRegisterIP := config.Config.RpcRegisterIP - var err error - if config.Config.RpcRegisterIP == "" { - rpcRegisterIP, err = utils.GetLocalIP() - if err != nil { - log.Error(operationID, "GetLocalIP failed ", err.Error()) - return nil - } - } - - var configPortList []int - //1 - if config.Config.RpcRegisterName.OpenImUserName == serviceName { - configPortList = config.Config.RpcPort.OpenImUserPort - } - //2 - if config.Config.RpcRegisterName.OpenImFriendName == serviceName { - configPortList = config.Config.RpcPort.OpenImFriendPort - } - //3 - if config.Config.RpcRegisterName.OpenImMsgName == serviceName { - configPortList = config.Config.RpcPort.OpenImMessagePort - } - //4 - if config.Config.RpcRegisterName.OpenImPushName == serviceName { - configPortList = config.Config.RpcPort.OpenImPushPort - } - //5 - if config.Config.RpcRegisterName.OpenImRelayName == serviceName { - configPortList = config.Config.RpcPort.OpenImMessageGatewayPort - } - //6 - if config.Config.RpcRegisterName.OpenImGroupName == serviceName { - configPortList = config.Config.RpcPort.OpenImGroupPort - } - //7 - if config.Config.RpcRegisterName.OpenImAuthName == serviceName { - configPortList = config.Config.RpcPort.OpenImAuthPort - } - //10 - if config.Config.RpcRegisterName.OpenImOfficeName == serviceName { - configPortList = config.Config.RpcPort.OpenImOfficePort - } - //11 - if config.Config.RpcRegisterName.OpenImOrganizationName == serviceName { - configPortList = config.Config.RpcPort.OpenImOrganizationPort - } - //12 - if config.Config.RpcRegisterName.OpenImConversationName == serviceName { - configPortList = config.Config.RpcPort.OpenImConversationPort - } - //13 - if config.Config.RpcRegisterName.OpenImCacheName == serviceName { - configPortList = config.Config.RpcPort.OpenImCachePort - } - //14 - if config.Config.RpcRegisterName.OpenImRealTimeCommName == serviceName { - configPortList = config.Config.RpcPort.OpenImRealTimeCommPort - } - if len(configPortList) == 0 { - log.Error(operationID, "len(configPortList) == 0 ") - return nil - } - target := rpcRegisterIP + ":" + utils.Int32ToString(int32(configPortList[0])) - log.Info(operationID, "rpcRegisterIP ", rpcRegisterIP, " port ", configPortList, " grpc target: ", target, " serviceName: ", serviceName) - conn, err := grpc.Dial(target, grpc.WithInsecure(), grpc.WithUnaryInterceptor(middleware.RpcClientInterceptor)) - if err != nil { - log.Error(operationID, "grpc.Dail failed ", err.Error()) - return nil - } - log.NewDebug(operationID, utils.GetSelfFuncName(), serviceName, conn) - return conn -} - -func GetDefaultConn(serviceName string, operationID string) (*grpc.ClientConn, error) { - con := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), serviceName, operationID, config.Config.Etcd.UserName, config.Config.Etcd.Password) - if con != nil { - return con, nil - } - log.NewWarn(operationID, utils.GetSelfFuncName(), "conn is nil !!!!!", serviceName) - con = GetConfigConn(serviceName, operationID) - return con, nil -} diff --git a/internal/rpc/group/copy.go b/internal/rpc/group/copy.go index ba24f9109..6db7cc1e6 100644 --- a/internal/rpc/group/copy.go +++ b/internal/rpc/group/copy.go @@ -3,7 +3,7 @@ package group import ( "Open_IM/pkg/common/db/table/relation" pbGroup "Open_IM/pkg/proto/group" - open_im_sdk "Open_IM/pkg/proto/sdk_ws" + open_im_sdk "Open_IM/pkg/proto/sdkws" "time" ) diff --git a/internal/rpc/group/db_map.go b/internal/rpc/group/db_map.go index ebdf9a8f0..7942e6227 100644 --- a/internal/rpc/group/db_map.go +++ b/internal/rpc/group/db_map.go @@ -2,7 +2,7 @@ package group import ( pbGroup "Open_IM/pkg/proto/group" - open_im_sdk "Open_IM/pkg/proto/sdk_ws" + open_im_sdk "Open_IM/pkg/proto/sdkws" "time" ) diff --git a/internal/rpc/group/g.go b/internal/rpc/group/g.go index 48e5b03ab..db056ef63 100644 --- a/internal/rpc/group/g.go +++ b/internal/rpc/group/g.go @@ -4,7 +4,7 @@ import ( "Open_IM/pkg/common/constant" "Open_IM/pkg/common/tracelog" pbConversation "Open_IM/pkg/proto/conversation" - sdk_ws "Open_IM/pkg/proto/sdk_ws" + sdkws "Open_IM/pkg/proto/sdkws" "Open_IM/pkg/utils" "context" "errors" @@ -13,34 +13,34 @@ import ( "time" ) -func GetPublicUserInfoOne(ctx context.Context, userID string) (*sdk_ws.PublicUserInfo, error) { +func GetPublicUserInfoOne(ctx context.Context, userID string) (*sdkws.PublicUserInfo, error) { return nil, errors.New("todo") } -func GetUsersInfo(ctx context.Context, userIDs []string) ([]*sdk_ws.UserInfo, error) { +func GetUsersInfo(ctx context.Context, userIDs []string) ([]*sdkws.UserInfo, error) { return nil, errors.New("todo") } -func GetUserInfoMap(ctx context.Context, userIDs []string) (map[string]*sdk_ws.UserInfo, error) { +func GetUserInfoMap(ctx context.Context, userIDs []string) (map[string]*sdkws.UserInfo, error) { users, err := GetUsersInfo(ctx, userIDs) if err != nil { return nil, err } - return utils.SliceToMap(users, func(e *sdk_ws.UserInfo) string { + return utils.SliceToMap(users, func(e *sdkws.UserInfo) string { return e.UserID }), nil } -func GetPublicUserInfo(ctx context.Context, userIDs []string) ([]*sdk_ws.PublicUserInfo, error) { +func GetPublicUserInfo(ctx context.Context, userIDs []string) ([]*sdkws.PublicUserInfo, error) { return nil, errors.New("todo") } -func GetPublicUserInfoMap(ctx context.Context, userIDs []string) (map[string]*sdk_ws.PublicUserInfo, error) { +func GetPublicUserInfoMap(ctx context.Context, userIDs []string) (map[string]*sdkws.PublicUserInfo, error) { users, err := GetPublicUserInfo(ctx, userIDs) if err != nil { return nil, err } - return utils.SliceToMap(users, func(e *sdk_ws.PublicUserInfo) string { + return utils.SliceToMap(users, func(e *sdkws.PublicUserInfo) string { return e.UserID }), nil } diff --git a/internal/rpc/group/group.go b/internal/rpc/group/group.go index a24af9801..e827fd399 100644 --- a/internal/rpc/group/group.go +++ b/internal/rpc/group/group.go @@ -17,7 +17,7 @@ import ( "Open_IM/pkg/common/tracelog" discoveryRegistry "Open_IM/pkg/discoveryregistry" pbGroup "Open_IM/pkg/proto/group" - open_im_sdk "Open_IM/pkg/proto/sdk_ws" + open_im_sdk "Open_IM/pkg/proto/sdkws" "Open_IM/pkg/utils" "context" "fmt" diff --git a/internal/rpc/group/super_group.go b/internal/rpc/group/super_group.go index ebdab3723..fc8df467b 100644 --- a/internal/rpc/group/super_group.go +++ b/internal/rpc/group/super_group.go @@ -5,7 +5,7 @@ import ( "Open_IM/pkg/common/db/table/relation" "Open_IM/pkg/common/db/table/unrelation" pbGroup "Open_IM/pkg/proto/group" - sdk_ws "Open_IM/pkg/proto/sdk_ws" + sdkws "Open_IM/pkg/proto/sdkws" "Open_IM/pkg/utils" "context" "fmt" @@ -48,7 +48,7 @@ func (s *groupServer) GetJoinedSuperGroupList(ctx context.Context, req *pbGroup. superGroupMemberMap := utils.SliceToMapAny(superGroupMembers, func(e *unrelation.SuperGroupModel) (string, []string) { return e.GroupID, e.MemberIDs }) - resp.Groups = utils.Slice(joinSuperGroup.GroupIDs, func(groupID string) *sdk_ws.GroupInfo { + resp.Groups = utils.Slice(joinSuperGroup.GroupIDs, func(groupID string) *sdkws.GroupInfo { return DbToPbGroupInfo(groupMap[groupID], ownerMap[groupID].UserID, uint32(len(superGroupMemberMap))) }) return resp, nil @@ -77,7 +77,7 @@ func (s *groupServer) GetSuperGroupsInfo(ctx context.Context, req *pbGroup.GetSu ownerMap := utils.SliceToMap(owners, func(e *relation.GroupMemberModel) string { return e.GroupID }) - resp.GroupInfos = utils.Slice(groups, func(e *relation.GroupModel) *sdk_ws.GroupInfo { + resp.GroupInfos = utils.Slice(groups, func(e *relation.GroupModel) *sdkws.GroupInfo { return DbToPbGroupInfo(e, ownerMap[e.GroupID].UserID, uint32(len(superGroupMemberMap[e.GroupID]))) }) return resp, nil diff --git a/internal/rpc/msg/conversation_notification.go b/internal/rpc/msg/conversation_notification.go index a62d48d4e..2b90809e7 100644 --- a/internal/rpc/msg/conversation_notification.go +++ b/internal/rpc/msg/conversation_notification.go @@ -4,7 +4,7 @@ import ( "Open_IM/pkg/common/config" "Open_IM/pkg/common/constant" "Open_IM/pkg/common/log" - open_im_sdk "Open_IM/pkg/proto/sdk_ws" + open_im_sdk "Open_IM/pkg/proto/sdkws" "Open_IM/pkg/utils" "context" "github.com/golang/protobuf/jsonpb" diff --git a/internal/rpc/msg/del_msg.go b/internal/rpc/msg/del_msg.go index 7b92388fa..39559d00b 100644 --- a/internal/rpc/msg/del_msg.go +++ b/internal/rpc/msg/del_msg.go @@ -6,7 +6,7 @@ import ( "Open_IM/pkg/common/log" "Open_IM/pkg/common/tokenverify" "Open_IM/pkg/proto/msg" - common "Open_IM/pkg/proto/sdk_ws" + common "Open_IM/pkg/proto/sdkws" "Open_IM/pkg/utils" "context" "time" diff --git a/internal/rpc/msg/extend_msg.go b/internal/rpc/msg/extend_msg.go index a7ba9ddd1..2bb249650 100644 --- a/internal/rpc/msg/extend_msg.go +++ b/internal/rpc/msg/extend_msg.go @@ -5,7 +5,7 @@ import ( "Open_IM/pkg/common/db" "Open_IM/pkg/common/log" "Open_IM/pkg/proto/msg" - "Open_IM/pkg/proto/sdk_ws" + "Open_IM/pkg/proto/sdkws" "Open_IM/pkg/utils" "context" go_redis "github.com/go-redis/redis/v8" @@ -116,10 +116,10 @@ func (rpc *rpcChat) SetMessageReactionExtensions(ctx context.Context, req *msg.S } return &rResp, nil } - setValue := make(map[string]*server_api_params.KeyValue) + setValue := make(map[string]*sdkws.KeyValue) for k, v := range req.ReactionExtensionList { - temp := new(server_api_params.KeyValue) + temp := new(sdkws.KeyValue) if vv, ok := mongoValue.ReactionExtensionList[k]; ok { utils.CopyStructFields(temp, &vv) if v.LatestUpdateTime != vv.LatestUpdateTime { @@ -168,7 +168,7 @@ func (rpc *rpcChat) SetMessageReactionExtensions(ctx context.Context, req *msg.S setKeyResultInfo(&rResp, 200, err.Error(), req.ClientMsgID, k, v) continue } - temp := new(server_api_params.KeyValue) + temp := new(sdkws.KeyValue) utils.JsonStringToStruct(redisValue, temp) if v.LatestUpdateTime != temp.LatestUpdateTime { setKeyResultInfo(&rResp, 300, "message have update", req.ClientMsgID, k, temp) @@ -198,7 +198,7 @@ func (rpc *rpcChat) SetMessageReactionExtensions(ctx context.Context, req *msg.S return &rResp, nil } -func setKeyResultInfo(r *msg.SetMessageReactionExtensionsResp, errCode int32, errMsg, clientMsgID, typeKey string, keyValue *server_api_params.KeyValue) { +func setKeyResultInfo(r *msg.SetMessageReactionExtensionsResp, errCode int32, errMsg, clientMsgID, typeKey string, keyValue *sdkws.KeyValue) { temp := new(msg.KeyValueResp) temp.KeyValue = keyValue temp.ErrCode = errCode @@ -206,7 +206,7 @@ func setKeyResultInfo(r *msg.SetMessageReactionExtensionsResp, errCode int32, er r.Result = append(r.Result, temp) _ = db.DB.UnLockMessageTypeKey(clientMsgID, typeKey) } -func setDeleteKeyResultInfo(r *msg.DeleteMessageListReactionExtensionsResp, errCode int32, errMsg, clientMsgID, typeKey string, keyValue *server_api_params.KeyValue) { +func setDeleteKeyResultInfo(r *msg.DeleteMessageListReactionExtensionsResp, errCode int32, errMsg, clientMsgID, typeKey string, keyValue *sdkws.KeyValue) { temp := new(msg.KeyValueResp) temp.KeyValue = keyValue temp.ErrCode = errCode @@ -236,10 +236,10 @@ func (rpc *rpcChat) GetMessageListReactionExtensions(ctx context.Context, req *m rResp.SingleMessageResult = append(rResp.SingleMessageResult, &oneMessage) continue } - keyMap := make(map[string]*server_api_params.KeyValue) + keyMap := make(map[string]*sdkws.KeyValue) for k, v := range redisValue { - temp := new(server_api_params.KeyValue) + temp := new(sdkws.KeyValue) utils.JsonStringToStruct(v, temp) keyMap[k] = temp } @@ -253,10 +253,10 @@ func (rpc *rpcChat) GetMessageListReactionExtensions(ctx context.Context, req *m rResp.SingleMessageResult = append(rResp.SingleMessageResult, &oneMessage) continue } - keyMap := make(map[string]*server_api_params.KeyValue) + keyMap := make(map[string]*sdkws.KeyValue) for k, v := range mongoValue.ReactionExtensionList { - temp := new(server_api_params.KeyValue) + temp := new(sdkws.KeyValue) temp.TypeKey = v.TypeKey temp.Value = v.Value temp.LatestUpdateTime = v.LatestUpdateTime @@ -300,7 +300,7 @@ func (rpc *rpcChat) DeleteMessageReactionExtensions(ctx context.Context, req *ms } for _, v := range callbackResp.ResultReactionExtensionList { if v.ErrCode != 0 { - func(req *[]*server_api_params.KeyValue, typeKey string) { + func(req *[]*sdkws.KeyValue, typeKey string) { for i := 0; i < len(*req); i++ { if (*req)[i].TypeKey == typeKey { *req = append((*req)[:i], (*req)[i+1:]...) @@ -338,7 +338,7 @@ func (rpc *rpcChat) DeleteMessageReactionExtensions(ctx context.Context, req *ms setDeleteKeyResultInfo(&rResp, 200, err.Error(), req.ClientMsgID, v.TypeKey, v) continue } - temp := new(server_api_params.KeyValue) + temp := new(sdkws.KeyValue) utils.JsonStringToStruct(redisValue, temp) if v.LatestUpdateTime != temp.LatestUpdateTime { setDeleteKeyResultInfo(&rResp, 300, "message have update", req.ClientMsgID, v.TypeKey, temp) @@ -379,10 +379,10 @@ func (rpc *rpcChat) DeleteMessageReactionExtensions(ctx context.Context, req *ms } return &rResp, nil } - setValue := make(map[string]*server_api_params.KeyValue) + setValue := make(map[string]*sdkws.KeyValue) for _, v := range req.ReactionExtensionList { - temp := new(server_api_params.KeyValue) + temp := new(sdkws.KeyValue) if vv, ok := mongoValue.ReactionExtensionList[v.TypeKey]; ok { utils.CopyStructFields(temp, &vv) if v.LatestUpdateTime != vv.LatestUpdateTime { diff --git a/internal/rpc/msg/extend_msg.notification.go b/internal/rpc/msg/extend_msg.notification.go index 11ab90224..7f5fe30dd 100644 --- a/internal/rpc/msg/extend_msg.notification.go +++ b/internal/rpc/msg/extend_msg.notification.go @@ -7,7 +7,7 @@ import ( "Open_IM/pkg/common/log" "Open_IM/pkg/getcdv3" "Open_IM/pkg/proto/msg" - open_im_sdk "Open_IM/pkg/proto/sdk_ws" + open_im_sdk "Open_IM/pkg/proto/sdkws" "Open_IM/pkg/utils" "context" ) diff --git a/internal/rpc/msg/friend_notification.go b/internal/rpc/msg/friend_notification.go index a61cd6b57..684e277ed 100644 --- a/internal/rpc/msg/friend_notification.go +++ b/internal/rpc/msg/friend_notification.go @@ -7,7 +7,7 @@ import ( "Open_IM/pkg/common/log" "Open_IM/pkg/common/tracelog" pbFriend "Open_IM/pkg/proto/friend" - open_im_sdk "Open_IM/pkg/proto/sdk_ws" + open_im_sdk "Open_IM/pkg/proto/sdkws" "Open_IM/pkg/utils" "context" "github.com/golang/protobuf/jsonpb" diff --git a/internal/rpc/msg/group_notification.go b/internal/rpc/msg/group_notification.go index f73ea3415..83ffec01e 100644 --- a/internal/rpc/msg/group_notification.go +++ b/internal/rpc/msg/group_notification.go @@ -8,7 +8,7 @@ import ( "Open_IM/pkg/common/tokenverify" utils2 "Open_IM/pkg/common/utils" pbGroup "Open_IM/pkg/proto/group" - open_im_sdk "Open_IM/pkg/proto/sdk_ws" + open_im_sdk "Open_IM/pkg/proto/sdkws" "Open_IM/pkg/utils" "context" "github.com/golang/protobuf/jsonpb" diff --git a/internal/rpc/msg/msg_notification.go b/internal/rpc/msg/msg_notification.go index 8ecdafbff..212fc4ff9 100644 --- a/internal/rpc/msg/msg_notification.go +++ b/internal/rpc/msg/msg_notification.go @@ -3,7 +3,7 @@ package msg import ( "Open_IM/pkg/common/constant" "Open_IM/pkg/common/log" - open_im_sdk "Open_IM/pkg/proto/sdk_ws" + open_im_sdk "Open_IM/pkg/proto/sdkws" "Open_IM/pkg/utils" "github.com/golang/protobuf/jsonpb" "github.com/golang/protobuf/proto" diff --git a/internal/rpc/msg/organization_notification.go b/internal/rpc/msg/organization_notification.go deleted file mode 100644 index bcdeb13e8..000000000 --- a/internal/rpc/msg/organization_notification.go +++ /dev/null @@ -1,78 +0,0 @@ -package msg - -import ( - "Open_IM/pkg/common/config" - "Open_IM/pkg/common/constant" - imdb "Open_IM/pkg/common/db/mysql_model/im_mysql_model" - "Open_IM/pkg/common/log" - utils2 "Open_IM/pkg/common/utils" - open_im_sdk "Open_IM/pkg/proto/sdk_ws" - "Open_IM/pkg/utils" - - "github.com/golang/protobuf/jsonpb" - "github.com/golang/protobuf/proto" -) - -func OrganizationNotificationToAll(opUserID string, operationID string) { - err, userIDList := imdb.GetAllOrganizationUserID() - if err != nil { - log.Error(operationID, "GetAllOrganizationUserID failed ", err.Error()) - return - } - - tips := open_im_sdk.OrganizationChangedTips{OpUser: &open_im_sdk.UserInfo{}} - - user, err := imdb.GetUserByUserID(opUserID) - if err != nil { - log.NewError(operationID, "GetUserByUserID failed ", err.Error(), opUserID) - return - } - utils2.UserDBCopyOpenIM(tips.OpUser, user) - - for _, v := range userIDList { - log.Debug(operationID, "OrganizationNotification", opUserID, v, constant.OrganizationChangedNotification, &tips, operationID) - OrganizationNotification(config.Config.Manager.AppManagerUid[0], v, constant.OrganizationChangedNotification, &tips, operationID) - } -} - -func OrganizationNotification(opUserID string, recvUserID string, contentType int32, m proto.Message, operationID string) { - log.Info(operationID, utils.GetSelfFuncName(), "args: ", contentType, opUserID) - var err error - var tips open_im_sdk.TipsComm - tips.Detail, err = proto.Marshal(m) - if err != nil { - log.Error(operationID, "Marshal failed ", err.Error(), m.String()) - return - } - - marshaler := jsonpb.Marshaler{ - OrigName: true, - EnumsAsInts: false, - EmitDefaults: false, - } - - tips.JsonDetail, _ = marshaler.MarshalToString(m) - - switch contentType { - case constant.OrganizationChangedNotification: - tips.DefaultTips = "OrganizationChangedNotification" - - default: - log.Error(operationID, "contentType failed ", contentType) - return - } - - var n NotificationMsg - n.SendID = opUserID - n.RecvID = recvUserID - n.ContentType = contentType - n.SessionType = constant.SingleChatType - n.MsgFrom = constant.SysMsgType - n.OperationID = operationID - n.Content, err = proto.Marshal(&tips) - if err != nil { - log.Error(operationID, "Marshal failed ", err.Error(), tips.String()) - return - } - Notification(&n) -} diff --git a/internal/rpc/msg/pull_message.go b/internal/rpc/msg/pull_message.go index 83f2275f2..f7bf1552c 100644 --- a/internal/rpc/msg/pull_message.go +++ b/internal/rpc/msg/pull_message.go @@ -7,7 +7,7 @@ import ( commonDB "Open_IM/pkg/common/db" "Open_IM/pkg/common/log" - open_im_sdk "Open_IM/pkg/proto/sdk_ws" + open_im_sdk "Open_IM/pkg/proto/sdkws" promePkg "Open_IM/pkg/common/prometheus" ) diff --git a/internal/rpc/msg/rpcChat.go b/internal/rpc/msg/rpc_chat.go similarity index 100% rename from internal/rpc/msg/rpcChat.go rename to internal/rpc/msg/rpc_chat.go diff --git a/internal/rpc/msg/send_msg.go b/internal/rpc/msg/send_msg.go index 0e6017fab..c2571ea6f 100644 --- a/internal/rpc/msg/send_msg.go +++ b/internal/rpc/msg/send_msg.go @@ -13,7 +13,7 @@ import ( pbChat "Open_IM/pkg/proto/msg" pbPush "Open_IM/pkg/proto/push" pbRelay "Open_IM/pkg/proto/relay" - sdk_ws "Open_IM/pkg/proto/sdk_ws" + sdkws "Open_IM/pkg/proto/sdkws" "Open_IM/pkg/utils" "context" "errors" @@ -293,7 +293,7 @@ func (rpc *rpcChat) messageVerification(ctx context.Context, data *pbChat.SendMs } } -func (rpc *rpcChat) encapsulateMsgData(msg *sdk_ws.MsgData) { +func (rpc *rpcChat) encapsulateMsgData(msg *sdkws.MsgData) { msg.ServerMsgID = GetMsgID(msg.SendID) msg.SendTime = utils.GetCurrentTimestampByMill() switch msg.ContentType { @@ -449,8 +449,8 @@ func (rpc *rpcChat) SendMsg(ctx context.Context, pb *pbChat.SendMsgReq) (*pbChat var addUidList []string switch pb.MsgData.ContentType { case constant.MemberKickedNotification: - var tips sdk_ws.TipsComm - var memberKickedTips sdk_ws.MemberKickedTips + var tips sdkws.TipsComm + var memberKickedTips sdkws.MemberKickedTips err := proto.Unmarshal(pb.MsgData.Content, &tips) if err != nil { log.Error(pb.OperationID, "Unmarshal err", err.Error()) @@ -761,8 +761,8 @@ type NotificationMsg struct { func Notification(n *NotificationMsg) { var req pbChat.SendMsgReq - var msg sdk_ws.MsgData - var offlineInfo sdk_ws.OfflinePushInfo + var msg sdkws.MsgData + var offlineInfo sdkws.OfflinePushInfo var title, desc, ex string var pushSwitch, unReadCount bool var reliabilityLevel int @@ -975,14 +975,6 @@ func Notification(n *NotificationMsg) { reliabilityLevel = config.Config.Notification.GroupMemberInfoSet.Conversation.ReliabilityLevel unReadCount = config.Config.Notification.GroupMemberInfoSet.Conversation.UnreadCount - case constant.OrganizationChangedNotification: - pushSwitch = config.Config.Notification.OrganizationChanged.OfflinePush.PushSwitch - title = config.Config.Notification.OrganizationChanged.OfflinePush.Title - desc = config.Config.Notification.OrganizationChanged.OfflinePush.Desc - ex = config.Config.Notification.OrganizationChanged.OfflinePush.Ext - reliabilityLevel = config.Config.Notification.OrganizationChanged.Conversation.ReliabilityLevel - unReadCount = config.Config.Notification.OrganizationChanged.Conversation.UnreadCount - case constant.WorkMomentNotification: pushSwitch = config.Config.Notification.WorkMomentsNotification.OfflinePush.PushSwitch title = config.Config.Notification.WorkMomentsNotification.OfflinePush.Title @@ -1087,11 +1079,11 @@ func getOnlineAndOfflineUserIDList(memberList []string, m map[string][]string, o } func valueCopy(pb *pbChat.SendMsgReq) *pbChat.SendMsgReq { - offlinePushInfo := sdk_ws.OfflinePushInfo{} + offlinePushInfo := sdkws.OfflinePushInfo{} if pb.MsgData.OfflinePushInfo != nil { offlinePushInfo = *pb.MsgData.OfflinePushInfo } - msgData := sdk_ws.MsgData{} + msgData := sdkws.MsgData{} msgData = *pb.MsgData msgData.OfflinePushInfo = &offlinePushInfo @@ -1105,11 +1097,11 @@ func valueCopy(pb *pbChat.SendMsgReq) *pbChat.SendMsgReq { func (rpc *rpcChat) sendMsgToGroup(ctx context.Context, list []string, pb pbChat.SendMsgReq, status string, sendTag *bool, wg *sync.WaitGroup) { // log.Debug(pb.OperationID, "split userID ", list) - offlinePushInfo := sdk_ws.OfflinePushInfo{} + offlinePushInfo := sdkws.OfflinePushInfo{} if pb.MsgData.OfflinePushInfo != nil { offlinePushInfo = *pb.MsgData.OfflinePushInfo } - msgData := sdk_ws.MsgData{} + msgData := sdkws.MsgData{} msgData = *pb.MsgData msgData.OfflinePushInfo = &offlinePushInfo diff --git a/internal/rpc/msg/super_group_notification.go b/internal/rpc/msg/super_group_notification.go index f1966a586..062b44e47 100644 --- a/internal/rpc/msg/super_group_notification.go +++ b/internal/rpc/msg/super_group_notification.go @@ -3,7 +3,7 @@ package msg import ( "Open_IM/pkg/common/constant" "Open_IM/pkg/common/log" - //sdk "Open_IM/pkg/proto/sdk_ws" + //sdk "Open_IM/pkg/proto/sdkws" "Open_IM/pkg/utils" //"github.com/golang/protobuf/jsonpb" //"github.com/golang/protobuf/proto" diff --git a/internal/rpc/msg/tag_send_msg.go b/internal/rpc/msg/tag_send_msg.go index f355e4d39..d36473f96 100644 --- a/internal/rpc/msg/tag_send_msg.go +++ b/internal/rpc/msg/tag_send_msg.go @@ -7,7 +7,7 @@ import ( "Open_IM/pkg/common/log" "Open_IM/pkg/getcdv3" pbChat "Open_IM/pkg/proto/msg" - pbCommon "Open_IM/pkg/proto/sdk_ws" + pbCommon "Open_IM/pkg/proto/sdkws" "Open_IM/pkg/utils" "context" "strings" diff --git a/internal/rpc/msg/work_moments_notification.go b/internal/rpc/msg/work_moments_notification.go index a8ed67c93..8af00c217 100644 --- a/internal/rpc/msg/work_moments_notification.go +++ b/internal/rpc/msg/work_moments_notification.go @@ -4,7 +4,7 @@ import ( "Open_IM/pkg/common/constant" "Open_IM/pkg/common/log" pbOffice "Open_IM/pkg/proto/office" - sdk "Open_IM/pkg/proto/sdk_ws" + sdk "Open_IM/pkg/proto/sdkws" "Open_IM/pkg/utils" "github.com/golang/protobuf/jsonpb" "github.com/golang/protobuf/proto" diff --git a/internal/rpc/office/office.go b/internal/rpc/office/office.go index 583656e70..0f51d2c79 100644 --- a/internal/rpc/office/office.go +++ b/internal/rpc/office/office.go @@ -13,7 +13,7 @@ import ( promePkg "Open_IM/pkg/common/prometheus" pbCache "Open_IM/pkg/proto/cache" pbOffice "Open_IM/pkg/proto/office" - pbCommon "Open_IM/pkg/proto/sdk_ws" + pbCommon "Open_IM/pkg/proto/sdkws" "Open_IM/pkg/utils" "context" "github.com/OpenIMSDK/getcdv3" diff --git a/internal/rpc/user/user.go b/internal/rpc/user/user.go index fee3af9f0..bac7af32d 100644 --- a/internal/rpc/user/user.go +++ b/internal/rpc/user/user.go @@ -13,7 +13,7 @@ import ( promePkg "Open_IM/pkg/common/prometheus" "Open_IM/pkg/common/tokenverify" "Open_IM/pkg/common/tracelog" - server_api_params "Open_IM/pkg/proto/sdk_ws" + sdkws "Open_IM/pkg/proto/sdkws" pbUser "Open_IM/pkg/proto/user" "Open_IM/pkg/utils" "context" @@ -125,7 +125,7 @@ func (s *userServer) SetGroupMemberFaceURL(ctx context.Context, faceURL string, } // 获取加入的群成员信息 -func (s *userServer) GetJoinedGroupMembers(ctx context.Context, userID string) (members []*server_api_params.GroupMemberFullInfo, err error) { +func (s *userServer) GetJoinedGroupMembers(ctx context.Context, userID string) (members []*sdkws.GroupMemberFullInfo, err error) { return } @@ -143,7 +143,7 @@ func (s *userServer) GetDesignateUsers(ctx context.Context, req *pbUser.GetDesig return resp, nil } -func (s *userServer) GetAllPageFriends(ctx context.Context, ownerUserID string) (resp []*server_api_params.FriendInfo, err error) { +func (s *userServer) GetAllPageFriends(ctx context.Context, ownerUserID string) (resp []*sdkws.FriendInfo, err error) { return } @@ -250,7 +250,7 @@ func (s *userServer) GetPaginationUsers(ctx context.Context, req *pbUser.GetPagi // ok func (s *userServer) UserRegister(ctx context.Context, req *pbUser.UserRegisterReq) (resp *pbUser.UserRegisterResp, err error) { resp = &pbUser.UserRegisterResp{} - if utils.DuplicateAny(req.Users, func(e *server_api_params.UserInfo) string { return e.UserID }) { + if utils.DuplicateAny(req.Users, func(e *sdkws.UserInfo) string { return e.UserID }) { return nil, constant.ErrArgs.Wrap("userID repeated") } userIDs := make([]string, 0) diff --git a/pkg/apistruct/client_init.go b/pkg/apistruct/client_init.go deleted file mode 100644 index 17f85ffa2..000000000 --- a/pkg/apistruct/client_init.go +++ /dev/null @@ -1,21 +0,0 @@ -package apistruct - -type SetClientInitConfigReq struct { - OperationID string `json:"operationID" binding:"required"` - DiscoverPageURL *string `json:"discoverPageURL"` -} - -type SetClientInitConfigResp struct { - CommResp -} - -type GetClientInitConfigReq struct { - OperationID string `json:"operationID" binding:"required"` -} - -type GetClientInitConfigResp struct { - CommResp - Data struct { - DiscoverPageURL string `json:"discoverPageURL"` - } `json:"data"` -} diff --git a/pkg/apistruct/common.go b/pkg/apistruct/common.go index 66c2af78a..c5adee56a 100644 --- a/pkg/apistruct/common.go +++ b/pkg/apistruct/common.go @@ -4,8 +4,3 @@ type RequestPagination struct { PageNumber int `json:"pageNumber" binding:"required"` ShowNumber int `json:"showNumber" binding:"required"` } - -type ResponsePagination struct { - CurrentPage int `json:"currentPage"` - ShowNumber int `json:"showNumber"` -} diff --git a/pkg/apistruct/group.go b/pkg/apistruct/group.go index e799204fc..bb41192c1 100644 --- a/pkg/apistruct/group.go +++ b/pkg/apistruct/group.go @@ -1,7 +1,7 @@ package apistruct import ( - open_im_sdk "Open_IM/pkg/proto/sdk_ws" + open_im_sdk "Open_IM/pkg/proto/sdkws" ) type CommResp struct { diff --git a/pkg/apistruct/manage.go b/pkg/apistruct/manage.go index e6bc43d08..70afe4ad6 100644 --- a/pkg/apistruct/manage.go +++ b/pkg/apistruct/manage.go @@ -2,7 +2,7 @@ package apistruct import ( pbRelay "Open_IM/pkg/proto/relay" - server_api_params "Open_IM/pkg/proto/sdk_ws" + sdkws "Open_IM/pkg/proto/sdkws" ) type DeleteUsersReq struct { @@ -46,12 +46,12 @@ type ManagementSendMsg struct { SenderFaceURL string `json:"senderFaceURL" ` SenderPlatformID int32 `json:"senderPlatformID"` //ForceList []string `json:"forceList" ` - Content map[string]interface{} `json:"content" binding:"required" swaggerignore:"true"` - ContentType int32 `json:"contentType" binding:"required"` - SessionType int32 `json:"sessionType" binding:"required"` - IsOnlineOnly bool `json:"isOnlineOnly"` - NotOfflinePush bool `json:"notOfflinePush"` - OfflinePushInfo *server_api_params.OfflinePushInfo `json:"offlinePushInfo"` + Content map[string]interface{} `json:"content" binding:"required" swaggerignore:"true"` + ContentType int32 `json:"contentType" binding:"required"` + SessionType int32 `json:"sessionType" binding:"required"` + IsOnlineOnly bool `json:"isOnlineOnly"` + NotOfflinePush bool `json:"notOfflinePush"` + OfflinePushInfo *sdkws.OfflinePushInfo `json:"offlinePushInfo"` } type ManagementSendMsgReq struct { @@ -61,7 +61,7 @@ type ManagementSendMsgReq struct { type ManagementSendMsgResp struct { CommResp - ResultList server_api_params.UserSendMsgResp `json:"data"` + ResultList sdkws.UserSendMsgResp `json:"data"` } type ManagementBatchSendMsgReq struct { diff --git a/pkg/apistruct/msg.go b/pkg/apistruct/msg.go index 962c8ca02..f6f110e23 100644 --- a/pkg/apistruct/msg.go +++ b/pkg/apistruct/msg.go @@ -2,7 +2,7 @@ package apistruct import ( "Open_IM/pkg/proto/msg" - sdk_ws "Open_IM/pkg/proto/sdk_ws" + sdkws "Open_IM/pkg/proto/sdkws" ) type DelMsgReq struct { @@ -54,16 +54,16 @@ type SetMsgMinSeqResp struct { } type ModifyMessageReactionExtensionsReq struct { - OperationID string `json:"operationID" binding:"required"` - SourceID string `json:"sourceID" binding:"required"` - SessionType int32 `json:"sessionType" binding:"required"` - ReactionExtensionList map[string]*sdk_ws.KeyValue `json:"reactionExtensionList,omitempty" binding:"required"` - ClientMsgID string `json:"clientMsgID" binding:"required"` - Ex *string `json:"ex"` - AttachedInfo *string `json:"attachedInfo"` - IsReact bool `json:"isReact"` - IsExternalExtensions bool `json:"isExternalExtensions"` - MsgFirstModifyTime int64 `json:"msgFirstModifyTime"` + OperationID string `json:"operationID" binding:"required"` + SourceID string `json:"sourceID" binding:"required"` + SessionType int32 `json:"sessionType" binding:"required"` + ReactionExtensionList map[string]*sdkws.KeyValue `json:"reactionExtensionList,omitempty" binding:"required"` + ClientMsgID string `json:"clientMsgID" binding:"required"` + Ex *string `json:"ex"` + AttachedInfo *string `json:"attachedInfo"` + IsReact bool `json:"isReact"` + IsExternalExtensions bool `json:"isExternalExtensions"` + MsgFirstModifyTime int64 `json:"msgFirstModifyTime"` } type ModifyMessageReactionExtensionsResp struct { @@ -106,13 +106,13 @@ type AddMessageReactionExtensionsReq ModifyMessageReactionExtensionsReq type AddMessageReactionExtensionsResp ModifyMessageReactionExtensionsResp type DeleteMessageReactionExtensionsReq struct { - OperationID string `json:"operationID" binding:"required"` - SourceID string `json:"sourceID" binding:"required"` - SessionType int32 `json:"sessionType" binding:"required"` - ClientMsgID string `json:"clientMsgID" binding:"required"` - IsExternalExtensions bool `json:"isExternalExtensions"` - MsgFirstModifyTime int64 `json:"msgFirstModifyTime" binding:"required"` - ReactionExtensionList []*sdk_ws.KeyValue `json:"reactionExtensionList" binding:"required"` + OperationID string `json:"operationID" binding:"required"` + SourceID string `json:"sourceID" binding:"required"` + SessionType int32 `json:"sessionType" binding:"required"` + ClientMsgID string `json:"clientMsgID" binding:"required"` + IsExternalExtensions bool `json:"isExternalExtensions"` + MsgFirstModifyTime int64 `json:"msgFirstModifyTime" binding:"required"` + ReactionExtensionList []*sdkws.KeyValue `json:"reactionExtensionList" binding:"required"` } type DeleteMessageReactionExtensionsResp struct { @@ -121,21 +121,21 @@ type DeleteMessageReactionExtensionsResp struct { } type ReactionMessageModifierNotification struct { - SourceID string `json:"sourceID" binding:"required"` - OpUserID string `json:"opUserID" binding:"required"` - SessionType int32 `json:"sessionType" binding:"required"` - SuccessReactionExtensionList map[string]*sdk_ws.KeyValue `json:"reactionExtensionList,omitempty" binding:"required"` - ClientMsgID string `json:"clientMsgID" binding:"required"` - IsReact bool `json:"isReact"` - IsExternalExtensions bool `json:"isExternalExtensions"` - MsgFirstModifyTime int64 `json:"msgFirstModifyTime"` + SourceID string `json:"sourceID" binding:"required"` + OpUserID string `json:"opUserID" binding:"required"` + SessionType int32 `json:"sessionType" binding:"required"` + SuccessReactionExtensionList map[string]*sdkws.KeyValue `json:"reactionExtensionList,omitempty" binding:"required"` + ClientMsgID string `json:"clientMsgID" binding:"required"` + IsReact bool `json:"isReact"` + IsExternalExtensions bool `json:"isExternalExtensions"` + MsgFirstModifyTime int64 `json:"msgFirstModifyTime"` } type ReactionMessageDeleteNotification struct { - SourceID string `json:"sourceID" binding:"required"` - OpUserID string `json:"opUserID" binding:"required"` - SessionType int32 `json:"sessionType" binding:"required"` - SuccessReactionExtensionList map[string]*sdk_ws.KeyValue `json:"reactionExtensionList,omitempty" binding:"required"` - ClientMsgID string `json:"clientMsgID" binding:"required"` - MsgFirstModifyTime int64 `json:"msgFirstModifyTime"` + SourceID string `json:"sourceID" binding:"required"` + OpUserID string `json:"opUserID" binding:"required"` + SessionType int32 `json:"sessionType" binding:"required"` + SuccessReactionExtensionList map[string]*sdkws.KeyValue `json:"reactionExtensionList,omitempty" binding:"required"` + ClientMsgID string `json:"clientMsgID" binding:"required"` + MsgFirstModifyTime int64 `json:"msgFirstModifyTime"` } diff --git a/pkg/apistruct/organization.go b/pkg/apistruct/organization.go deleted file mode 100644 index a3aed68da..000000000 --- a/pkg/apistruct/organization.go +++ /dev/null @@ -1,121 +0,0 @@ -package apistruct - -import open_im_sdk "Open_IM/pkg/proto/sdk_ws" - -type CreateDepartmentReq struct { - *open_im_sdk.Department - OperationID string `json:"operationID" binding:"required"` -} -type CreateDepartmentResp struct { - CommResp - Department *open_im_sdk.Department `json:"-"` - Data map[string]interface{} `json:"data" swaggerignore:"true"` -} - -type UpdateDepartmentReq struct { - *open_im_sdk.Department - DepartmentID string `json:"departmentID" binding:"required"` - OperationID string `json:"operationID" binding:"required"` -} -type UpdateDepartmentResp struct { - CommResp -} - -type GetSubDepartmentReq struct { - OperationID string `json:"operationID" binding:"required"` - DepartmentID string `json:"departmentID" binding:"required"` -} -type GetSubDepartmentResp struct { - CommResp - DepartmentList []*open_im_sdk.Department `json:"-"` - Data []map[string]interface{} `json:"data" swaggerignore:"true"` -} - -type DeleteDepartmentReq struct { - OperationID string `json:"operationID" binding:"required"` - DepartmentID string `json:"departmentID" binding:"required"` -} -type DeleteDepartmentResp struct { - CommResp -} - -type CreateOrganizationUserReq struct { - OperationID string `json:"operationID" binding:"required"` - *open_im_sdk.OrganizationUser -} -type CreateOrganizationUserResp struct { - CommResp -} - -type UpdateOrganizationUserReq struct { - OperationID string `json:"operationID" binding:"required"` - *open_im_sdk.OrganizationUser -} -type UpdateOrganizationUserResp struct { - CommResp -} - -type CreateDepartmentMemberReq struct { - OperationID string `json:"operationID" binding:"required"` - *open_im_sdk.DepartmentMember -} - -type CreateDepartmentMemberResp struct { - CommResp -} - -type GetUserInDepartmentReq struct { - UserID string `json:"userID" binding:"required"` - OperationID string `json:"operationID" binding:"required"` -} -type GetUserInDepartmentResp struct { - CommResp - UserInDepartment *open_im_sdk.UserInDepartment `json:"-"` - Data map[string]interface{} `json:"data" swaggerignore:"true"` -} - -type UpdateUserInDepartmentReq struct { - OperationID string `json:"operationID" binding:"required"` - *open_im_sdk.DepartmentMember -} -type UpdateUserInDepartmentResp struct { - CommResp -} - -type DeleteOrganizationUserReq struct { - UserID string `json:"userID" binding:"required"` - OperationID string `json:"operationID" binding:"required"` -} -type DeleteOrganizationUserResp struct { - CommResp -} - -type GetDepartmentMemberReq struct { - DepartmentID string `json:"departmentID" binding:"required"` - OperationID string `json:"operationID" binding:"required"` -} -type GetDepartmentMemberResp struct { - CommResp - UserInDepartmentList []*open_im_sdk.UserDepartmentMember `json:"-"` - Data []map[string]interface{} `json:"data" swaggerignore:"true"` -} - -type DeleteUserInDepartmentReq struct { - DepartmentID string `json:"departmentID" binding:"required"` - UserID string `json:"userID" binding:"required"` - OperationID string `json:"operationID" binding:"required"` -} -type DeleteUserInDepartmentResp struct { - CommResp -} - -type GetUserInOrganizationReq struct { - OperationID string `json:"operationID" binding:"required"` - UserIDList []string `json:"userIDList" binding:"required"` -} - -type GetUserInOrganizationResp struct { - CommResp - OrganizationUserList []*open_im_sdk.OrganizationUser `json:"-"` - Data []map[string]interface{} `json:"data" swaggerignore:"true"` -} diff --git a/pkg/apistruct/public.go b/pkg/apistruct/public.go index 9bb0c2bf4..e943a4af1 100644 --- a/pkg/apistruct/public.go +++ b/pkg/apistruct/public.go @@ -1,11 +1,5 @@ package apistruct -import ( - "net/http" - - "github.com/gin-gonic/gin" -) - type ApiUserInfo struct { UserID string `json:"userID" binding:"required,min=1,max=64" swaggo:"true,用户ID,"` Nickname string `json:"nickname" binding:"omitempty,min=1,max=64" swaggo:"true,my id,19"` @@ -22,9 +16,3 @@ type GroupAddMemberInfo struct { UserID string `json:"userID" binding:"required"` RoleLevel int32 `json:"roleLevel" binding:"required,oneof= 1 3"` } - -func SetErrCodeMsg(c *gin.Context, status int) *CommResp { - resp := CommResp{ErrCode: int32(status), ErrMsg: http.StatusText(status)} - c.JSON(status, resp) - return &resp -} diff --git a/pkg/apistruct/swagger_example.go b/pkg/apistruct/swagger_example.go deleted file mode 100644 index bc16c0c9e..000000000 --- a/pkg/apistruct/swagger_example.go +++ /dev/null @@ -1,11 +0,0 @@ -package apistruct - -type Swagger400Resp struct { - ErrCode int32 `json:"errCode" example:"400"` - ErrMsg string `json:"errMsg" example:"err msg"` -} - -type Swagger500Resp struct { - ErrCode int32 `json:"errCode" example:"500"` - ErrMsg string `json:"errMsg" example:"err msg"` -} diff --git a/pkg/apistruct/user.go b/pkg/apistruct/user.go index 5e9d642aa..b2c097dee 100644 --- a/pkg/apistruct/user.go +++ b/pkg/apistruct/user.go @@ -1,7 +1,7 @@ package apistruct import ( - open_im_sdk "Open_IM/pkg/proto/sdk_ws" + open_im_sdk "Open_IM/pkg/proto/sdkws" ) type GetUsersInfoReq struct { diff --git a/pkg/callbackstruct/group.go b/pkg/callbackstruct/group.go index 518f65b09..e504151c1 100644 --- a/pkg/callbackstruct/group.go +++ b/pkg/callbackstruct/group.go @@ -2,7 +2,7 @@ package callbackstruct import ( "Open_IM/pkg/proto/group" - common "Open_IM/pkg/proto/sdk_ws" + common "Open_IM/pkg/proto/sdkws" ) type CallbackBeforeCreateGroupReq struct { diff --git a/pkg/callbackstruct/message.go b/pkg/callbackstruct/message.go index eedfe5cbb..efb26f4a3 100644 --- a/pkg/callbackstruct/message.go +++ b/pkg/callbackstruct/message.go @@ -2,7 +2,7 @@ package callbackstruct import ( "Open_IM/pkg/proto/msg" - sdk_ws "Open_IM/pkg/proto/sdk_ws" + sdkws "Open_IM/pkg/proto/sdkws" ) type CallbackBeforeSendSingleMsgReq struct { @@ -47,36 +47,36 @@ type CallbackMsgModifyCommandReq struct { type CallbackMsgModifyCommandResp struct { *CommonCallbackResp - Content *string `json:"content"` - RecvID *string `json:"recvID"` - GroupID *string `json:"groupID"` - ClientMsgID *string `json:"clientMsgID"` - ServerMsgID *string `json:"serverMsgID"` - SenderPlatformID *int32 `json:"senderPlatformID"` - SenderNickname *string `json:"senderNickname"` - SenderFaceURL *string `json:"senderFaceURL"` - SessionType *int32 `json:"sessionType"` - MsgFrom *int32 `json:"msgFrom"` - ContentType *int32 `json:"contentType"` - Status *int32 `json:"status"` - Options *map[string]bool `json:"options"` - OfflinePushInfo *sdk_ws.OfflinePushInfo `json:"offlinePushInfo"` - AtUserIDList *[]string `json:"atUserIDList"` - MsgDataList *[]byte `json:"msgDataList"` - AttachedInfo *string `json:"attachedInfo"` - Ex *string `json:"ex"` + Content *string `json:"content"` + RecvID *string `json:"recvID"` + GroupID *string `json:"groupID"` + ClientMsgID *string `json:"clientMsgID"` + ServerMsgID *string `json:"serverMsgID"` + SenderPlatformID *int32 `json:"senderPlatformID"` + SenderNickname *string `json:"senderNickname"` + SenderFaceURL *string `json:"senderFaceURL"` + SessionType *int32 `json:"sessionType"` + MsgFrom *int32 `json:"msgFrom"` + ContentType *int32 `json:"contentType"` + Status *int32 `json:"status"` + Options *map[string]bool `json:"options"` + OfflinePushInfo *sdkws.OfflinePushInfo `json:"offlinePushInfo"` + AtUserIDList *[]string `json:"atUserIDList"` + MsgDataList *[]byte `json:"msgDataList"` + AttachedInfo *string `json:"attachedInfo"` + Ex *string `json:"ex"` } type CallbackBeforeSetMessageReactionExtReq struct { - OperationID string `json:"operationID"` - CallbackCommand string `json:"callbackCommand"` - SourceID string `json:"sourceID"` - OpUserID string `json:"opUserID"` - SessionType int32 `json:"sessionType"` - ReactionExtensionList map[string]*sdk_ws.KeyValue `json:"reactionExtensionList"` - ClientMsgID string `json:"clientMsgID"` - IsReact bool `json:"isReact"` - IsExternalExtensions bool `json:"isExternalExtensions"` - MsgFirstModifyTime int64 `json:"msgFirstModifyTime"` + OperationID string `json:"operationID"` + CallbackCommand string `json:"callbackCommand"` + SourceID string `json:"sourceID"` + OpUserID string `json:"opUserID"` + SessionType int32 `json:"sessionType"` + ReactionExtensionList map[string]*sdkws.KeyValue `json:"reactionExtensionList"` + ClientMsgID string `json:"clientMsgID"` + IsReact bool `json:"isReact"` + IsExternalExtensions bool `json:"isExternalExtensions"` + MsgFirstModifyTime int64 `json:"msgFirstModifyTime"` } type CallbackBeforeSetMessageReactionExtResp struct { *CommonCallbackResp @@ -84,15 +84,15 @@ type CallbackBeforeSetMessageReactionExtResp struct { MsgFirstModifyTime int64 `json:"msgFirstModifyTime"` } type CallbackDeleteMessageReactionExtReq struct { - OperationID string `json:"operationID"` - CallbackCommand string `json:"callbackCommand"` - SourceID string `json:"sourceID"` - OpUserID string `json:"opUserID"` - SessionType int32 `json:"sessionType"` - ReactionExtensionList []*sdk_ws.KeyValue `json:"reactionExtensionList"` - ClientMsgID string `json:"clientMsgID"` - IsExternalExtensions bool `json:"isExternalExtensions"` - MsgFirstModifyTime int64 `json:"msgFirstModifyTime"` + OperationID string `json:"operationID"` + CallbackCommand string `json:"callbackCommand"` + SourceID string `json:"sourceID"` + OpUserID string `json:"opUserID"` + SessionType int32 `json:"sessionType"` + ReactionExtensionList []*sdkws.KeyValue `json:"reactionExtensionList"` + ClientMsgID string `json:"clientMsgID"` + IsExternalExtensions bool `json:"isExternalExtensions"` + MsgFirstModifyTime int64 `json:"msgFirstModifyTime"` } type CallbackDeleteMessageReactionExtResp struct { *CommonCallbackResp diff --git a/pkg/callbackstruct/push.go b/pkg/callbackstruct/push.go index a35fcbb27..483a2dffb 100644 --- a/pkg/callbackstruct/push.go +++ b/pkg/callbackstruct/push.go @@ -1,6 +1,6 @@ package callbackstruct -import common "Open_IM/pkg/proto/sdk_ws" +import common "Open_IM/pkg/proto/sdkws" type CallbackBeforePushReq struct { UserStatusBatchCallbackReq diff --git a/pkg/cmsstruct/admin.go b/pkg/cmsstruct/admin.go index 26362d72f..169d790fc 100644 --- a/pkg/cmsstruct/admin.go +++ b/pkg/cmsstruct/admin.go @@ -2,7 +2,7 @@ package cmsstruct import ( "Open_IM/pkg/api_struct" - server_api_params "Open_IM/pkg/proto/sdk_ws" + sdkws "Open_IM/pkg/proto/sdkws" ) type AdminLoginRequest struct { @@ -51,6 +51,6 @@ type GetUserRegisterAddFriendIDListRequest struct { } type GetUserRegisterAddFriendIDListResponse struct { - Users []*server_api_params.UserInfo `json:"users"` + Users []*sdkws.UserInfo `json:"users"` apistruct.ResponsePagination } diff --git a/pkg/cmsstruct/message_cms.go b/pkg/cmsstruct/message_cms.go index 3e5556012..9f1480fc8 100644 --- a/pkg/cmsstruct/message_cms.go +++ b/pkg/cmsstruct/message_cms.go @@ -1,7 +1,7 @@ package cmsstruct import ( - pbCommon "Open_IM/pkg/proto/sdk_ws" + pbCommon "Open_IM/pkg/proto/sdkws" ) type GetChatLogsReq struct { diff --git a/pkg/common/config/config.go b/pkg/common/config/config.go index 647887063..f98855107 100644 --- a/pkg/common/config/config.go +++ b/pkg/common/config/config.go @@ -133,7 +133,6 @@ type config struct { OpenImPushPort []int `yaml:"openImPushPort"` OpenImAdminCmsPort []int `yaml:"openImAdminCmsPort"` OpenImOfficePort []int `yaml:"openImOfficePort"` - OpenImOrganizationPort []int `yaml:"openImOrganizationPort"` OpenImConversationPort []int `yaml:"openImConversationPort"` OpenImCachePort []int `yaml:"openImCachePort"` OpenImRealTimeCommPort []int `yaml:"openImRealTimeCommPort"` @@ -149,7 +148,6 @@ type config struct { OpenImAuthName string `yaml:"openImAuthName"` OpenImAdminCMSName string `yaml:"openImAdminCMSName"` OpenImOfficeName string `yaml:"openImOfficeName"` - OpenImOrganizationName string `yaml:"openImOrganizationName"` OpenImConversationName string `yaml:"openImConversationName"` OpenImCacheName string `yaml:"openImCacheName"` OpenImRealTimeCommName string `yaml:"openImRealTimeCommName"` @@ -404,11 +402,6 @@ type config struct { OfflinePush POfflinePush `yaml:"offlinePush"` DefaultTips PDefaultTips `yaml:"defaultTips"` } `yaml:"groupMemberSetToOrdinaryUser"` - OrganizationChanged struct { - Conversation PConversation `yaml:"conversation"` - OfflinePush POfflinePush `yaml:"offlinePush"` - DefaultTips PDefaultTips `yaml:"defaultTips"` - } `yaml:"organizationChanged"` ////////////////////////user/////////////////////// UserInfoUpdated struct { @@ -496,44 +489,7 @@ type config struct { } `yaml:"offlinePush"` } `yaml:"signal"` } - Demo struct { - Port []int `yaml:"openImDemoPort"` - ListenIP string `yaml:"listenIP"` - AliSMSVerify struct { - AccessKeyID string `yaml:"accessKeyId"` - AccessKeySecret string `yaml:"accessKeySecret"` - SignName string `yaml:"signName"` - VerificationCodeTemplateCode string `yaml:"verificationCodeTemplateCode"` - Enable bool `yaml:"enable"` - } - TencentSMS struct { - AppID string `yaml:"appID"` - Region string `yaml:"region"` - SecretID string `yaml:"secretID"` - SecretKey string `yaml:"secretKey"` - SignName string `yaml:"signName"` - VerificationCodeTemplateCode string `yaml:"verificationCodeTemplateCode"` - Enable bool `yaml:"enable"` - } - SuperCode string `yaml:"superCode"` - CodeTTL int `yaml:"codeTTL"` - UseSuperCode bool `yaml:"useSuperCode"` - Mail struct { - Title string `yaml:"title"` - SenderMail string `yaml:"senderMail"` - SenderAuthorizationCode string `yaml:"senderAuthorizationCode"` - SmtpAddr string `yaml:"smtpAddr"` - SmtpPort int `yaml:"smtpPort"` - } - TestDepartMentID string `yaml:"testDepartMentID"` - ImAPIURL string `yaml:"imAPIURL"` - NeedInvitationCode bool `yaml:"needInvitationCode"` - OnboardProcess bool `yaml:"onboardProcess"` - JoinDepartmentIDList []string `yaml:"joinDepartmentIDList"` - JoinDepartmentGroups bool `yaml:"joinDepartmentGroups"` - OaNotification bool `yaml:"oaNotification"` - CreateOrganizationUserAndJoinDepartment bool `yaml:"createOrganizationUserAndJoinDepartment"` - } + WorkMoment struct { OnlyFriendCanSee bool `yaml:"onlyFriendCanSee"` } `yaml:"workMoment"` diff --git a/pkg/common/constant/constant.go b/pkg/common/constant/constant.go index e282a6c75..d4018a9a9 100644 --- a/pkg/common/constant/constant.go +++ b/pkg/common/constant/constant.go @@ -94,8 +94,6 @@ const ( ConversationPrivateChatNotification = 1701 ConversationUnreadNotification = 1702 - OrganizationChangedNotification = 1801 - WorkMomentNotificationBegin = 1900 WorkMomentNotification = 1901 diff --git a/pkg/common/db/cache/conversation.go b/pkg/common/db/cache/conversation.go index 65681edb7..3aaa1d48f 100644 --- a/pkg/common/db/cache/conversation.go +++ b/pkg/common/db/cache/conversation.go @@ -56,7 +56,7 @@ func NewConversationRedis(rcClient *rockscache.Client) *ConversationRedis { } func NewNewConversationRedis(rdb redis.UniversalClient, conversationDB *relation.ConversationGorm, options rockscache.Options) *ConversationRedis { - return &ConversationRedis{conversationDB: conversationDB, expireTime: conversationExpireTime, rcClient: rockscache.NewClient(rdb, options)} + return &ConversationRedis{rcClient: rockscache.NewClient(rdb, options)} } func (c *ConversationRedis) getConversationKey(ownerUserID, conversationID string) string { diff --git a/pkg/common/db/cache/redis.go b/pkg/common/db/cache/redis.go index f9b090f2e..1fedf44e2 100644 --- a/pkg/common/db/cache/redis.go +++ b/pkg/common/db/cache/redis.go @@ -6,7 +6,7 @@ import ( log2 "Open_IM/pkg/common/log" pbChat "Open_IM/pkg/proto/msg" pbRtc "Open_IM/pkg/proto/rtc" - pbCommon "Open_IM/pkg/proto/sdk_ws" + pbCommon "Open_IM/pkg/proto/sdkws" "Open_IM/pkg/utils" "context" "errors" diff --git a/pkg/common/db/cache/redis_test.go b/pkg/common/db/cache/redis_test.go index 69605e619..1357dfadf 100644 --- a/pkg/common/db/cache/redis_test.go +++ b/pkg/common/db/cache/redis_test.go @@ -3,7 +3,7 @@ package cache import ( "Open_IM/pkg/common/constant" pbChat "Open_IM/pkg/proto/msg" - common "Open_IM/pkg/proto/sdk_ws" + common "Open_IM/pkg/proto/sdkws" "context" "flag" "fmt" diff --git a/pkg/common/db/cache/rockscache.go b/pkg/common/db/cache/rockscache.go index 5a6120f57..c036de5f8 100644 --- a/pkg/common/db/cache/rockscache.go +++ b/pkg/common/db/cache/rockscache.go @@ -68,539 +68,3 @@ func (rc *RcClient) DelKeys() { } } } - -func (rc *Client) GetFriendIDListFromCache(ctx context.Context, userID string) (friendIDList []string, err error) { - getFriendIDList := func() (string, error) { - friendIDList, err := relation.GetFriendIDListByUserID(userID) - if err != nil { - return "", utils.Wrap(err, "") - } - bytes, err := json.Marshal(friendIDList) - if err != nil { - return "", utils.Wrap(err, "") - } - return string(bytes), nil - } - defer func() { - tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "userID", userID, "friendIDList", friendIDList) - }() - friendIDListStr, err := db.DB.Rc.Fetch(friendRelationCache+userID, time.Second*30*60, getFriendIDList) - if err != nil { - return nil, utils.Wrap(err, "") - } - err = json.Unmarshal([]byte(friendIDListStr), &friendIDList) - return friendIDList, utils.Wrap(err, "") -} - -func DelFriendIDListFromCache(ctx context.Context, userID string) (err error) { - defer func() { - tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "userID", userID) - }() - return db.DB.Rc.TagAsDeleted(friendRelationCache + userID) -} - -func GetBlackListFromCache(ctx context.Context, userID string) (blackIDs []string, err error) { - getBlackIDList := func() (string, error) { - blackIDs, err := relation.GetBlackIDListByUserID(userID) - if err != nil { - return "", utils.Wrap(err, "") - } - bytes, err := json.Marshal(blackIDs) - if err != nil { - return "", utils.Wrap(err, "") - } - return string(bytes), nil - } - defer func() { - tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "userID", userID, "blackIDList", blackIDs) - }() - blackIDListStr, err := db.DB.Rc.Fetch(blackListCache+userID, time.Second*30*60, getBlackIDList) - if err != nil { - return nil, utils.Wrap(err, "") - } - err = json.Unmarshal([]byte(blackIDListStr), &blackIDs) - return blackIDs, utils.Wrap(err, "") -} - -func DelBlackIDListFromCache(ctx context.Context, userID string) (err error) { - defer func() { - tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "ctx", ctx) - }() - return db.DB.Rc.TagAsDeleted(blackListCache + userID) -} - -func GetJoinedGroupIDListFromCache(ctx context.Context, userID string) (joinedGroupList []string, err error) { - getJoinedGroupIDList := func() (string, error) { - joinedGroupList, err := relation.GetJoinedGroupIDListByUserID(userID) - if err != nil { - return "", utils.Wrap(err, "") - } - bytes, err := json.Marshal(joinedGroupList) - if err != nil { - return "", utils.Wrap(err, "") - } - return string(bytes), nil - } - defer func() { - tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "userID", userID, "joinedGroupList", joinedGroupList) - }() - joinedGroupIDListStr, err := db.DB.Rc.Fetch(joinedGroupListCache+userID, time.Second*30*60, getJoinedGroupIDList) - if err != nil { - return nil, utils.Wrap(err, "") - } - err = json.Unmarshal([]byte(joinedGroupIDListStr), &joinedGroupList) - return joinedGroupList, utils.Wrap(err, "") -} - -func DelJoinedGroupIDListFromCache(ctx context.Context, userID string) (err error) { - defer func() { - tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "userID", userID) - }() - return db.DB.Rc.TagAsDeleted(joinedGroupListCache + userID) -} - -func GetGroupMemberIDListFromCache(ctx context.Context, groupID string) (groupMemberIDList []string, err error) { - f := func() (string, error) { - groupInfo, err := GetGroupInfoFromCache(ctx, groupID) - if err != nil { - return "", utils.Wrap(err, "GetGroupInfoFromCache failed") - } - var groupMemberIDList []string - if groupInfo.GroupType == constant.SuperGroup { - superGroup, err := db.DB.GetSuperGroup(groupID) - if err != nil { - return "", utils.Wrap(err, "") - } - groupMemberIDList = superGroup.MemberIDList - } else { - groupMemberIDList, err = relation.GetGroupMemberIDListByGroupID(groupID) - if err != nil { - return "", utils.Wrap(err, "") - } - } - bytes, err := json.Marshal(groupMemberIDList) - if err != nil { - return "", utils.Wrap(err, "") - } - return string(bytes), nil - } - defer func() { - tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupID", groupID, "groupMemberIDList", groupMemberIDList) - }() - groupIDListStr, err := db.DB.Rc.Fetch(groupCache+groupID, time.Second*30*60, f) - if err != nil { - return nil, utils.Wrap(err, "") - } - err = json.Unmarshal([]byte(groupIDListStr), &groupMemberIDList) - return groupMemberIDList, utils.Wrap(err, "") -} - -func DelGroupMemberIDListFromCache(ctx context.Context, groupID string) (err error) { - defer func() { - tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupID", groupID) - }() - return db.DB.Rc.TagAsDeleted(groupCache + groupID) -} - -func GetUserInfoFromCache(ctx context.Context, userID string) (userInfo *relation.User, err error) { - getUserInfo := func() (string, error) { - userInfo, err := relation.GetUserByUserID(userID) - if err != nil { - return "", utils.Wrap(err, "") - } - bytes, err := json.Marshal(userInfo) - if err != nil { - return "", utils.Wrap(err, "") - } - return string(bytes), nil - } - defer func() { - tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "userID", userID, "userInfo", *userInfo) - }() - userInfoStr, err := db.DB.Rc.Fetch(userInfoCache+userID, time.Second*30*60, getUserInfo) - if err != nil { - return nil, utils.Wrap(err, "") - } - userInfo = &relation.User{} - err = json.Unmarshal([]byte(userInfoStr), userInfo) - return userInfo, utils.Wrap(err, "") -} - -func GetUserInfoFromCacheBatch(ctx context.Context, userIDs []string) ([]*relation.User, error) { - var users []*relation.User - for _, userID := range userIDs { - user, err := GetUserInfoFromCache(ctx, userID) - if err != nil { - return nil, err - } - users = append(users, user) - } - return users, nil -} - -func DelUserInfoFromCache(ctx context.Context, userID string) (err error) { - defer func() { - tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "userID", userID) - }() - return db.DB.Rc.TagAsDeleted(userInfoCache + userID) -} - -func GetGroupMemberInfoFromCache(ctx context.Context, groupID, userID string) (groupMember *relation.GroupMember, err error) { - getGroupMemberInfo := func() (string, error) { - groupMemberInfo, err := relation.GetGroupMemberInfoByGroupIDAndUserID(groupID, userID) - if err != nil { - return "", utils.Wrap(err, "") - } - bytes, err := json.Marshal(groupMemberInfo) - if err != nil { - return "", utils.Wrap(err, "") - } - return string(bytes), nil - } - defer func() { - tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupID", groupID, "userID", userID, "groupMember", *groupMember) - }() - groupMemberInfoStr, err := db.DB.Rc.Fetch(groupMemberInfoCache+groupID+"-"+userID, time.Second*30*60, getGroupMemberInfo) - if err != nil { - return nil, utils.Wrap(err, "") - } - groupMember = &relation.GroupMember{} - err = json.Unmarshal([]byte(groupMemberInfoStr), groupMember) - return groupMember, utils.Wrap(err, "") -} - -func DelGroupMemberInfoFromCache(ctx context.Context, groupID, userID string) (err error) { - defer func() { - tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupID", groupID, "userID", userID) - }() - return db.DB.Rc.TagAsDeleted(groupMemberInfoCache + groupID + "-" + userID) -} - -func GetGroupMembersInfoFromCache(ctx context.Context, count, offset int32, groupID string) (groupMembers []*relation.GroupMember, err error) { - defer func() { - tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "count", count, "offset", offset, "groupID", groupID, "groupMember", groupMembers) - }() - groupMemberIDList, err := GetGroupMemberIDListFromCache(ctx, groupID) - if err != nil { - return nil, err - } - if count < 0 || offset < 0 { - return nil, nil - } - var groupMemberList []*relation.GroupMember - var start, stop int32 - start = offset - stop = offset + count - l := int32(len(groupMemberIDList)) - if start > stop { - return nil, nil - } - if start >= l { - return nil, nil - } - if count != 0 { - if stop >= l { - stop = l - } - groupMemberIDList = groupMemberIDList[start:stop] - } else { - if l < 1000 { - stop = l - } else { - stop = 1000 - } - groupMemberIDList = groupMemberIDList[start:stop] - } - //log.NewDebug("", utils.GetSelfFuncName(), "ID list: ", groupMemberIDList) - for _, userID := range groupMemberIDList { - groupMember, err := GetGroupMemberInfoFromCache(ctx, groupID, userID) - if err != nil { - log.NewError("", utils.GetSelfFuncName(), err.Error(), groupID, userID) - continue - } - groupMembers = append(groupMembers, groupMember) - } - return groupMemberList, nil -} - -func GetAllGroupMembersInfoFromCache(ctx context.Context, groupID string) (groupMembers []*relation.GroupMember, err error) { - defer func() { - tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupID", groupID, "groupMembers", groupMembers) - }() - getGroupMemberInfo := func() (string, error) { - groupMembers, err := relation.GetGroupMemberListByGroupID(groupID) - if err != nil { - return "", utils.Wrap(err, "") - } - bytes, err := json.Marshal(groupMembers) - if err != nil { - return "", utils.Wrap(err, "") - } - return string(bytes), nil - } - groupMembersStr, err := db.DB.Rc.Fetch(groupAllMemberInfoCache+groupID, time.Second*30*60, getGroupMemberInfo) - if err != nil { - return nil, utils.Wrap(err, "") - } - err = json.Unmarshal([]byte(groupMembersStr), &groupMembers) - return groupMembers, utils.Wrap(err, "") -} - -func DelAllGroupMembersInfoFromCache(ctx context.Context, groupID string) (err error) { - defer func() { - tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupID", groupID) - }() - return db.DB.Rc.TagAsDeleted(groupAllMemberInfoCache + groupID) -} - -//func GetGroupInfoFromCache(ctx context.Context, groupID string) (groupInfo *mysql.GroupGorm, err error) { -// getGroupInfo := func() (string, error) { -// groupInfo, err := mysql.GetGroupInfoByGroupID(groupID) -// if err != nil { -// return "", utils.Wrap(err, "") -// } -// bytes, err := json.Marshal(groupInfo) -// if err != nil { -// return "", utils.Wrap(err, "") -// } -// return string(bytes), nil -// } -// groupInfo = &mysql.GroupGorm{} -// defer func() { -// tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupID", groupID, "groupInfo", groupInfo) -// }() -// groupInfoStr, err := db.DB.Rc.Fetch(groupInfoCache+groupID, time.Second*30*60, getGroupInfo) -// if err != nil { -// return nil, utils.Wrap(err, "") -// } -// err = json.Unmarshal([]byte(groupInfoStr), groupInfo) -// return groupInfo, utils.Wrap(err, "") -//} -// -//func DelGroupInfoFromCache(ctx context.Context, groupID string) (err error) { -// defer func() { -// tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupID", groupID) -// }() -// return db.DB.Rc.TagAsDeleted(groupInfoCache + groupID) -//} - -func GetAllFriendsInfoFromCache(ctx context.Context, userID string) (friends []*relation.Friend, err error) { - getAllFriendInfo := func() (string, error) { - friendInfoList, err := relation.GetFriendListByUserID(userID) - if err != nil { - return "", utils.Wrap(err, "") - } - bytes, err := json.Marshal(friendInfoList) - if err != nil { - return "", utils.Wrap(err, "") - } - return string(bytes), nil - } - defer func() { - tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "userID", userID, "friends", friends) - }() - allFriendInfoStr, err := db.DB.Rc.Fetch(allFriendInfoCache+userID, time.Second*30*60, getAllFriendInfo) - if err != nil { - return nil, utils.Wrap(err, "") - } - err = json.Unmarshal([]byte(allFriendInfoStr), &friends) - return friends, utils.Wrap(err, "") -} - -func DelAllFriendsInfoFromCache(ctx context.Context, userID string) (err error) { - defer func() { - tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "userID", userID) - }() - return db.DB.Rc.TagAsDeleted(allFriendInfoCache + userID) -} - -func GetJoinedSuperGroupListFromCache(ctx context.Context, userID string) (joinedSuperGroupIDs []string, err error) { - getJoinedSuperGroupIDList := func() (string, error) { - userToSuperGroup, err := db.DB.GetSuperGroupByUserID(userID) - if err != nil { - return "", utils.Wrap(err, "") - } - bytes, err := json.Marshal(userToSuperGroup.GroupIDList) - if err != nil { - return "", utils.Wrap(err, "") - } - return string(bytes), nil - } - defer func() { - tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "userID", userID, "joinedSuperGroupIDs", joinedSuperGroupIDs) - }() - joinedSuperGroupListStr, err := db.DB.Rc.Fetch(joinedSuperGroupListCache+userID, time.Second*30*60, getJoinedSuperGroupIDList) - if err != nil { - return nil, err - } - err = json.Unmarshal([]byte(joinedSuperGroupListStr), &joinedSuperGroupIDs) - return joinedSuperGroupIDs, utils.Wrap(err, "") -} - -func DelJoinedSuperGroupIDListFromCache(ctx context.Context, userID string) (err error) { - defer func() { - tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "userID", userID) - }() - return db.DB.Rc.TagAsDeleted(joinedSuperGroupListCache + userID) -} - -func GetGroupMemberListHashFromCache(ctx context.Context, groupID string) (hashCodeUint64 uint64, err error) { - generateHash := func() (string, error) { - groupInfo, err := GetGroupInfoFromCache(ctx, groupID) - if err != nil { - return "0", utils.Wrap(err, "GetGroupInfoFromCache failed") - } - if groupInfo.Status == constant.GroupStatusDismissed { - return "0", nil - } - groupMemberIDList, err := GetGroupMemberIDListFromCache(ctx, groupID) - if err != nil { - return "", utils.Wrap(err, "GetGroupMemberIDListFromCache failed") - } - sort.Strings(groupMemberIDList) - var all string - for _, v := range groupMemberIDList { - all += v - } - bi := big.NewInt(0) - bi.SetString(utils.Md5(all)[0:8], 16) - return strconv.Itoa(int(bi.Uint64())), nil - } - defer func() { - tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupID", groupID, "hashCodeUint64", hashCodeUint64) - }() - hashCodeStr, err := db.DB.Rc.Fetch(groupMemberListHashCache+groupID, time.Second*30*60, generateHash) - if err != nil { - return 0, utils.Wrap(err, "fetch failed") - } - hashCode, err := strconv.Atoi(hashCodeStr) - return uint64(hashCode), err -} - -func DelGroupMemberListHashFromCache(ctx context.Context, groupID string) (err error) { - defer func() { - tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupID", groupID) - }() - return db.DB.Rc.TagAsDeleted(groupMemberListHashCache + groupID) -} - -func GetGroupMemberNumFromCache(ctx context.Context, groupID string) (num int, err error) { - getGroupMemberNum := func() (string, error) { - num, err := relation.GetGroupMemberNumByGroupID(groupID) - if err != nil { - return "", utils.Wrap(err, "") - } - return strconv.Itoa(int(num)), nil - } - defer func() { - tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupID", groupID, "num", num) - }() - groupMember, err := db.DB.Rc.Fetch(groupMemberNumCache+groupID, time.Second*30*60, getGroupMemberNum) - if err != nil { - return 0, utils.Wrap(err, "") - } - return strconv.Atoi(groupMember) -} - -func DelGroupMemberNumFromCache(ctx context.Context, groupID string) (err error) { - defer func() { - tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupID", groupID) - }() - return db.DB.Rc.TagAsDeleted(groupMemberNumCache + groupID) -} - -func GetUserConversationIDListFromCache(ctx context.Context, userID string) (conversationIDs []string, err error) { - getConversationIDList := func() (string, error) { - conversationIDList, err := relation.GetConversationIDListByUserID(userID) - if err != nil { - return "", utils.Wrap(err, "getConversationIDList failed") - } - log.NewDebug("", utils.GetSelfFuncName(), conversationIDList) - bytes, err := json.Marshal(conversationIDList) - if err != nil { - return "", utils.Wrap(err, "") - } - return string(bytes), nil - } - defer func() { - tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "userID", userID, "conversationIDs", conversationIDs) - }() - conversationIDListStr, err := db.DB.Rc.Fetch(conversationIDListCache+userID, time.Second*30*60, getConversationIDList) - err = json.Unmarshal([]byte(conversationIDListStr), &conversationIDs) - if err != nil { - return nil, utils.Wrap(err, "") - } - return conversationIDs, nil -} - -func DelUserConversationIDListFromCache(ctx context.Context, userID string) (err error) { - defer func() { - tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "userID", userID) - }() - return utils.Wrap(db.DB.Rc.TagAsDeleted(conversationIDListCache+userID), "DelUserConversationIDListFromCache err") -} - -func GetConversationFromCache(ctx context.Context, ownerUserID, conversationID string) (conversation *relation.Conversation, err error) { - getConversation := func() (string, error) { - conversation, err := relation.GetConversation(ownerUserID, conversationID) - if err != nil { - return "", utils.Wrap(err, "get failed") - } - bytes, err := json.Marshal(conversation) - if err != nil { - return "", utils.Wrap(err, "Marshal failed") - } - return string(bytes), nil - } - defer func() { - tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "ownerUserID", ownerUserID, "conversationID", conversationID, "conversation", *conversation) - }() - conversationStr, err := db.DB.Rc.Fetch(conversationCache+ownerUserID+":"+conversationID, time.Second*30*60, getConversation) - if err != nil { - return nil, utils.Wrap(err, "Fetch failed") - } - conversation = &relation.Conversation{} - err = json.Unmarshal([]byte(conversationStr), &conversation) - return conversation, utils.Wrap(err, "Unmarshal failed") -} - -func GetConversationsFromCache(ctx context.Context, ownerUserID string, conversationIDs []string) (conversations []relation.Conversation, err error) { - defer func() { - tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "ownerUserID", ownerUserID, "conversationIDs", conversationIDs, "conversations", conversations) - }() - for _, conversationID := range conversationIDs { - conversation, err := GetConversationFromCache(ctx, ownerUserID, conversationID) - if err != nil { - return nil, utils.Wrap(err, "GetConversationFromCache failed") - } - conversations = append(conversations, *conversation) - } - return conversations, nil -} - -func GetUserAllConversationList(ctx context.Context, ownerUserID string) (conversations []relation.Conversation, err error) { - defer func() { - tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "ownerUserID", ownerUserID, "conversations", conversations) - }() - IDList, err := GetUserConversationIDListFromCache(ctx, ownerUserID) - if err != nil { - return nil, err - } - var conversationList []relation.Conversation - log.NewDebug("", utils.GetSelfFuncName(), IDList) - for _, conversationID := range IDList { - conversation, err := GetConversationFromCache(ctx, ownerUserID, conversationID) - if err != nil { - return nil, utils.Wrap(err, "GetConversationFromCache failed") - } - conversationList = append(conversationList, *conversation) - } - return conversationList, nil -} - -func DelConversationFromCache(ctx context.Context, ownerUserID, conversationID string) (err error) { - defer func() { - tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "ownerUserID", ownerUserID, "conversationID", conversationID) - }() - return utils.Wrap(db.DB.Rc.TagAsDeleted(conversationCache+ownerUserID+":"+conversationID), "DelConversationFromCache err") -} diff --git a/pkg/common/db/cache/user.go b/pkg/common/db/cache/user.go index 58186453f..8fed34ebb 100644 --- a/pkg/common/db/cache/user.go +++ b/pkg/common/db/cache/user.go @@ -19,7 +19,10 @@ const ( userGlobalRecvMsgOptKey = "USER_GLOBAL_RECV_MSG_OPT_KEY:" ) -type UserCache struct { +type UserCache interface { +} + +type UserCacheRedis struct { userDB *relation.UserGorm expireTime time.Duration @@ -27,8 +30,8 @@ type UserCache struct { rcClient *rockscache.Client } -func NewUserCache(rdb redis.UniversalClient, userDB *relation.UserGorm, options rockscache.Options) *UserCache { - return &UserCache{ +func NewUserCacheRedis(rdb redis.UniversalClient, userDB *relation.UserGorm, options rockscache.Options) *UserCacheRedis { + return &UserCacheRedis{ userDB: userDB, expireTime: userExpireTime, redisClient: NewRedisClient(rdb), @@ -36,15 +39,15 @@ func NewUserCache(rdb redis.UniversalClient, userDB *relation.UserGorm, options } } -func (u *UserCache) getUserInfoKey(userID string) string { +func (u *UserCacheRedis) getUserInfoKey(userID string) string { return userInfoKey + userID } -func (u *UserCache) getUserGlobalRecvMsgOptKey(userID string) string { +func (u *UserCacheRedis) getUserGlobalRecvMsgOptKey(userID string) string { return userGlobalRecvMsgOptKey + userID } -func (u *UserCache) GetUserInfo(ctx context.Context, userID string) (userInfo *relationTb.UserModel, err error) { +func (u *UserCacheRedis) GetUserInfo(ctx context.Context, userID string) (userInfo *relationTb.UserModel, err error) { getUserInfo := func() (string, error) { userInfo, err := u.userDB.Take(ctx, userID) if err != nil { @@ -68,7 +71,7 @@ func (u *UserCache) GetUserInfo(ctx context.Context, userID string) (userInfo *r return userInfo, utils.Wrap(err, "") } -func (u *UserCache) GetUsersInfo(ctx context.Context, userIDs []string) ([]*relationTb.UserModel, error) { +func (u *UserCacheRedis) GetUsersInfo(ctx context.Context, userIDs []string) ([]*relationTb.UserModel, error) { var users []*relationTb.UserModel for _, userID := range userIDs { user, err := GetUserInfoFromCache(ctx, userID) @@ -80,14 +83,14 @@ func (u *UserCache) GetUsersInfo(ctx context.Context, userIDs []string) ([]*rela return users, nil } -func (u *UserCache) DelUserInfo(ctx context.Context, userID string) (err error) { +func (u *UserCacheRedis) DelUserInfo(ctx context.Context, userID string) (err error) { defer func() { tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "userID", userID) }() return u.rcClient.TagAsDeleted(u.getUserInfoKey(userID)) } -func (u *UserCache) DelUsersInfo(ctx context.Context, userIDs []string) (err error) { +func (u *UserCacheRedis) DelUsersInfo(ctx context.Context, userIDs []string) (err error) { for _, userID := range userIDs { if err := u.DelUserInfo(ctx, userID); err != nil { return err @@ -96,7 +99,7 @@ func (u *UserCache) DelUsersInfo(ctx context.Context, userIDs []string) (err err return nil } -func (u *UserCache) GetUserGlobalRecvMsgOpt(ctx context.Context, userID string) (opt int, err error) { +func (u *UserCacheRedis) GetUserGlobalRecvMsgOpt(ctx context.Context, userID string) (opt int, err error) { getUserGlobalRecvMsgOpt := func() (string, error) { userInfo, err := u.userDB.Take(ctx, userID) if err != nil { @@ -114,7 +117,7 @@ func (u *UserCache) GetUserGlobalRecvMsgOpt(ctx context.Context, userID string) return strconv.Atoi(optStr) } -func (u *UserCache) DelUserGlobalRecvMsgOpt(ctx context.Context, userID string) (err error) { +func (u *UserCacheRedis) DelUserGlobalRecvMsgOpt(ctx context.Context, userID string) (err error) { defer func() { tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "userID", userID) }() diff --git a/pkg/common/db/controller/chatlog.go b/pkg/common/db/controller/chatlog.go index 038561982..393f81630 100644 --- a/pkg/common/db/controller/chatlog.go +++ b/pkg/common/db/controller/chatlog.go @@ -2,13 +2,14 @@ package controller import ( "Open_IM/pkg/common/db/relation" + relationTb "Open_IM/pkg/common/db/table/relation" pbMsg "Open_IM/pkg/proto/msg" "gorm.io/gorm" ) type ChatLogInterface interface { CreateChatLog(msg pbMsg.MsgDataToMQ) error - GetChatLog(chatLog *relation.ChatLog, pageNumber, showNumber int32, contentTypeList []int32) (int64, []relation.ChatLog, error) + GetChatLog(chatLog *relationTb.ChatLogModel, pageNumber, showNumber int32, contentTypeList []int32) (int64, []relation.ChatLog, error) } func NewChatLogController(db *gorm.DB) ChatLogInterface { @@ -23,17 +24,17 @@ func (c *ChatLogController) CreateChatLog(msg pbMsg.MsgDataToMQ) error { return c.database.CreateChatLog(msg) } -func (c *ChatLogController) GetChatLog(chatLog *relation.ChatLog, pageNumber, showNumber int32, contentTypeList []int32) (int64, []relation.ChatLog, error) { +func (c *ChatLogController) GetChatLog(chatLog *relationTb.ChatLogModel, pageNumber, showNumber int32, contentTypeList []int32) (int64, []relation.ChatLog, error) { return c.database.GetChatLog(chatLog, pageNumber, showNumber, contentTypeList) } type ChatLogDataBaseInterface interface { CreateChatLog(msg pbMsg.MsgDataToMQ) error - GetChatLog(chatLog *relation.ChatLog, pageNumber, showNumber int32, contentTypeList []int32) (int64, []relation.ChatLog, error) + GetChatLog(chatLog *relationTb.ChatLogModel, pageNumber, showNumber int32, contentTypeList []int32) (int64, []relation.ChatLog, error) } type ChatLogDataBase struct { - chatLogDB *relation.ChatLog + chatLogDB *relationTb.ChatLogModelInterface } func NewChatLogDataBase(db *gorm.DB) ChatLogDataBaseInterface { @@ -44,6 +45,6 @@ func (c *ChatLogDataBase) CreateChatLog(msg pbMsg.MsgDataToMQ) error { return c.chatLogDB.Create(msg) } -func (c *ChatLogDataBase) GetChatLog(chatLog *relation.ChatLog, pageNumber, showNumber int32, contentTypeList []int32) (int64, []relation.ChatLog, error) { +func (c *ChatLogDataBase) GetChatLog(chatLog *relationTb.ChatLogModel, pageNumber, showNumber int32, contentTypeList []int32) (int64, []relation.ChatLog, error) { return c.chatLogDB.GetChatLog(chatLog, pageNumber, showNumber, contentTypeList) } diff --git a/pkg/common/db/relation/chat_log_model.go b/pkg/common/db/relation/chat_log_model.go index 7d348547b..09aaf4ab1 100644 --- a/pkg/common/db/relation/chat_log_model.go +++ b/pkg/common/db/relation/chat_log_model.go @@ -4,7 +4,7 @@ import ( "Open_IM/pkg/common/constant" "Open_IM/pkg/common/db/table/relation" pbMsg "Open_IM/pkg/proto/msg" - server_api_params "Open_IM/pkg/proto/sdk_ws" + sdkws "Open_IM/pkg/proto/sdkws" "Open_IM/pkg/utils" "fmt" "github.com/golang/protobuf/jsonpb" @@ -31,7 +31,7 @@ func (c *ChatLogGorm) Create(msg pbMsg.MsgDataToMQ) error { chatLog.RecvID = msg.MsgData.RecvID } if msg.MsgData.ContentType >= constant.NotificationBegin && msg.MsgData.ContentType <= constant.NotificationEnd { - var tips server_api_params.TipsComm + var tips sdkws.TipsComm _ = proto.Unmarshal(msg.MsgData.Content, &tips) marshaler := jsonpb.Marshaler{ OrigName: true, diff --git a/pkg/common/db/table/unrelation/extend_msg_set.go b/pkg/common/db/table/unrelation/extend_msg_set.go index ead513f9c..617ca388a 100644 --- a/pkg/common/db/table/unrelation/extend_msg_set.go +++ b/pkg/common/db/table/unrelation/extend_msg_set.go @@ -1,7 +1,7 @@ package unrelation import ( - common "Open_IM/pkg/proto/sdk_ws" + common "Open_IM/pkg/proto/sdkws" "context" "strconv" "strings" diff --git a/pkg/common/db/table/unrelation/msg.go b/pkg/common/db/table/unrelation/msg.go new file mode 100644 index 000000000..980dfa653 --- /dev/null +++ b/pkg/common/db/table/unrelation/msg.go @@ -0,0 +1,65 @@ +package unrelation + +import "strconv" + +const ( + singleGocMsgNum = 5000 + CChat = "msg" +) + +type UserChatModel struct { + UID string `bson:"uid"` + Msg []MsgInfoModel `bson:"msg"` +} + +type MsgInfoModel struct { + SendTime int64 `bson:"sendtime"` + Msg []byte `bson:"msg"` +} + +func (UserChatModel) TableName() string { + return CChat +} + +func (UserChatModel) GetSingleGocMsgNum() int { + return singleGocMsgNum +} + +func (u UserChatModel) getSeqUid(uid string, seq uint32) string { + seqSuffix := seq / singleGocMsgNum + return u.indexGen(uid, seqSuffix) +} + +func (u UserChatModel) getSeqUserIDList(userID string, maxSeq uint32) []string { + seqMaxSuffix := maxSeq / singleGocMsgNum + var seqUserIDList []string + for i := 0; i <= int(seqMaxSuffix); i++ { + seqUserID := u.indexGen(userID, uint32(i)) + seqUserIDList = append(seqUserIDList, seqUserID) + } + return seqUserIDList +} + +func (UserChatModel) getSeqSuperGroupID(groupID string, seq uint32) string { + seqSuffix := seq / singleGocMsgNum + return superGroupIndexGen(groupID, seqSuffix) +} + +func (u UserChatModel) GetSeqUid(uid string, seq uint32) string { + return u.getSeqUid(uid, seq) +} + +func (UserChatModel) getMsgIndex(seq uint32) int { + seqSuffix := seq / singleGocMsgNum + var index uint32 + if seqSuffix == 0 { + index = (seq - seqSuffix*singleGocMsgNum) - 1 + } else { + index = seq - seqSuffix*singleGocMsgNum + } + return int(index) +} + +func (UserChatModel) indexGen(uid string, seqSuffix uint32) string { + return uid + ":" + strconv.FormatInt(int64(seqSuffix), 10) +} diff --git a/pkg/common/db/table/unrelation/super_group.go b/pkg/common/db/table/unrelation/super_group.go index 0493afc4e..d02a534aa 100644 --- a/pkg/common/db/table/unrelation/super_group.go +++ b/pkg/common/db/table/unrelation/super_group.go @@ -2,6 +2,7 @@ package unrelation import ( "context" + "strconv" ) const ( @@ -37,13 +38,6 @@ type SuperGroupModelInterface interface { RemoveGroupFromUser(ctx context.Context, groupID string, userIDs []string, tx ...any) error } -//type SuperGroupModelInterface interface { -// // tx is your transaction object -// CreateSuperGroup(ctx context.Context, groupID string, initMemberIDs []string, tx ...interface{}) error -// FindSuperGroup(ctx context.Context, groupIDs []string, tx ...interface{}) ([]*SuperGroupModel, error) -// //GetSuperGroup(ctx context.Context, groupID string) (SuperGroupModel, error) -// AddUserToSuperGroup(ctx context.Context, groupID string, userIDs []string, tx ...interface{}) error -// RemoverUserFromSuperGroup(ctx context.Context, groupID string, userIDs []string, tx ...interface{}) error -// GetSuperGroupByUserID(ctx context.Context, userID string, tx ...interface{}) (*UserToSuperGroupModel, error) -// DeleteSuperGroup(ctx context.Context, groupID string, tx ...interface{}) error -//} +func superGroupIndexGen(groupID string, seqSuffix uint32) string { + return "super_group_" + groupID + ":" + strconv.FormatInt(int64(seqSuffix), 10) +} diff --git a/pkg/common/db/unrelation/extend_msg_mongo_model.go b/pkg/common/db/unrelation/extend_msg.go similarity index 97% rename from pkg/common/db/unrelation/extend_msg_mongo_model.go rename to pkg/common/db/unrelation/extend_msg.go index 9cd97c960..7f8564a46 100644 --- a/pkg/common/db/unrelation/extend_msg_mongo_model.go +++ b/pkg/common/db/unrelation/extend_msg.go @@ -2,7 +2,7 @@ package unrelation import ( "Open_IM/pkg/common/db/table/unrelation" - server_api_params "Open_IM/pkg/proto/sdk_ws" + "Open_IM/pkg/proto/sdkws" "Open_IM/pkg/utils" "context" "errors" @@ -99,7 +99,7 @@ func (e *ExtendMsgSetMongoDriver) InsertExtendMsg(ctx context.Context, sourceID } // insert or update -func (e *ExtendMsgSetMongoDriver) InsertOrUpdateReactionExtendMsgSet(ctx context.Context, sourceID string, sessionType int32, clientMsgID string, msgFirstModifyTime int64, reactionExtensionList map[string]*server_api_params.KeyValue) error { +func (e *ExtendMsgSetMongoDriver) InsertOrUpdateReactionExtendMsgSet(ctx context.Context, sourceID string, sessionType int32, clientMsgID string, msgFirstModifyTime int64, reactionExtensionList map[string]*sdkws.KeyValue) error { var updateBson = bson.M{} for _, v := range reactionExtensionList { updateBson[fmt.Sprintf("extend_msgs.%s.%s", clientMsgID, v.TypeKey)] = v @@ -120,7 +120,7 @@ func (e *ExtendMsgSetMongoDriver) InsertOrUpdateReactionExtendMsgSet(ctx context } // delete TypeKey -func (e *ExtendMsgSetMongoDriver) DeleteReactionExtendMsgSet(ctx context.Context, sourceID string, sessionType int32, clientMsgID string, msgFirstModifyTime int64, reactionExtensionList map[string]*server_api_params.KeyValue) error { +func (e *ExtendMsgSetMongoDriver) DeleteReactionExtendMsgSet(ctx context.Context, sourceID string, sessionType int32, clientMsgID string, msgFirstModifyTime int64, reactionExtensionList map[string]*sdkws.KeyValue) error { var updateBson = bson.M{} for _, v := range reactionExtensionList { updateBson[fmt.Sprintf("extend_msgs.%s.%s", clientMsgID, v.TypeKey)] = "" diff --git a/pkg/common/db/unrelation/mongo_model.go b/pkg/common/db/unrelation/mongo_model.go index aee4ae29e..4fec83b98 100644 --- a/pkg/common/db/unrelation/mongo_model.go +++ b/pkg/common/db/unrelation/mongo_model.go @@ -1,547 +1,491 @@ package unrelation -import ( - "Open_IM/pkg/common/config" - "Open_IM/pkg/common/constant" - "Open_IM/pkg/common/db" - "Open_IM/pkg/common/log" - pbMsg "Open_IM/pkg/proto/msg" - open_im_sdk "Open_IM/pkg/proto/sdk_ws" - "Open_IM/pkg/utils" - "context" - "errors" - "fmt" - "math/rand" - "sync" - - "github.com/go-redis/redis/v8" - "github.com/gogo/protobuf/sortkeys" - "go.mongodb.org/mongo-driver/bson/primitive" - "go.mongodb.org/mongo-driver/mongo" - "go.mongodb.org/mongo-driver/mongo/options" - - //"github.com/garyburd/redigo/redis" - "github.com/golang/protobuf/proto" - "go.mongodb.org/mongo-driver/bson" - - "strconv" - "time" -) - -const cChat = "msg" -const cGroup = "group" - -const cCommentMsg = "comment_msg" - -const singleGocMsgNum = 5000 - -func GetSingleGocMsgNum() int { - return singleGocMsgNum -} - -type MsgInfo struct { - SendTime int64 - Msg []byte -} - -type UserChat struct { - UID string - //ListIndex int `bson:"index"` - Msg []MsgInfo -} - -type GroupMember_x struct { - GroupID string - UIDList []string -} - -var ErrMsgListNotExist = errors.New("user not have msg in mongoDB") // deleteMsgByLogic -func (d *db.DataBases) DelMsgBySeqList(userID string, seqList []uint32, operationID string) (totalUnexistSeqList []uint32, err error) { - log.Debug(operationID, utils.GetSelfFuncName(), "args ", userID, seqList) - sortkeys.Uint32s(seqList) - suffixUserID2SubSeqList := func(uid string, seqList []uint32) map[string][]uint32 { - t := make(map[string][]uint32) - for i := 0; i < len(seqList); i++ { - seqUid := getSeqUid(uid, seqList[i]) - if value, ok := t[seqUid]; !ok { - var temp []uint32 - t[seqUid] = append(temp, seqList[i]) - } else { - t[seqUid] = append(value, seqList[i]) - } - } - return t - }(userID, seqList) - - lock := sync.Mutex{} - var wg sync.WaitGroup - wg.Add(len(suffixUserID2SubSeqList)) - for k, v := range suffixUserID2SubSeqList { - go func(suffixUserID string, subSeqList []uint32, operationID string) { - defer wg.Done() - unexistSeqList, err := d.DelMsgBySeqListInOneDoc(suffixUserID, subSeqList, operationID) - if err != nil { - log.Error(operationID, "DelMsgBySeqListInOneDoc failed ", err.Error(), suffixUserID, subSeqList) - return - } - lock.Lock() - totalUnexistSeqList = append(totalUnexistSeqList, unexistSeqList...) - lock.Unlock() - }(k, v, operationID) - } - return totalUnexistSeqList, err -} - -func (d *db.DataBases) DelMsgBySeqListInOneDoc(suffixUserID string, seqList []uint32, operationID string) ([]uint32, error) { - log.Debug(operationID, utils.GetSelfFuncName(), "args ", suffixUserID, seqList) - seqMsgList, indexList, unexistSeqList, err := d.GetMsgAndIndexBySeqListInOneMongo2(suffixUserID, seqList, operationID) - if err != nil { - return nil, utils.Wrap(err, "") - } - for i, v := range seqMsgList { - if err := d.ReplaceMsgByIndex(suffixUserID, v, operationID, indexList[i]); err != nil { - return nil, utils.Wrap(err, "") - } - } - return unexistSeqList, nil -} +//func (d *db.DataBases) DelMsgBySeqList(userID string, seqList []uint32, operationID string) (totalUnexistSeqList []uint32, err error) { +// log.Debug(operationID, utils.GetSelfFuncName(), "args ", userID, seqList) +// sortkeys.Uint32s(seqList) +// suffixUserID2SubSeqList := func(uid string, seqList []uint32) map[string][]uint32 { +// t := make(map[string][]uint32) +// for i := 0; i < len(seqList); i++ { +// seqUid := getSeqUid(uid, seqList[i]) +// if value, ok := t[seqUid]; !ok { +// var temp []uint32 +// t[seqUid] = append(temp, seqList[i]) +// } else { +// t[seqUid] = append(value, seqList[i]) +// } +// } +// return t +// }(userID, seqList) +// +// lock := sync.Mutex{} +// var wg sync.WaitGroup +// wg.Add(len(suffixUserID2SubSeqList)) +// for k, v := range suffixUserID2SubSeqList { +// go func(suffixUserID string, subSeqList []uint32, operationID string) { +// defer wg.Done() +// unexistSeqList, err := d.DelMsgBySeqListInOneDoc(suffixUserID, subSeqList, operationID) +// if err != nil { +// log.Error(operationID, "DelMsgBySeqListInOneDoc failed ", err.Error(), suffixUserID, subSeqList) +// return +// } +// lock.Lock() +// totalUnexistSeqList = append(totalUnexistSeqList, unexistSeqList...) +// lock.Unlock() +// }(k, v, operationID) +// } +// return totalUnexistSeqList, err +//} +// +//func (d *db.DataBases) DelMsgBySeqListInOneDoc(suffixUserID string, seqList []uint32, operationID string) ([]uint32, error) { +// log.Debug(operationID, utils.GetSelfFuncName(), "args ", suffixUserID, seqList) +// seqMsgList, indexList, unexistSeqList, err := d.GetMsgAndIndexBySeqListInOneMongo2(suffixUserID, seqList, operationID) +// if err != nil { +// return nil, utils.Wrap(err, "") +// } +// for i, v := range seqMsgList { +// if err := d.ReplaceMsgByIndex(suffixUserID, v, operationID, indexList[i]); err != nil { +// return nil, utils.Wrap(err, "") +// } +// } +// return unexistSeqList, nil +//} // deleteMsgByLogic -func (d *db.DataBases) DelMsgLogic(uid string, seqList []uint32, operationID string) error { - sortkeys.Uint32s(seqList) - seqMsgs, err := d.GetMsgBySeqListMongo2(uid, seqList, operationID) - if err != nil { - return utils.Wrap(err, "") - } - for _, seqMsg := range seqMsgs { - log.NewDebug(operationID, utils.GetSelfFuncName(), *seqMsg) - seqMsg.Status = constant.MsgDeleted - if err = d.ReplaceMsgBySeq(uid, seqMsg, operationID); err != nil { - log.NewError(operationID, utils.GetSelfFuncName(), "ReplaceMsgListBySeq error", err.Error()) - } - } - return nil -} +//func (d *db.DataBases) DelMsgLogic(uid string, seqList []uint32, operationID string) error { +// sortkeys.Uint32s(seqList) +// seqMsgs, err := d.GetMsgBySeqListMongo2(uid, seqList, operationID) +// if err != nil { +// return utils.Wrap(err, "") +// } +// for _, seqMsg := range seqMsgs { +// log.NewDebug(operationID, utils.GetSelfFuncName(), *seqMsg) +// seqMsg.Status = constant.MsgDeleted +// if err = d.ReplaceMsgBySeq(uid, seqMsg, operationID); err != nil { +// log.NewError(operationID, utils.GetSelfFuncName(), "ReplaceMsgListBySeq error", err.Error()) +// } +// } +// return nil +//} -func (d *db.DataBases) ReplaceMsgByIndex(suffixUserID string, msg *open_im_sdk.MsgData, operationID string, seqIndex int) error { - log.NewInfo(operationID, utils.GetSelfFuncName(), suffixUserID, *msg) - ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second) - c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cChat) - s := fmt.Sprintf("msg.%d.msg", seqIndex) - log.NewDebug(operationID, utils.GetSelfFuncName(), seqIndex, s) - msg.Status = constant.MsgDeleted - bytes, err := proto.Marshal(msg) - if err != nil { - log.NewError(operationID, utils.GetSelfFuncName(), "proto marshal failed ", err.Error(), msg.String()) - return utils.Wrap(err, "") - } - updateResult, err := c.UpdateOne(ctx, bson.M{"uid": suffixUserID}, bson.M{"$set": bson.M{s: bytes}}) - log.NewInfo(operationID, utils.GetSelfFuncName(), updateResult) - if err != nil { - log.NewError(operationID, utils.GetSelfFuncName(), "UpdateOne", err.Error()) - return utils.Wrap(err, "") - } - return nil -} +//func (d *db.DataBases) ReplaceMsgByIndex(suffixUserID string, msg *open_im_sdk.MsgData, operationID string, seqIndex int) error { +// log.NewInfo(operationID, utils.GetSelfFuncName(), suffixUserID, *msg) +// ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second) +// c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cChat) +// s := fmt.Sprintf("msg.%d.msg", seqIndex) +// log.NewDebug(operationID, utils.GetSelfFuncName(), seqIndex, s) +// msg.Status = constant.MsgDeleted +// bytes, err := proto.Marshal(msg) +// if err != nil { +// log.NewError(operationID, utils.GetSelfFuncName(), "proto marshal failed ", err.Error(), msg.String()) +// return utils.Wrap(err, "") +// } +// updateResult, err := c.UpdateOne(ctx, bson.M{"uid": suffixUserID}, bson.M{"$set": bson.M{s: bytes}}) +// log.NewInfo(operationID, utils.GetSelfFuncName(), updateResult) +// if err != nil { +// log.NewError(operationID, utils.GetSelfFuncName(), "UpdateOne", err.Error()) +// return utils.Wrap(err, "") +// } +// return nil +//} -func (d *db.DataBases) ReplaceMsgBySeq(uid string, msg *open_im_sdk.MsgData, operationID string) error { - log.NewInfo(operationID, utils.GetSelfFuncName(), uid, *msg) - ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second) - c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cChat) - uid = getSeqUid(uid, msg.Seq) - seqIndex := getMsgIndex(msg.Seq) - s := fmt.Sprintf("msg.%d.msg", seqIndex) - log.NewDebug(operationID, utils.GetSelfFuncName(), seqIndex, s) - bytes, err := proto.Marshal(msg) - if err != nil { - log.NewError(operationID, utils.GetSelfFuncName(), "proto marshal", err.Error()) - return utils.Wrap(err, "") - } - - updateResult, err := c.UpdateOne( - ctx, bson.M{"uid": uid}, - bson.M{"$set": bson.M{s: bytes}}) - log.NewInfo(operationID, utils.GetSelfFuncName(), updateResult) - if err != nil { - log.NewError(operationID, utils.GetSelfFuncName(), "UpdateOne", err.Error()) - return utils.Wrap(err, "") - } - return nil -} - -func (d *db.DataBases) UpdateOneMsgList(msg *UserChat) error { - ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second) - c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cChat) - _, err := c.UpdateOne(ctx, bson.M{"uid": msg.UID}, bson.M{"$set": bson.M{"msg": msg.Msg}}) - return err -} - -func (d *db.DataBases) GetMsgBySeqList(uid string, seqList []uint32, operationID string) (seqMsg []*open_im_sdk.MsgData, err error) { - log.NewInfo(operationID, utils.GetSelfFuncName(), uid, seqList) - var hasSeqList []uint32 - singleCount := 0 - session := d.mgoSession.Clone() - if session == nil { - return nil, errors.New("session == nil") - } - defer session.Close() - c := session.DB(config.Config.Mongo.DBDatabase).C(cChat) - m := func(uid string, seqList []uint32) map[string][]uint32 { - t := make(map[string][]uint32) - for i := 0; i < len(seqList); i++ { - seqUid := getSeqUid(uid, seqList[i]) - if value, ok := t[seqUid]; !ok { - var temp []uint32 - t[seqUid] = append(temp, seqList[i]) - } else { - t[seqUid] = append(value, seqList[i]) - } - } - return t - }(uid, seqList) - sChat := UserChat{} - for seqUid, value := range m { - if err = c.Find(bson.M{"uid": seqUid}).One(&sChat); err != nil { - log.NewError(operationID, "not find seqUid", seqUid, value, uid, seqList, err.Error()) - continue - } - singleCount = 0 - for i := 0; i < len(sChat.Msg); i++ { - msg := new(open_im_sdk.MsgData) - if err = proto.Unmarshal(sChat.Msg[i].Msg, msg); err != nil { - log.NewError(operationID, "Unmarshal err", seqUid, value, uid, seqList, err.Error()) - return nil, err - } - if isContainInt32(msg.Seq, value) { - seqMsg = append(seqMsg, msg) - hasSeqList = append(hasSeqList, msg.Seq) - singleCount++ - if singleCount == len(value) { - break - } - } - } - } - if len(hasSeqList) != len(seqList) { - var diff []uint32 - diff = utils.Difference(hasSeqList, seqList) - exceptionMSg := genExceptionMessageBySeqList(diff) - seqMsg = append(seqMsg, exceptionMSg...) - - } - return seqMsg, nil -} - -func (d *db.DataBases) GetUserMsgListByIndex(ID string, index int64) (*UserChat, error) { - ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second) - c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cChat) - regex := fmt.Sprintf("^%s", ID) - findOpts := options.Find().SetLimit(1).SetSkip(index).SetSort(bson.M{"uid": 1}) - var msgs []UserChat - //primitive.Regex{Pattern: regex} - cursor, err := c.Find(ctx, bson.M{"uid": primitive.Regex{Pattern: regex}}, findOpts) - if err != nil { - return nil, utils.Wrap(err, "") - } - err = cursor.All(context.Background(), &msgs) - if err != nil { - return nil, utils.Wrap(err, fmt.Sprintf("cursor is %s", cursor.Current.String())) - } - if len(msgs) > 0 { - return &msgs[0], nil - } else { - return nil, ErrMsgListNotExist - } -} - -func (d *db.DataBases) DelMongoMsgs(IDList []string) error { - ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second) - c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cChat) - _, err := c.DeleteMany(ctx, bson.M{"uid": bson.M{"$in": IDList}}) - return err -} - -func (d *db.DataBases) ReplaceMsgToBlankByIndex(suffixID string, index int) (replaceMaxSeq uint32, err error) { - ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second) - c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cChat) - userChat := &UserChat{} - err = c.FindOne(ctx, bson.M{"uid": suffixID}).Decode(&userChat) - if err != nil { - return 0, err - } - for i, msg := range userChat.Msg { - if i <= index { - msgPb := &open_im_sdk.MsgData{} - if err = proto.Unmarshal(msg.Msg, msgPb); err != nil { - continue - } - newMsgPb := &open_im_sdk.MsgData{Seq: msgPb.Seq} - bytes, err := proto.Marshal(newMsgPb) - if err != nil { - continue - } - msg.Msg = bytes - msg.SendTime = 0 - replaceMaxSeq = msgPb.Seq - } - } - _, err = c.UpdateOne(ctx, bson.M{"uid": suffixID}, bson.M{"$set": bson.M{"msg": userChat.Msg}}) - return replaceMaxSeq, err -} - -func (d *db.DataBases) GetNewestMsg(ID string) (msg *open_im_sdk.MsgData, err error) { - ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second) - c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cChat) - regex := fmt.Sprintf("^%s", ID) - findOpts := options.Find().SetLimit(1).SetSort(bson.M{"uid": -1}) - var userChats []UserChat - cursor, err := c.Find(ctx, bson.M{"uid": bson.M{"$regex": regex}}, findOpts) - if err != nil { - return nil, err - } - err = cursor.All(ctx, &userChats) - if err != nil { - return nil, utils.Wrap(err, "") - } - if len(userChats) > 0 { - if len(userChats[0].Msg) > 0 { - msgPb := &open_im_sdk.MsgData{} - err = proto.Unmarshal(userChats[0].Msg[len(userChats[0].Msg)-1].Msg, msgPb) - if err != nil { - return nil, utils.Wrap(err, "") - } - return msgPb, nil - } - return nil, errors.New("len(userChats[0].Msg) < 0") - } - return nil, nil -} - -func (d *db.DataBases) GetOldestMsg(ID string) (msg *open_im_sdk.MsgData, err error) { - ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second) - c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cChat) - regex := fmt.Sprintf("^%s", ID) - findOpts := options.Find().SetLimit(1).SetSort(bson.M{"uid": 1}) - var userChats []UserChat - cursor, err := c.Find(ctx, bson.M{"uid": bson.M{"$regex": regex}}, findOpts) - if err != nil { - return nil, err - } - err = cursor.All(ctx, &userChats) - if err != nil { - return nil, utils.Wrap(err, "") - } - var oldestMsg []byte - if len(userChats) > 0 { - for _, v := range userChats[0].Msg { - if v.SendTime != 0 { - oldestMsg = v.Msg - break - } - } - if len(oldestMsg) == 0 { - oldestMsg = userChats[0].Msg[len(userChats[0].Msg)-1].Msg - } - msgPb := &open_im_sdk.MsgData{} - err = proto.Unmarshal(oldestMsg, msgPb) - if err != nil { - return nil, utils.Wrap(err, "") - } - return msgPb, nil - } - return nil, nil -} - -func (d *db.DataBases) GetMsgBySeqListMongo2(uid string, seqList []uint32, operationID string) (seqMsg []*open_im_sdk.MsgData, err error) { - var hasSeqList []uint32 - singleCount := 0 - ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second) - c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cChat) - - m := func(uid string, seqList []uint32) map[string][]uint32 { - t := make(map[string][]uint32) - for i := 0; i < len(seqList); i++ { - seqUid := getSeqUid(uid, seqList[i]) - if value, ok := t[seqUid]; !ok { - var temp []uint32 - t[seqUid] = append(temp, seqList[i]) - } else { - t[seqUid] = append(value, seqList[i]) - } - } - return t - }(uid, seqList) - sChat := UserChat{} - for seqUid, value := range m { - if err = c.FindOne(ctx, bson.M{"uid": seqUid}).Decode(&sChat); err != nil { - log.NewError(operationID, "not find seqUid", seqUid, value, uid, seqList, err.Error()) - continue - } - singleCount = 0 - for i := 0; i < len(sChat.Msg); i++ { - msg := new(open_im_sdk.MsgData) - if err = proto.Unmarshal(sChat.Msg[i].Msg, msg); err != nil { - log.NewError(operationID, "Unmarshal err", seqUid, value, uid, seqList, err.Error()) - return nil, err - } - if isContainInt32(msg.Seq, value) { - seqMsg = append(seqMsg, msg) - hasSeqList = append(hasSeqList, msg.Seq) - singleCount++ - if singleCount == len(value) { - break - } - } - } - } - if len(hasSeqList) != len(seqList) { - var diff []uint32 - diff = utils.Difference(hasSeqList, seqList) - exceptionMSg := genExceptionMessageBySeqList(diff) - seqMsg = append(seqMsg, exceptionMSg...) - - } - return seqMsg, nil -} -func (d *db.DataBases) GetSuperGroupMsgBySeqListMongo(groupID string, seqList []uint32, operationID string) (seqMsg []*open_im_sdk.MsgData, err error) { - var hasSeqList []uint32 - singleCount := 0 - ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second) - c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cChat) - - m := func(uid string, seqList []uint32) map[string][]uint32 { - t := make(map[string][]uint32) - for i := 0; i < len(seqList); i++ { - seqUid := getSeqUid(uid, seqList[i]) - if value, ok := t[seqUid]; !ok { - var temp []uint32 - t[seqUid] = append(temp, seqList[i]) - } else { - t[seqUid] = append(value, seqList[i]) - } - } - return t - }(groupID, seqList) - sChat := UserChat{} - for seqUid, value := range m { - if err = c.FindOne(ctx, bson.M{"uid": seqUid}).Decode(&sChat); err != nil { - log.NewError(operationID, "not find seqGroupID", seqUid, value, groupID, seqList, err.Error()) - continue - } - singleCount = 0 - for i := 0; i < len(sChat.Msg); i++ { - msg := new(open_im_sdk.MsgData) - if err = proto.Unmarshal(sChat.Msg[i].Msg, msg); err != nil { - log.NewError(operationID, "Unmarshal err", seqUid, value, groupID, seqList, err.Error()) - return nil, err - } - if isContainInt32(msg.Seq, value) { - seqMsg = append(seqMsg, msg) - hasSeqList = append(hasSeqList, msg.Seq) - singleCount++ - if singleCount == len(value) { - break - } - } - } - } - if len(hasSeqList) != len(seqList) { - var diff []uint32 - diff = utils.Difference(hasSeqList, seqList) - exceptionMSg := genExceptionSuperGroupMessageBySeqList(diff, groupID) - seqMsg = append(seqMsg, exceptionMSg...) - - } - return seqMsg, nil -} - -func (d *db.DataBases) GetMsgAndIndexBySeqListInOneMongo2(suffixUserID string, seqList []uint32, operationID string) (seqMsg []*open_im_sdk.MsgData, indexList []int, unexistSeqList []uint32, err error) { - ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second) - c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cChat) - sChat := UserChat{} - if err = c.FindOne(ctx, bson.M{"uid": suffixUserID}).Decode(&sChat); err != nil { - log.NewError(operationID, "not find seqUid", suffixUserID, err.Error()) - return nil, nil, nil, utils.Wrap(err, "") - } - singleCount := 0 - var hasSeqList []uint32 - for i := 0; i < len(sChat.Msg); i++ { - msg := new(open_im_sdk.MsgData) - if err = proto.Unmarshal(sChat.Msg[i].Msg, msg); err != nil { - log.NewError(operationID, "Unmarshal err", msg.String(), err.Error()) - return nil, nil, nil, err - } - if isContainInt32(msg.Seq, seqList) { - indexList = append(indexList, i) - seqMsg = append(seqMsg, msg) - hasSeqList = append(hasSeqList, msg.Seq) - singleCount++ - if singleCount == len(seqList) { - break - } - } - } - for _, i := range seqList { - if isContainInt32(i, hasSeqList) { - continue - } - unexistSeqList = append(unexistSeqList, i) - } - return seqMsg, indexList, unexistSeqList, nil -} - -func genExceptionMessageBySeqList(seqList []uint32) (exceptionMsg []*open_im_sdk.MsgData) { - for _, v := range seqList { - msg := new(open_im_sdk.MsgData) - msg.Seq = v - exceptionMsg = append(exceptionMsg, msg) - } - return exceptionMsg -} - -func genExceptionSuperGroupMessageBySeqList(seqList []uint32, groupID string) (exceptionMsg []*open_im_sdk.MsgData) { - for _, v := range seqList { - msg := new(open_im_sdk.MsgData) - msg.Seq = v - msg.GroupID = groupID - msg.SessionType = constant.SuperGroupChatType - exceptionMsg = append(exceptionMsg, msg) - } - return exceptionMsg -} - -func (d *db.DataBases) SaveUserChatMongo2(uid string, sendTime int64, m *pbMsg.MsgDataToDB) error { - ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second) - c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cChat) - newTime := getCurrentTimestampByMill() - operationID := "" - seqUid := getSeqUid(uid, m.MsgData.Seq) - filter := bson.M{"uid": seqUid} - var err error - sMsg := MsgInfo{} - sMsg.SendTime = sendTime - if sMsg.Msg, err = proto.Marshal(m.MsgData); err != nil { - return utils.Wrap(err, "") - } - err = c.FindOneAndUpdate(ctx, filter, bson.M{"$push": bson.M{"msg": sMsg}}).Err() - log.NewWarn(operationID, "get mgoSession cost time", getCurrentTimestampByMill()-newTime) - if err != nil { - sChat := UserChat{} - sChat.UID = seqUid - sChat.Msg = append(sChat.Msg, sMsg) - if _, err = c.InsertOne(ctx, &sChat); err != nil { - log.NewDebug(operationID, "InsertOne failed", filter) - return utils.Wrap(err, "") - } - } else { - log.NewDebug(operationID, "FindOneAndUpdate ok", filter) - } - - log.NewDebug(operationID, "find mgo uid cost time", getCurrentTimestampByMill()-newTime) - return nil -} +//func (d *db.DataBases) ReplaceMsgBySeq(uid string, msg *open_im_sdk.MsgData, operationID string) error { +// log.NewInfo(operationID, utils.GetSelfFuncName(), uid, *msg) +// ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second) +// c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cChat) +// uid = getSeqUid(uid, msg.Seq) +// seqIndex := getMsgIndex(msg.Seq) +// s := fmt.Sprintf("msg.%d.msg", seqIndex) +// log.NewDebug(operationID, utils.GetSelfFuncName(), seqIndex, s) +// bytes, err := proto.Marshal(msg) +// if err != nil { +// log.NewError(operationID, utils.GetSelfFuncName(), "proto marshal", err.Error()) +// return utils.Wrap(err, "") +// } +// +// updateResult, err := c.UpdateOne( +// ctx, bson.M{"uid": uid}, +// bson.M{"$set": bson.M{s: bytes}}) +// log.NewInfo(operationID, utils.GetSelfFuncName(), updateResult) +// if err != nil { +// log.NewError(operationID, utils.GetSelfFuncName(), "UpdateOne", err.Error()) +// return utils.Wrap(err, "") +// } +// return nil +//} +// +//func (d *db.DataBases) UpdateOneMsgList(msg *UserChat) error { +// ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second) +// c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cChat) +// _, err := c.UpdateOne(ctx, bson.M{"uid": msg.UID}, bson.M{"$set": bson.M{"msg": msg.Msg}}) +// return err +//} +// +//func (d *db.DataBases) GetMsgBySeqList(uid string, seqList []uint32, operationID string) (seqMsg []*open_im_sdk.MsgData, err error) { +// log.NewInfo(operationID, utils.GetSelfFuncName(), uid, seqList) +// var hasSeqList []uint32 +// singleCount := 0 +// session := d.mgoSession.Clone() +// if session == nil { +// return nil, errors.New("session == nil") +// } +// defer session.Close() +// c := session.DB(config.Config.Mongo.DBDatabase).C(cChat) +// m := func(uid string, seqList []uint32) map[string][]uint32 { +// t := make(map[string][]uint32) +// for i := 0; i < len(seqList); i++ { +// seqUid := getSeqUid(uid, seqList[i]) +// if value, ok := t[seqUid]; !ok { +// var temp []uint32 +// t[seqUid] = append(temp, seqList[i]) +// } else { +// t[seqUid] = append(value, seqList[i]) +// } +// } +// return t +// }(uid, seqList) +// sChat := UserChat{} +// for seqUid, value := range m { +// if err = c.Find(bson.M{"uid": seqUid}).One(&sChat); err != nil { +// log.NewError(operationID, "not find seqUid", seqUid, value, uid, seqList, err.Error()) +// continue +// } +// singleCount = 0 +// for i := 0; i < len(sChat.Msg); i++ { +// msg := new(open_im_sdk.MsgData) +// if err = proto.Unmarshal(sChat.Msg[i].Msg, msg); err != nil { +// log.NewError(operationID, "Unmarshal err", seqUid, value, uid, seqList, err.Error()) +// return nil, err +// } +// if isContainInt32(msg.Seq, value) { +// seqMsg = append(seqMsg, msg) +// hasSeqList = append(hasSeqList, msg.Seq) +// singleCount++ +// if singleCount == len(value) { +// break +// } +// } +// } +// } +// if len(hasSeqList) != len(seqList) { +// var diff []uint32 +// diff = utils.Difference(hasSeqList, seqList) +// exceptionMSg := genExceptionMessageBySeqList(diff) +// seqMsg = append(seqMsg, exceptionMSg...) +// +// } +// return seqMsg, nil +//} +// +//func (d *db.DataBases) GetUserMsgListByIndex(ID string, index int64) (*UserChat, error) { +// ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second) +// c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cChat) +// regex := fmt.Sprintf("^%s", ID) +// findOpts := options.Find().SetLimit(1).SetSkip(index).SetSort(bson.M{"uid": 1}) +// var msgs []UserChat +// //primitive.Regex{Pattern: regex} +// cursor, err := c.Find(ctx, bson.M{"uid": primitive.Regex{Pattern: regex}}, findOpts) +// if err != nil { +// return nil, utils.Wrap(err, "") +// } +// err = cursor.All(context.Background(), &msgs) +// if err != nil { +// return nil, utils.Wrap(err, fmt.Sprintf("cursor is %s", cursor.Current.String())) +// } +// if len(msgs) > 0 { +// return &msgs[0], nil +// } else { +// return nil, ErrMsgListNotExist +// } +//} +// +//func (d *db.DataBases) DelMongoMsgs(IDList []string) error { +// ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second) +// c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cChat) +// _, err := c.DeleteMany(ctx, bson.M{"uid": bson.M{"$in": IDList}}) +// return err +//} +// +//func (d *db.DataBases) ReplaceMsgToBlankByIndex(suffixID string, index int) (replaceMaxSeq uint32, err error) { +// ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second) +// c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cChat) +// userChat := &UserChat{} +// err = c.FindOne(ctx, bson.M{"uid": suffixID}).Decode(&userChat) +// if err != nil { +// return 0, err +// } +// for i, msg := range userChat.Msg { +// if i <= index { +// msgPb := &open_im_sdk.MsgData{} +// if err = proto.Unmarshal(msg.Msg, msgPb); err != nil { +// continue +// } +// newMsgPb := &open_im_sdk.MsgData{Seq: msgPb.Seq} +// bytes, err := proto.Marshal(newMsgPb) +// if err != nil { +// continue +// } +// msg.Msg = bytes +// msg.SendTime = 0 +// replaceMaxSeq = msgPb.Seq +// } +// } +// _, err = c.UpdateOne(ctx, bson.M{"uid": suffixID}, bson.M{"$set": bson.M{"msg": userChat.Msg}}) +// return replaceMaxSeq, err +//} +// +//func (d *db.DataBases) GetNewestMsg(ID string) (msg *open_im_sdk.MsgData, err error) { +// ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second) +// c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cChat) +// regex := fmt.Sprintf("^%s", ID) +// findOpts := options.Find().SetLimit(1).SetSort(bson.M{"uid": -1}) +// var userChats []UserChat +// cursor, err := c.Find(ctx, bson.M{"uid": bson.M{"$regex": regex}}, findOpts) +// if err != nil { +// return nil, err +// } +// err = cursor.All(ctx, &userChats) +// if err != nil { +// return nil, utils.Wrap(err, "") +// } +// if len(userChats) > 0 { +// if len(userChats[0].Msg) > 0 { +// msgPb := &open_im_sdk.MsgData{} +// err = proto.Unmarshal(userChats[0].Msg[len(userChats[0].Msg)-1].Msg, msgPb) +// if err != nil { +// return nil, utils.Wrap(err, "") +// } +// return msgPb, nil +// } +// return nil, errors.New("len(userChats[0].Msg) < 0") +// } +// return nil, nil +//} +// +//func (d *db.DataBases) GetOldestMsg(ID string) (msg *open_im_sdk.MsgData, err error) { +// ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second) +// c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cChat) +// regex := fmt.Sprintf("^%s", ID) +// findOpts := options.Find().SetLimit(1).SetSort(bson.M{"uid": 1}) +// var userChats []UserChat +// cursor, err := c.Find(ctx, bson.M{"uid": bson.M{"$regex": regex}}, findOpts) +// if err != nil { +// return nil, err +// } +// err = cursor.All(ctx, &userChats) +// if err != nil { +// return nil, utils.Wrap(err, "") +// } +// var oldestMsg []byte +// if len(userChats) > 0 { +// for _, v := range userChats[0].Msg { +// if v.SendTime != 0 { +// oldestMsg = v.Msg +// break +// } +// } +// if len(oldestMsg) == 0 { +// oldestMsg = userChats[0].Msg[len(userChats[0].Msg)-1].Msg +// } +// msgPb := &open_im_sdk.MsgData{} +// err = proto.Unmarshal(oldestMsg, msgPb) +// if err != nil { +// return nil, utils.Wrap(err, "") +// } +// return msgPb, nil +// } +// return nil, nil +//} +// +//func (d *db.DataBases) GetMsgBySeqListMongo2(uid string, seqList []uint32, operationID string) (seqMsg []*open_im_sdk.MsgData, err error) { +// var hasSeqList []uint32 +// singleCount := 0 +// ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second) +// c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cChat) +// +// m := func(uid string, seqList []uint32) map[string][]uint32 { +// t := make(map[string][]uint32) +// for i := 0; i < len(seqList); i++ { +// seqUid := getSeqUid(uid, seqList[i]) +// if value, ok := t[seqUid]; !ok { +// var temp []uint32 +// t[seqUid] = append(temp, seqList[i]) +// } else { +// t[seqUid] = append(value, seqList[i]) +// } +// } +// return t +// }(uid, seqList) +// sChat := UserChat{} +// for seqUid, value := range m { +// if err = c.FindOne(ctx, bson.M{"uid": seqUid}).Decode(&sChat); err != nil { +// log.NewError(operationID, "not find seqUid", seqUid, value, uid, seqList, err.Error()) +// continue +// } +// singleCount = 0 +// for i := 0; i < len(sChat.Msg); i++ { +// msg := new(open_im_sdk.MsgData) +// if err = proto.Unmarshal(sChat.Msg[i].Msg, msg); err != nil { +// log.NewError(operationID, "Unmarshal err", seqUid, value, uid, seqList, err.Error()) +// return nil, err +// } +// if isContainInt32(msg.Seq, value) { +// seqMsg = append(seqMsg, msg) +// hasSeqList = append(hasSeqList, msg.Seq) +// singleCount++ +// if singleCount == len(value) { +// break +// } +// } +// } +// } +// if len(hasSeqList) != len(seqList) { +// var diff []uint32 +// diff = utils.Difference(hasSeqList, seqList) +// exceptionMSg := genExceptionMessageBySeqList(diff) +// seqMsg = append(seqMsg, exceptionMSg...) +// +// } +// return seqMsg, nil +//} +//func (d *db.DataBases) GetSuperGroupMsgBySeqListMongo(groupID string, seqList []uint32, operationID string) (seqMsg []*open_im_sdk.MsgData, err error) { +// var hasSeqList []uint32 +// singleCount := 0 +// ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second) +// c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cChat) +// +// m := func(uid string, seqList []uint32) map[string][]uint32 { +// t := make(map[string][]uint32) +// for i := 0; i < len(seqList); i++ { +// seqUid := getSeqUid(uid, seqList[i]) +// if value, ok := t[seqUid]; !ok { +// var temp []uint32 +// t[seqUid] = append(temp, seqList[i]) +// } else { +// t[seqUid] = append(value, seqList[i]) +// } +// } +// return t +// }(groupID, seqList) +// sChat := UserChat{} +// for seqUid, value := range m { +// if err = c.FindOne(ctx, bson.M{"uid": seqUid}).Decode(&sChat); err != nil { +// log.NewError(operationID, "not find seqGroupID", seqUid, value, groupID, seqList, err.Error()) +// continue +// } +// singleCount = 0 +// for i := 0; i < len(sChat.Msg); i++ { +// msg := new(open_im_sdk.MsgData) +// if err = proto.Unmarshal(sChat.Msg[i].Msg, msg); err != nil { +// log.NewError(operationID, "Unmarshal err", seqUid, value, groupID, seqList, err.Error()) +// return nil, err +// } +// if isContainInt32(msg.Seq, value) { +// seqMsg = append(seqMsg, msg) +// hasSeqList = append(hasSeqList, msg.Seq) +// singleCount++ +// if singleCount == len(value) { +// break +// } +// } +// } +// } +// if len(hasSeqList) != len(seqList) { +// var diff []uint32 +// diff = utils.Difference(hasSeqList, seqList) +// exceptionMSg := genExceptionSuperGroupMessageBySeqList(diff, groupID) +// seqMsg = append(seqMsg, exceptionMSg...) +// +// } +// return seqMsg, nil +//} +// +//func (d *db.DataBases) GetMsgAndIndexBySeqListInOneMongo2(suffixUserID string, seqList []uint32, operationID string) (seqMsg []*open_im_sdk.MsgData, indexList []int, unexistSeqList []uint32, err error) { +// ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second) +// c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cChat) +// sChat := UserChat{} +// if err = c.FindOne(ctx, bson.M{"uid": suffixUserID}).Decode(&sChat); err != nil { +// log.NewError(operationID, "not find seqUid", suffixUserID, err.Error()) +// return nil, nil, nil, utils.Wrap(err, "") +// } +// singleCount := 0 +// var hasSeqList []uint32 +// for i := 0; i < len(sChat.Msg); i++ { +// msg := new(open_im_sdk.MsgData) +// if err = proto.Unmarshal(sChat.Msg[i].Msg, msg); err != nil { +// log.NewError(operationID, "Unmarshal err", msg.String(), err.Error()) +// return nil, nil, nil, err +// } +// if isContainInt32(msg.Seq, seqList) { +// indexList = append(indexList, i) +// seqMsg = append(seqMsg, msg) +// hasSeqList = append(hasSeqList, msg.Seq) +// singleCount++ +// if singleCount == len(seqList) { +// break +// } +// } +// } +// for _, i := range seqList { +// if isContainInt32(i, hasSeqList) { +// continue +// } +// unexistSeqList = append(unexistSeqList, i) +// } +// return seqMsg, indexList, unexistSeqList, nil +//} +// +//func genExceptionMessageBySeqList(seqList []uint32) (exceptionMsg []*open_im_sdk.MsgData) { +// for _, v := range seqList { +// msg := new(open_im_sdk.MsgData) +// msg.Seq = v +// exceptionMsg = append(exceptionMsg, msg) +// } +// return exceptionMsg +//} +// +//func genExceptionSuperGroupMessageBySeqList(seqList []uint32, groupID string) (exceptionMsg []*open_im_sdk.MsgData) { +// for _, v := range seqList { +// msg := new(open_im_sdk.MsgData) +// msg.Seq = v +// msg.GroupID = groupID +// msg.SessionType = constant.SuperGroupChatType +// exceptionMsg = append(exceptionMsg, msg) +// } +// return exceptionMsg +//} +// +//func (d *db.DataBases) SaveUserChatMongo2(uid string, sendTime int64, m *pbMsg.MsgDataToDB) error { +// ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second) +// c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cChat) +// newTime := getCurrentTimestampByMill() +// operationID := "" +// seqUid := getSeqUid(uid, m.MsgData.Seq) +// filter := bson.M{"uid": seqUid} +// var err error +// sMsg := MsgInfo{} +// sMsg.SendTime = sendTime +// if sMsg.Msg, err = proto.Marshal(m.MsgData); err != nil { +// return utils.Wrap(err, "") +// } +// err = c.FindOneAndUpdate(ctx, filter, bson.M{"$push": bson.M{"msg": sMsg}}).Err() +// log.NewWarn(operationID, "get mgoSession cost time", getCurrentTimestampByMill()-newTime) +// if err != nil { +// sChat := UserChat{} +// sChat.UID = seqUid +// sChat.Msg = append(sChat.Msg, sMsg) +// if _, err = c.InsertOne(ctx, &sChat); err != nil { +// log.NewDebug(operationID, "InsertOne failed", filter) +// return utils.Wrap(err, "") +// } +// } else { +// log.NewDebug(operationID, "FindOneAndUpdate ok", filter) +// } +// +// log.NewDebug(operationID, "find mgo uid cost time", getCurrentTimestampByMill()-newTime) +// return nil +//} // //func (d *DataBases) SaveUserChatListMongo2(uid string, sendTime int64, msgList []*pbMsg.MsgDataToDB) error { @@ -584,59 +528,59 @@ func (d *db.DataBases) SaveUserChatMongo2(uid string, sendTime int64, m *pbMsg.M // return nil //} -func (d *db.DataBases) SaveUserChat(uid string, sendTime int64, m *pbMsg.MsgDataToDB) error { - var seqUid string - newTime := getCurrentTimestampByMill() - session := d.mgoSession.Clone() - if session == nil { - return errors.New("session == nil") - } - defer session.Close() - log.NewDebug("", "get mgoSession cost time", getCurrentTimestampByMill()-newTime) - c := session.DB(config.Config.Mongo.DBDatabase).C(cChat) - seqUid = getSeqUid(uid, m.MsgData.Seq) - n, err := c.Find(bson.M{"uid": seqUid}).Count() - if err != nil { - return err - } - log.NewDebug("", "find mgo uid cost time", getCurrentTimestampByMill()-newTime) - sMsg := MsgInfo{} - sMsg.SendTime = sendTime - if sMsg.Msg, err = proto.Marshal(m.MsgData); err != nil { - return err - } - if n == 0 { - sChat := UserChat{} - sChat.UID = seqUid - sChat.Msg = append(sChat.Msg, sMsg) - err = c.Insert(&sChat) - if err != nil { - return err - } - } else { - err = c.Update(bson.M{"uid": seqUid}, bson.M{"$push": bson.M{"msg": sMsg}}) - if err != nil { - return err - } - } - log.NewDebug("", "insert mgo data cost time", getCurrentTimestampByMill()-newTime) - return nil -} - -func (d *db.DataBases) DelUserChatMongo2(uid string) error { - ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second) - c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cChat) - filter := bson.M{"uid": uid} - - delTime := time.Now().Unix() - int64(config.Config.Mongo.DBRetainChatRecords)*24*3600 - if _, err := c.UpdateOne(ctx, filter, bson.M{"$pull": bson.M{"msg": bson.M{"sendtime": bson.M{"$lte": delTime}}}}); err != nil { - return utils.Wrap(err, "") - } - return nil -} - -func (d *db.DataBases) MgoSkipUID(count int) (string, error) { - return "", nil +//func (d *db.DataBases) SaveUserChat(uid string, sendTime int64, m *pbMsg.MsgDataToDB) error { +// var seqUid string +// newTime := getCurrentTimestampByMill() +// session := d.mgoSession.Clone() +// if session == nil { +// return errors.New("session == nil") +// } +// defer session.Close() +// log.NewDebug("", "get mgoSession cost time", getCurrentTimestampByMill()-newTime) +// c := session.DB(config.Config.Mongo.DBDatabase).C(cChat) +// seqUid = getSeqUid(uid, m.MsgData.Seq) +// n, err := c.Find(bson.M{"uid": seqUid}).Count() +// if err != nil { +// return err +// } +// log.NewDebug("", "find mgo uid cost time", getCurrentTimestampByMill()-newTime) +// sMsg := MsgInfo{} +// sMsg.SendTime = sendTime +// if sMsg.Msg, err = proto.Marshal(m.MsgData); err != nil { +// return err +// } +// if n == 0 { +// sChat := UserChat{} +// sChat.UID = seqUid +// sChat.Msg = append(sChat.Msg, sMsg) +// err = c.Insert(&sChat) +// if err != nil { +// return err +// } +// } else { +// err = c.Update(bson.M{"uid": seqUid}, bson.M{"$push": bson.M{"msg": sMsg}}) +// if err != nil { +// return err +// } +// } +// log.NewDebug("", "insert mgo data cost time", getCurrentTimestampByMill()-newTime) +// return nil +//} +// +//func (d *db.DataBases) DelUserChatMongo2(uid string) error { +// ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second) +// c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cChat) +// filter := bson.M{"uid": uid} +// +// delTime := time.Now().Unix() - int64(config.Config.Mongo.DBRetainChatRecords)*24*3600 +// if _, err := c.UpdateOne(ctx, filter, bson.M{"$pull": bson.M{"msg": bson.M{"sendtime": bson.M{"$lte": delTime}}}}); err != nil { +// return utils.Wrap(err, "") +// } +// return nil +//} +// +//func (d *db.DataBases) MgoSkipUID(count int) (string, error) { +// return "", nil //session := d.mgoSession.Clone() //if session == nil { // return "", errors.New("session == nil") @@ -650,102 +594,83 @@ func (d *db.DataBases) MgoSkipUID(count int) (string, error) { //return sChat.UID, nil } -func generateTagID(tagName, userID string) string { - return utils.Md5(tagName + userID + strconv.Itoa(rand.Int()) + time.Now().String()) -} +//func generateTagID(tagName, userID string) string { +// return utils.Md5(tagName + userID + strconv.Itoa(rand.Int()) + time.Now().String()) +//} -func generateWorkMomentID(userID string) string { - return utils.Md5(userID + strconv.Itoa(rand.Int()) + time.Now().String()) -} +//func generateWorkMomentID(userID string) string { +// return utils.Md5(userID + strconv.Itoa(rand.Int()) + time.Now().String()) +//} -func generateWorkMomentCommentID(workMomentID string) string { - return utils.Md5(workMomentID + strconv.Itoa(rand.Int()) + time.Now().String()) -} +//func generateWorkMomentCommentID(workMomentID string) string { +// return utils.Md5(workMomentID + strconv.Itoa(rand.Int()) + time.Now().String()) +//} -func getCurrentTimestampByMill() int64 { - return time.Now().UnixNano() / 1e6 -} -func GetCurrentTimestampByMill() int64 { - return time.Now().UnixNano() / 1e6 -} +//func getCurrentTimestampByMill() int64 { +// return time.Now().UnixNano() / 1e6 +//} +//func GetCurrentTimestampByMill() int64 { +// return time.Now().UnixNano() / 1e6 +//} -func getSeqUid(uid string, seq uint32) string { - seqSuffix := seq / singleGocMsgNum - return indexGen(uid, seqSuffix) -} +//func getSeqUid(uid string, seq uint32) string { +// seqSuffix := seq / singleGocMsgNum +// return indexGen(uid, seqSuffix) +//} +// +//func getSeqUserIDList(userID string, maxSeq uint32) []string { +// seqMaxSuffix := maxSeq / singleGocMsgNum +// var seqUserIDList []string +// for i := 0; i <= int(seqMaxSuffix); i++ { +// seqUserID := indexGen(userID, uint32(i)) +// seqUserIDList = append(seqUserIDList, seqUserID) +// } +// return seqUserIDList +//} +// +//func getSeqSuperGroupID(groupID string, seq uint32) string { +// seqSuffix := seq / singleGocMsgNum +// return superGroupIndexGen(groupID, seqSuffix) +//} +// +//func GetSeqUid(uid string, seq uint32) string { +// return getSeqUid(uid, seq) +//} +// +//func getMsgIndex(seq uint32) int { +// seqSuffix := seq / singleGocMsgNum +// var index uint32 +// if seqSuffix == 0 { +// index = (seq - seqSuffix*singleGocMsgNum) - 1 +// } else { +// index = seq - seqSuffix*singleGocMsgNum +// } +// return int(index) +//} -func getSeqUserIDList(userID string, maxSeq uint32) []string { - seqMaxSuffix := maxSeq / singleGocMsgNum - var seqUserIDList []string - for i := 0; i <= int(seqMaxSuffix); i++ { - seqUserID := indexGen(userID, uint32(i)) - seqUserIDList = append(seqUserIDList, seqUserID) - } - return seqUserIDList -} +//func isContainInt32(target uint32, List []uint32) bool { +// for _, element := range List { +// if target == element { +// return true +// } +// } +// return false +//} +// +//func isNotContainInt32(target uint32, List []uint32) bool { +// for _, i := range List { +// if i == target { +// return false +// } +// } +// return true +//} +// +//func indexGen(uid string, seqSuffix uint32) string { +// return uid + ":" + strconv.FormatInt(int64(seqSuffix), 10) +//} -func getSeqSuperGroupID(groupID string, seq uint32) string { - seqSuffix := seq / singleGocMsgNum - return superGroupIndexGen(groupID, seqSuffix) -} +//func superGroupIndexGen(groupID string, seqSuffix uint32) string { +// return "super_group_" + groupID + ":" + strconv.FormatInt(int64(seqSuffix), 10) +//} -func GetSeqUid(uid string, seq uint32) string { - return getSeqUid(uid, seq) -} - -func getMsgIndex(seq uint32) int { - seqSuffix := seq / singleGocMsgNum - var index uint32 - if seqSuffix == 0 { - index = (seq - seqSuffix*singleGocMsgNum) - 1 - } else { - index = seq - seqSuffix*singleGocMsgNum - } - return int(index) -} - -func isContainInt32(target uint32, List []uint32) bool { - for _, element := range List { - if target == element { - return true - } - } - return false -} - -func isNotContainInt32(target uint32, List []uint32) bool { - for _, i := range List { - if i == target { - return false - } - } - return true -} - -func indexGen(uid string, seqSuffix uint32) string { - return uid + ":" + strconv.FormatInt(int64(seqSuffix), 10) -} - -func superGroupIndexGen(groupID string, seqSuffix uint32) string { - return "super_group_" + groupID + ":" + strconv.FormatInt(int64(seqSuffix), 10) -} - -func (d *db.DataBases) CleanUpUserMsgFromMongo(userID string, operationID string) error { - ctx := context.Background() - c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cChat) - maxSeq, err := d.GetUserMaxSeq(userID) - if err == redis.Nil { - return nil - } - if err != nil { - return utils.Wrap(err, "") - } - - seqUsers := getSeqUserIDList(userID, uint32(maxSeq)) - log.Error(operationID, "getSeqUserIDList", seqUsers) - _, err = c.DeleteMany(ctx, bson.M{"uid": bson.M{"$in": seqUsers}}) - if err == mongo.ErrNoDocuments { - return nil - } - return utils.Wrap(err, "") -} diff --git a/pkg/common/db/unrelation/msg.go b/pkg/common/db/unrelation/msg.go new file mode 100644 index 000000000..9436b06b3 --- /dev/null +++ b/pkg/common/db/unrelation/msg.go @@ -0,0 +1,582 @@ +package unrelation + +import ( + "Open_IM/pkg/common/constant" + "Open_IM/pkg/common/db/table/unrelation" + "Open_IM/pkg/proto/sdkws" + "Open_IM/pkg/utils" + "context" + "errors" + "github.com/go-redis/redis/v8" + "github.com/gogo/protobuf/sortkeys" + "go.mongodb.org/mongo-driver/bson/primitive" + "go.mongodb.org/mongo-driver/mongo" + "go.mongodb.org/mongo-driver/mongo/options" + "sync" + "time" +) + +var ErrMsgListNotExist = errors.New("user not have msg in mongoDB") + +type MsgMongoDriver struct { + mgoDB *mongo.Database + MsgCollection *mongo.Collection +} + +func NewMsgMongoDriver(mgoDB *mongo.Database) *MsgMongoDriver { + return &MsgMongoDriver{mgoDB: mgoDB, MsgCollection: mgoDB.Collection(unrelation.CChat)} +} + +func (m *MsgMongoDriver) DelMsgBySeqList(ctx context.Context, userID string, seqList []uint32) (totalUnExistSeqList []uint32, err error) { + sortkeys.Uint32s(seqList) + suffixUserID2SubSeqList := func(uid string, seqList []uint32) map[string][]uint32 { + t := make(map[string][]uint32) + for i := 0; i < len(seqList); i++ { + seqUid := getSeqUid(uid, seqList[i]) + if value, ok := t[seqUid]; !ok { + var temp []uint32 + t[seqUid] = append(temp, seqList[i]) + } else { + t[seqUid] = append(value, seqList[i]) + } + } + return t + }(userID, seqList) + lock := sync.Mutex{} + var wg sync.WaitGroup + wg.Add(len(suffixUserID2SubSeqList)) + for k, v := range suffixUserID2SubSeqList { + go func(suffixUserID string, subSeqList []uint32) { + defer wg.Done() + unexistSeqList, err := m.DelMsgBySeqListInOneDoc(ctx, suffixUserID, subSeqList) + if err != nil { + return + } + lock.Lock() + totalUnExistSeqList = append(totalUnExistSeqList, unexistSeqList...) + lock.Unlock() + }(k, v) + } + return totalUnExistSeqList, nil +} + +func (m *MsgMongoDriver) DelMsgBySeqListInOneDoc(ctx context.Context, suffixUserID string, seqList []uint32) ([]uint32, error) { + seqMsgList, indexList, unexistSeqList, err := m.GetMsgAndIndexBySeqListInOneMongo2(suffixUserID, seqList) + if err != nil { + return nil, utils.Wrap(err, "") + } + for i, v := range seqMsgList { + if err := m.ReplaceMsgByIndex(suffixUserID, v, operationID, indexList[i]); err != nil { + return nil, utils.Wrap(err, "") + } + } + return unexistSeqList, nil +} + +func (m *MsgMongoDriver) DelMsgLogic(ctx context.Context, uid string, seqList []uint32) error { + sortkeys.Uint32s(seqList) + seqMsgs, err := d.GetMsgBySeqListMongo2(ctx, uid, seqList) + if err != nil { + return utils.Wrap(err, "") + } + for _, seqMsg := range seqMsgs { + seqMsg.Status = constant.MsgDeleted + if err = d.ReplaceMsgBySeq(ctx, uid, seqMsg); err != nil { + log.NewError(operationID, utils.GetSelfFuncName(), "ReplaceMsgListBySeq error", err.Error()) + } + } + return nil +} + +func (m *MsgMongoDriver) ReplaceMsgByIndex(ctx context.Context, suffixUserID string, msg *sdkws.MsgData, seqIndex int) error { + log.NewInfo(operationID, utils.GetSelfFuncName(), suffixUserID, *msg) + ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second) + c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cChat) + s := fmt.Sprintf("msg.%d.msg", seqIndex) + log.NewDebug(operationID, utils.GetSelfFuncName(), seqIndex, s) + msg.Status = constant.MsgDeleted + bytes, err := proto.Marshal(msg) + if err != nil { + log.NewError(operationID, utils.GetSelfFuncName(), "proto marshal failed ", err.Error(), msg.String()) + return utils.Wrap(err, "") + } + updateResult, err := c.UpdateOne(ctx, bson.M{"uid": suffixUserID}, bson.M{"$set": bson.M{s: bytes}}) + log.NewInfo(operationID, utils.GetSelfFuncName(), updateResult) + if err != nil { + log.NewError(operationID, utils.GetSelfFuncName(), "UpdateOne", err.Error()) + return utils.Wrap(err, "") + } + return nil +} + +func (d *db.DataBases) ReplaceMsgBySeq(uid string, msg *open_im_sdk.MsgData, operationID string) error { + log.NewInfo(operationID, utils.GetSelfFuncName(), uid, *msg) + ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second) + c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cChat) + uid = getSeqUid(uid, msg.Seq) + seqIndex := getMsgIndex(msg.Seq) + s := fmt.Sprintf("msg.%d.msg", seqIndex) + log.NewDebug(operationID, utils.GetSelfFuncName(), seqIndex, s) + bytes, err := proto.Marshal(msg) + if err != nil { + log.NewError(operationID, utils.GetSelfFuncName(), "proto marshal", err.Error()) + return utils.Wrap(err, "") + } + + updateResult, err := c.UpdateOne( + ctx, bson.M{"uid": uid}, + bson.M{"$set": bson.M{s: bytes}}) + log.NewInfo(operationID, utils.GetSelfFuncName(), updateResult) + if err != nil { + log.NewError(operationID, utils.GetSelfFuncName(), "UpdateOne", err.Error()) + return utils.Wrap(err, "") + } + return nil +} + +func (d *db.DataBases) UpdateOneMsgList(msg *UserChat) error { + ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second) + c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cChat) + _, err := c.UpdateOne(ctx, bson.M{"uid": msg.UID}, bson.M{"$set": bson.M{"msg": msg.Msg}}) + return err +} + +func (d *db.DataBases) GetMsgBySeqList(uid string, seqList []uint32, operationID string) (seqMsg []*open_im_sdk.MsgData, err error) { + log.NewInfo(operationID, utils.GetSelfFuncName(), uid, seqList) + var hasSeqList []uint32 + singleCount := 0 + session := d.mgoSession.Clone() + if session == nil { + return nil, errors.New("session == nil") + } + defer session.Close() + c := session.DB(config.Config.Mongo.DBDatabase).C(cChat) + m := func(uid string, seqList []uint32) map[string][]uint32 { + t := make(map[string][]uint32) + for i := 0; i < len(seqList); i++ { + seqUid := getSeqUid(uid, seqList[i]) + if value, ok := t[seqUid]; !ok { + var temp []uint32 + t[seqUid] = append(temp, seqList[i]) + } else { + t[seqUid] = append(value, seqList[i]) + } + } + return t + }(uid, seqList) + sChat := UserChat{} + for seqUid, value := range m { + if err = c.Find(bson.M{"uid": seqUid}).One(&sChat); err != nil { + log.NewError(operationID, "not find seqUid", seqUid, value, uid, seqList, err.Error()) + continue + } + singleCount = 0 + for i := 0; i < len(sChat.Msg); i++ { + msg := new(open_im_sdk.MsgData) + if err = proto.Unmarshal(sChat.Msg[i].Msg, msg); err != nil { + log.NewError(operationID, "Unmarshal err", seqUid, value, uid, seqList, err.Error()) + return nil, err + } + if isContainInt32(msg.Seq, value) { + seqMsg = append(seqMsg, msg) + hasSeqList = append(hasSeqList, msg.Seq) + singleCount++ + if singleCount == len(value) { + break + } + } + } + } + if len(hasSeqList) != len(seqList) { + var diff []uint32 + diff = utils.Difference(hasSeqList, seqList) + exceptionMSg := genExceptionMessageBySeqList(diff) + seqMsg = append(seqMsg, exceptionMSg...) + + } + return seqMsg, nil +} + +func (d *db.DataBases) GetUserMsgListByIndex(ID string, index int64) (*UserChat, error) { + ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second) + c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cChat) + regex := fmt.Sprintf("^%s", ID) + findOpts := options.Find().SetLimit(1).SetSkip(index).SetSort(bson.M{"uid": 1}) + var msgs []UserChat + //primitive.Regex{Pattern: regex} + cursor, err := c.Find(ctx, bson.M{"uid": primitive.Regex{Pattern: regex}}, findOpts) + if err != nil { + return nil, utils.Wrap(err, "") + } + err = cursor.All(context.Background(), &msgs) + if err != nil { + return nil, utils.Wrap(err, fmt.Sprintf("cursor is %s", cursor.Current.String())) + } + if len(msgs) > 0 { + return &msgs[0], nil + } else { + return nil, ErrMsgListNotExist + } +} + +func (d *db.DataBases) DelMongoMsgs(IDList []string) error { + ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second) + c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cChat) + _, err := c.DeleteMany(ctx, bson.M{"uid": bson.M{"$in": IDList}}) + return err +} + +func (d *db.DataBases) ReplaceMsgToBlankByIndex(suffixID string, index int) (replaceMaxSeq uint32, err error) { + ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second) + c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cChat) + userChat := &UserChat{} + err = c.FindOne(ctx, bson.M{"uid": suffixID}).Decode(&userChat) + if err != nil { + return 0, err + } + for i, msg := range userChat.Msg { + if i <= index { + msgPb := &open_im_sdk.MsgData{} + if err = proto.Unmarshal(msg.Msg, msgPb); err != nil { + continue + } + newMsgPb := &open_im_sdk.MsgData{Seq: msgPb.Seq} + bytes, err := proto.Marshal(newMsgPb) + if err != nil { + continue + } + msg.Msg = bytes + msg.SendTime = 0 + replaceMaxSeq = msgPb.Seq + } + } + _, err = c.UpdateOne(ctx, bson.M{"uid": suffixID}, bson.M{"$set": bson.M{"msg": userChat.Msg}}) + return replaceMaxSeq, err +} + +func (d *db.DataBases) GetNewestMsg(ID string) (msg *open_im_sdk.MsgData, err error) { + ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second) + c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cChat) + regex := fmt.Sprintf("^%s", ID) + findOpts := options.Find().SetLimit(1).SetSort(bson.M{"uid": -1}) + var userChats []UserChat + cursor, err := c.Find(ctx, bson.M{"uid": bson.M{"$regex": regex}}, findOpts) + if err != nil { + return nil, err + } + err = cursor.All(ctx, &userChats) + if err != nil { + return nil, utils.Wrap(err, "") + } + if len(userChats) > 0 { + if len(userChats[0].Msg) > 0 { + msgPb := &open_im_sdk.MsgData{} + err = proto.Unmarshal(userChats[0].Msg[len(userChats[0].Msg)-1].Msg, msgPb) + if err != nil { + return nil, utils.Wrap(err, "") + } + return msgPb, nil + } + return nil, errors.New("len(userChats[0].Msg) < 0") + } + return nil, nil +} + +func (d *db.DataBases) GetOldestMsg(ID string) (msg *open_im_sdk.MsgData, err error) { + ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second) + c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cChat) + regex := fmt.Sprintf("^%s", ID) + findOpts := options.Find().SetLimit(1).SetSort(bson.M{"uid": 1}) + var userChats []UserChat + cursor, err := c.Find(ctx, bson.M{"uid": bson.M{"$regex": regex}}, findOpts) + if err != nil { + return nil, err + } + err = cursor.All(ctx, &userChats) + if err != nil { + return nil, utils.Wrap(err, "") + } + var oldestMsg []byte + if len(userChats) > 0 { + for _, v := range userChats[0].Msg { + if v.SendTime != 0 { + oldestMsg = v.Msg + break + } + } + if len(oldestMsg) == 0 { + oldestMsg = userChats[0].Msg[len(userChats[0].Msg)-1].Msg + } + msgPb := &open_im_sdk.MsgData{} + err = proto.Unmarshal(oldestMsg, msgPb) + if err != nil { + return nil, utils.Wrap(err, "") + } + return msgPb, nil + } + return nil, nil +} + +func (d *db.DataBases) GetMsgBySeqListMongo2(uid string, seqList []uint32, operationID string) (seqMsg []*open_im_sdk.MsgData, err error) { + var hasSeqList []uint32 + singleCount := 0 + ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second) + c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cChat) + + m := func(uid string, seqList []uint32) map[string][]uint32 { + t := make(map[string][]uint32) + for i := 0; i < len(seqList); i++ { + seqUid := getSeqUid(uid, seqList[i]) + if value, ok := t[seqUid]; !ok { + var temp []uint32 + t[seqUid] = append(temp, seqList[i]) + } else { + t[seqUid] = append(value, seqList[i]) + } + } + return t + }(uid, seqList) + sChat := UserChat{} + for seqUid, value := range m { + if err = c.FindOne(ctx, bson.M{"uid": seqUid}).Decode(&sChat); err != nil { + log.NewError(operationID, "not find seqUid", seqUid, value, uid, seqList, err.Error()) + continue + } + singleCount = 0 + for i := 0; i < len(sChat.Msg); i++ { + msg := new(open_im_sdk.MsgData) + if err = proto.Unmarshal(sChat.Msg[i].Msg, msg); err != nil { + log.NewError(operationID, "Unmarshal err", seqUid, value, uid, seqList, err.Error()) + return nil, err + } + if isContainInt32(msg.Seq, value) { + seqMsg = append(seqMsg, msg) + hasSeqList = append(hasSeqList, msg.Seq) + singleCount++ + if singleCount == len(value) { + break + } + } + } + } + if len(hasSeqList) != len(seqList) { + var diff []uint32 + diff = utils.Difference(hasSeqList, seqList) + exceptionMSg := genExceptionMessageBySeqList(diff) + seqMsg = append(seqMsg, exceptionMSg...) + + } + return seqMsg, nil +} +func (d *db.DataBases) GetSuperGroupMsgBySeqListMongo(groupID string, seqList []uint32, operationID string) (seqMsg []*open_im_sdk.MsgData, err error) { + var hasSeqList []uint32 + singleCount := 0 + ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second) + c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cChat) + + m := func(uid string, seqList []uint32) map[string][]uint32 { + t := make(map[string][]uint32) + for i := 0; i < len(seqList); i++ { + seqUid := getSeqUid(uid, seqList[i]) + if value, ok := t[seqUid]; !ok { + var temp []uint32 + t[seqUid] = append(temp, seqList[i]) + } else { + t[seqUid] = append(value, seqList[i]) + } + } + return t + }(groupID, seqList) + sChat := UserChat{} + for seqUid, value := range m { + if err = c.FindOne(ctx, bson.M{"uid": seqUid}).Decode(&sChat); err != nil { + log.NewError(operationID, "not find seqGroupID", seqUid, value, groupID, seqList, err.Error()) + continue + } + singleCount = 0 + for i := 0; i < len(sChat.Msg); i++ { + msg := new(open_im_sdk.MsgData) + if err = proto.Unmarshal(sChat.Msg[i].Msg, msg); err != nil { + log.NewError(operationID, "Unmarshal err", seqUid, value, groupID, seqList, err.Error()) + return nil, err + } + if isContainInt32(msg.Seq, value) { + seqMsg = append(seqMsg, msg) + hasSeqList = append(hasSeqList, msg.Seq) + singleCount++ + if singleCount == len(value) { + break + } + } + } + } + if len(hasSeqList) != len(seqList) { + var diff []uint32 + diff = utils.Difference(hasSeqList, seqList) + exceptionMSg := genExceptionSuperGroupMessageBySeqList(diff, groupID) + seqMsg = append(seqMsg, exceptionMSg...) + + } + return seqMsg, nil +} + +func (d *db.DataBases) GetMsgAndIndexBySeqListInOneMongo2(suffixUserID string, seqList []uint32, operationID string) (seqMsg []*open_im_sdk.MsgData, indexList []int, unexistSeqList []uint32, err error) { + ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second) + c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cChat) + sChat := UserChat{} + if err = c.FindOne(ctx, bson.M{"uid": suffixUserID}).Decode(&sChat); err != nil { + log.NewError(operationID, "not find seqUid", suffixUserID, err.Error()) + return nil, nil, nil, utils.Wrap(err, "") + } + singleCount := 0 + var hasSeqList []uint32 + for i := 0; i < len(sChat.Msg); i++ { + msg := new(open_im_sdk.MsgData) + if err = proto.Unmarshal(sChat.Msg[i].Msg, msg); err != nil { + log.NewError(operationID, "Unmarshal err", msg.String(), err.Error()) + return nil, nil, nil, err + } + if isContainInt32(msg.Seq, seqList) { + indexList = append(indexList, i) + seqMsg = append(seqMsg, msg) + hasSeqList = append(hasSeqList, msg.Seq) + singleCount++ + if singleCount == len(seqList) { + break + } + } + } + for _, i := range seqList { + if isContainInt32(i, hasSeqList) { + continue + } + unexistSeqList = append(unexistSeqList, i) + } + return seqMsg, indexList, unexistSeqList, nil +} + +func genExceptionMessageBySeqList(seqList []uint32) (exceptionMsg []*open_im_sdk.MsgData) { + for _, v := range seqList { + msg := new(open_im_sdk.MsgData) + msg.Seq = v + exceptionMsg = append(exceptionMsg, msg) + } + return exceptionMsg +} + +func genExceptionSuperGroupMessageBySeqList(seqList []uint32, groupID string) (exceptionMsg []*open_im_sdk.MsgData) { + for _, v := range seqList { + msg := new(open_im_sdk.MsgData) + msg.Seq = v + msg.GroupID = groupID + msg.SessionType = constant.SuperGroupChatType + exceptionMsg = append(exceptionMsg, msg) + } + return exceptionMsg +} + +func (d *db.DataBases) SaveUserChatMongo2(uid string, sendTime int64, m *pbMsg.MsgDataToDB) error { + ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second) + c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cChat) + newTime := getCurrentTimestampByMill() + operationID := "" + seqUid := getSeqUid(uid, m.MsgData.Seq) + filter := bson.M{"uid": seqUid} + var err error + sMsg := MsgInfo{} + sMsg.SendTime = sendTime + if sMsg.Msg, err = proto.Marshal(m.MsgData); err != nil { + return utils.Wrap(err, "") + } + err = c.FindOneAndUpdate(ctx, filter, bson.M{"$push": bson.M{"msg": sMsg}}).Err() + log.NewWarn(operationID, "get mgoSession cost time", getCurrentTimestampByMill()-newTime) + if err != nil { + sChat := UserChat{} + sChat.UID = seqUid + sChat.Msg = append(sChat.Msg, sMsg) + if _, err = c.InsertOne(ctx, &sChat); err != nil { + log.NewDebug(operationID, "InsertOne failed", filter) + return utils.Wrap(err, "") + } + } else { + log.NewDebug(operationID, "FindOneAndUpdate ok", filter) + } + + log.NewDebug(operationID, "find mgo uid cost time", getCurrentTimestampByMill()-newTime) + return nil +} + +func (d *db.DataBases) SaveUserChat(uid string, sendTime int64, m *pbMsg.MsgDataToDB) error { + var seqUid string + newTime := getCurrentTimestampByMill() + session := d.mgoSession.Clone() + if session == nil { + return errors.New("session == nil") + } + defer session.Close() + log.NewDebug("", "get mgoSession cost time", getCurrentTimestampByMill()-newTime) + c := session.DB(config.Config.Mongo.DBDatabase).C(cChat) + seqUid = getSeqUid(uid, m.MsgData.Seq) + n, err := c.Find(bson.M{"uid": seqUid}).Count() + if err != nil { + return err + } + log.NewDebug("", "find mgo uid cost time", getCurrentTimestampByMill()-newTime) + sMsg := MsgInfo{} + sMsg.SendTime = sendTime + if sMsg.Msg, err = proto.Marshal(m.MsgData); err != nil { + return err + } + if n == 0 { + sChat := UserChat{} + sChat.UID = seqUid + sChat.Msg = append(sChat.Msg, sMsg) + err = c.Insert(&sChat) + if err != nil { + return err + } + } else { + err = c.Update(bson.M{"uid": seqUid}, bson.M{"$push": bson.M{"msg": sMsg}}) + if err != nil { + return err + } + } + log.NewDebug("", "insert mgo data cost time", getCurrentTimestampByMill()-newTime) + return nil +} + +func (d *db.DataBases) DelUserChatMongo2(uid string) error { + ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second) + c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cChat) + filter := bson.M{"uid": uid} + + delTime := time.Now().Unix() - int64(config.Config.Mongo.DBRetainChatRecords)*24*3600 + if _, err := c.UpdateOne(ctx, filter, bson.M{"$pull": bson.M{"msg": bson.M{"sendtime": bson.M{"$lte": delTime}}}}); err != nil { + return utils.Wrap(err, "") + } + return nil +} + +func (d *db.DataBases) MgoSkipUID(count int) (string, error) { + return "", nil +} + +func (d *db.DataBases) CleanUpUserMsgFromMongo(userID string, operationID string) error { + ctx := context.Background() + c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cChat) + maxSeq, err := d.GetUserMaxSeq(userID) + if err == redis.Nil { + return nil + } + if err != nil { + return utils.Wrap(err, "") + } + + seqUsers := getSeqUserIDList(userID, uint32(maxSeq)) + log.Error(operationID, "getSeqUserIDList", seqUsers) + _, err = c.DeleteMany(ctx, bson.M{"uid": bson.M{"$in": seqUsers}}) + if err == mongo.ErrNoDocuments { + return nil + } + return utils.Wrap(err, "") +} diff --git a/pkg/common/db/unrelation/super_group.go b/pkg/common/db/unrelation/super_group.go index 5943990a2..a5763ea56 100644 --- a/pkg/common/db/unrelation/super_group.go +++ b/pkg/common/db/unrelation/super_group.go @@ -111,20 +111,6 @@ type SuperGroupMongoDriver struct { // panic("implement me") // } -func (s *SuperGroupMongoDriver) Transaction(ctx context.Context, fn func(s unrelation.SuperGroupModelInterface, tx any) error) error { - sess, err := s.MgoClient.StartSession() - if err != nil { - return err - } - txCtx := mongo.NewSessionContext(ctx, sess) - defer sess.EndSession(txCtx) - if err := fn(s, txCtx); err != nil { - _ = sess.AbortTransaction(txCtx) - return err - } - return utils.Wrap(sess.CommitTransaction(txCtx), "") -} - func (s *SuperGroupMongoDriver) getTxCtx(ctx context.Context, tx []any) context.Context { if len(tx) > 0 { if ctx, ok := tx[0].(mongo.SessionContext); ok { diff --git a/pkg/common/db/unrelation/tag.go b/pkg/common/db/unrelation/tag.go index ba8856ac6..6e61f4260 100644 --- a/pkg/common/db/unrelation/tag.go +++ b/pkg/common/db/unrelation/tag.go @@ -7,6 +7,9 @@ import ( "go.mongodb.org/mongo-driver/bson" "go.mongodb.org/mongo-driver/mongo" "go.mongodb.org/mongo-driver/mongo/options" + "math/rand" + "strconv" + "time" ) type TagMongoDriver struct { @@ -19,6 +22,10 @@ func NewTagMongoDriver(mgoDB *mongo.Database) *TagMongoDriver { return &TagMongoDriver{mgoDB: mgoDB, TagCollection: mgoDB.Collection(unrelation.CTag), TagSendLogCollection: mgoDB.Collection(unrelation.CSendLog)} } +func (db *TagMongoDriver) generateTagID(tagName, userID string) string { + return utils.Md5(tagName + userID + strconv.Itoa(rand.Int()) + time.Now().String()) +} + func (db *TagMongoDriver) GetUserTags(ctx context.Context, userID string) ([]unrelation.TagModel, error) { var tags []unrelation.TagModel cursor, err := db.TagCollection.Find(ctx, bson.M{"user_id": userID}) diff --git a/pkg/common/db/unrelation/work_moment.go b/pkg/common/db/unrelation/work_moment.go index 0a83cefa2..788e4ea6b 100644 --- a/pkg/common/db/unrelation/work_moment.go +++ b/pkg/common/db/unrelation/work_moment.go @@ -4,10 +4,13 @@ import ( "Open_IM/pkg/common/config" "Open_IM/pkg/common/constant" "Open_IM/pkg/common/db/table/unrelation" + "Open_IM/pkg/utils" "context" "go.mongodb.org/mongo-driver/bson" "go.mongodb.org/mongo-driver/mongo" "go.mongodb.org/mongo-driver/mongo/options" + "math/rand" + "strconv" "time" ) @@ -20,8 +23,16 @@ func NewWorkMomentMongoDriver(mgoDB *mongo.Database) *WorkMomentMongoDriver { return &WorkMomentMongoDriver{mgoDB: mgoDB, WorkMomentCollection: mgoDB.Collection(unrelation.CWorkMoment)} } +func (db *WorkMomentMongoDriver) generateWorkMomentID(userID string) string { + return utils.Md5(userID + strconv.Itoa(rand.Int()) + time.Now().String()) +} + +func (db *WorkMomentMongoDriver) generateWorkMomentCommentID(workMomentID string) string { + return utils.Md5(workMomentID + strconv.Itoa(rand.Int()) + time.Now().String()) +} + func (db *WorkMomentMongoDriver) CreateOneWorkMoment(ctx context.Context, workMoment *unrelation.WorkMoment) error { - workMomentID := generateWorkMomentID(workMoment.UserID) + workMomentID := db.generateWorkMomentID(workMoment.UserID) workMoment.WorkMomentID = workMomentID workMoment.CreateTime = int32(time.Now().Unix()) _, err := db.WorkMomentCollection.InsertOne(ctx, workMoment) diff --git a/pkg/proto/admin_cms/admin_cms.pb.go b/pkg/proto/admincms/admin_cms.pb.go similarity index 96% rename from pkg/proto/admin_cms/admin_cms.pb.go rename to pkg/proto/admincms/admin_cms.pb.go index 25cf400f8..eceff09bb 100644 --- a/pkg/proto/admin_cms/admin_cms.pb.go +++ b/pkg/proto/admincms/admin_cms.pb.go @@ -1,12 +1,12 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // source: admin_cms/admin_cms.proto -package admin_cms // import "Open_IM/pkg/proto/admin_cms" +package admincms // import "Open_IM/pkg/proto/admin_cms" import proto "github.com/golang/protobuf/proto" import fmt "fmt" import math "math" -import sdk_ws "Open_IM/pkg/proto/sdk_ws" +import sdkws "Open_IM/pkg/proto/sdkws" import ( context "golang.org/x/net/context" @@ -125,16 +125,16 @@ func (m *AdminLoginResp) GetFaceURL() string { } type GetChatLogsReq struct { - Content string `protobuf:"bytes,1,opt,name=content" json:"content,omitempty"` - SendID string `protobuf:"bytes,2,opt,name=sendID" json:"sendID,omitempty"` - RecvID string `protobuf:"bytes,3,opt,name=recvID" json:"recvID,omitempty"` - SendTime string `protobuf:"bytes,4,opt,name=sendTime" json:"sendTime,omitempty"` - SessionType int32 `protobuf:"varint,5,opt,name=sessionType" json:"sessionType,omitempty"` - ContentType int32 `protobuf:"varint,6,opt,name=contentType" json:"contentType,omitempty"` - Pagination *sdk_ws.RequestPagination `protobuf:"bytes,7,opt,name=pagination" json:"pagination,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Content string `protobuf:"bytes,1,opt,name=content" json:"content,omitempty"` + SendID string `protobuf:"bytes,2,opt,name=sendID" json:"sendID,omitempty"` + RecvID string `protobuf:"bytes,3,opt,name=recvID" json:"recvID,omitempty"` + SendTime string `protobuf:"bytes,4,opt,name=sendTime" json:"sendTime,omitempty"` + SessionType int32 `protobuf:"varint,5,opt,name=sessionType" json:"sessionType,omitempty"` + ContentType int32 `protobuf:"varint,6,opt,name=contentType" json:"contentType,omitempty"` + Pagination *sdkws.RequestPagination `protobuf:"bytes,7,opt,name=pagination" json:"pagination,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetChatLogsReq) Reset() { *m = GetChatLogsReq{} } @@ -203,7 +203,7 @@ func (m *GetChatLogsReq) GetContentType() int32 { return 0 } -func (m *GetChatLogsReq) GetPagination() *sdk_ws.RequestPagination { +func (m *GetChatLogsReq) GetPagination() *sdkws.RequestPagination { if m != nil { return m.Pagination } @@ -1107,14 +1107,14 @@ func (m *GetUserStatisticsResp) GetTotalUserNumList() []*DateNumList { } type GetUserFriendsReq struct { - OperationID string `protobuf:"bytes,1,opt,name=operationID" json:"operationID,omitempty"` - UserID string `protobuf:"bytes,2,opt,name=userID" json:"userID,omitempty"` - FriendUserID string `protobuf:"bytes,3,opt,name=friendUserID" json:"friendUserID,omitempty"` - FriendUserName string `protobuf:"bytes,4,opt,name=friendUserName" json:"friendUserName,omitempty"` - Pagination *sdk_ws.RequestPagination `protobuf:"bytes,5,opt,name=pagination" json:"pagination,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + OperationID string `protobuf:"bytes,1,opt,name=operationID" json:"operationID,omitempty"` + UserID string `protobuf:"bytes,2,opt,name=userID" json:"userID,omitempty"` + FriendUserID string `protobuf:"bytes,3,opt,name=friendUserID" json:"friendUserID,omitempty"` + FriendUserName string `protobuf:"bytes,4,opt,name=friendUserName" json:"friendUserName,omitempty"` + Pagination *sdkws.RequestPagination `protobuf:"bytes,5,opt,name=pagination" json:"pagination,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetUserFriendsReq) Reset() { *m = GetUserFriendsReq{} } @@ -1169,7 +1169,7 @@ func (m *GetUserFriendsReq) GetFriendUserName() string { return "" } -func (m *GetUserFriendsReq) GetPagination() *sdk_ws.RequestPagination { +func (m *GetUserFriendsReq) GetPagination() *sdkws.RequestPagination { if m != nil { return m.Pagination } @@ -1177,11 +1177,11 @@ func (m *GetUserFriendsReq) GetPagination() *sdk_ws.RequestPagination { } type GetUserFriendsResp struct { - FriendInfoList []*sdk_ws.FriendInfo `protobuf:"bytes,2,rep,name=friendInfoList" json:"friendInfoList,omitempty"` - FriendNums int32 `protobuf:"varint,3,opt,name=friendNums" json:"friendNums,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + FriendInfoList []*sdkws.FriendInfo `protobuf:"bytes,2,rep,name=friendInfoList" json:"friendInfoList,omitempty"` + FriendNums int32 `protobuf:"varint,3,opt,name=friendNums" json:"friendNums,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetUserFriendsResp) Reset() { *m = GetUserFriendsResp{} } @@ -1208,7 +1208,7 @@ func (m *GetUserFriendsResp) XXX_DiscardUnknown() { var xxx_messageInfo_GetUserFriendsResp proto.InternalMessageInfo -func (m *GetUserFriendsResp) GetFriendInfoList() []*sdk_ws.FriendInfo { +func (m *GetUserFriendsResp) GetFriendInfoList() []*sdkws.FriendInfo { if m != nil { return m.FriendInfoList } diff --git a/pkg/proto/admin_cms/admin_cms.proto b/pkg/proto/admincms/admin_cms.proto similarity index 92% rename from pkg/proto/admin_cms/admin_cms.proto rename to pkg/proto/admincms/admin_cms.proto index 83c5dd2d1..b71517596 100644 --- a/pkg/proto/admin_cms/admin_cms.proto +++ b/pkg/proto/admincms/admin_cms.proto @@ -1,7 +1,7 @@ syntax = "proto3"; -option go_package = "Open_IM/pkg/proto/admin_cms;admin_cms"; -import "Open-IM-Server/pkg/proto/sdk_ws/ws.proto"; -package admin_cms; +option go_package = "Open_IM/pkg/proto/admincms;admincms"; +import "Open-IM-Server/pkg/proto/sdkws/ws.proto"; +package admincms; message AdminLoginReq { string adminID = 2; @@ -21,7 +21,7 @@ message GetChatLogsReq { string sendTime = 4; int32 sessionType = 5; int32 contentType = 6; - server_api_params.RequestPagination pagination = 7; + sdkws.RequestPagination pagination = 7; } message ChatLog { @@ -134,11 +134,11 @@ message GetUserFriendsReq { string userID = 2; string friendUserID = 3; string friendUserName = 4; - server_api_params.RequestPagination pagination = 5; + sdkws.RequestPagination pagination = 5; } message GetUserFriendsResp { - repeated server_api_params.FriendInfo friendInfoList = 2; + repeated sdkws.FriendInfo friendInfoList = 2; int32 friendNums = 3; } diff --git a/pkg/proto/auth/auth.pb.go b/pkg/proto/auth/auth.pb.go index 5316943c5..ade02c87e 100644 --- a/pkg/proto/auth/auth.pb.go +++ b/pkg/proto/auth/auth.pb.go @@ -6,7 +6,7 @@ package pbAuth // import "Open_IM/pkg/proto/auth" import proto "github.com/golang/protobuf/proto" import fmt "fmt" import math "math" -import _ "Open_IM/pkg/proto/sdk_ws" +import _ "Open_IM/pkg/proto/sdkws" import ( context "golang.org/x/net/context" diff --git a/pkg/proto/auth/auth.proto b/pkg/proto/auth/auth.proto index 6c2edecfd..ae0483a71 100644 --- a/pkg/proto/auth/auth.proto +++ b/pkg/proto/auth/auth.proto @@ -1,5 +1,5 @@ syntax = "proto3"; -import "Open-IM-Server/pkg/proto/sdk_ws/ws.proto"; +import "Open-IM-Server/pkg/proto/sdkws/ws.proto"; package pbAuth; option go_package = "Open_IM/pkg/proto/auth;pbAuth"; diff --git a/pkg/proto/auto_proto.sh b/pkg/proto/auto_proto.sh index 60412855c..7fee2beb1 100644 --- a/pkg/proto/auto_proto.sh +++ b/pkg/proto/auto_proto.sh @@ -22,7 +22,7 @@ for ((i = 0; i < ${#filelist[*]}; i++)); do cp $proto ${proto#*./Open_IM/pkg/proto/} done rm Open_IM -rf -#find ./ -type f -path "*.pb.go"|xargs sed -i 's/\".\/sdk_ws\"/\"Open_IM\/pkg\/proto\/sdk_ws\"/g' +#find ./ -type f -path "*.pb.go"|xargs sed -i 's/\".\/sdkws\"/\"Open_IM\/pkg\/proto\/sdkws\"/g' diff --git a/pkg/proto/friend/friend.pb.go b/pkg/proto/friend/friend.pb.go index 33999ee33..960d9ac01 100644 --- a/pkg/proto/friend/friend.pb.go +++ b/pkg/proto/friend/friend.pb.go @@ -6,7 +6,7 @@ package friend // import "Open_IM/pkg/proto/friend" import proto "github.com/golang/protobuf/proto" import fmt "fmt" import math "math" -import sdk_ws "Open_IM/pkg/proto/sdk_ws" +import sdkws "Open_IM/pkg/proto/sdkws" import ( context "golang.org/x/net/context" @@ -71,10 +71,10 @@ func (m *GetPaginationFriendsReq) GetFriendUserIDs() []string { } type GetPaginationFriendsResp struct { - FriendsInfo []*sdk_ws.FriendInfo `protobuf:"bytes,1,rep,name=friendsInfo" json:"friendsInfo,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + FriendsInfo []*sdkws.FriendInfo `protobuf:"bytes,1,rep,name=friendsInfo" json:"friendsInfo,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetPaginationFriendsResp) Reset() { *m = GetPaginationFriendsResp{} } @@ -101,7 +101,7 @@ func (m *GetPaginationFriendsResp) XXX_DiscardUnknown() { var xxx_messageInfo_GetPaginationFriendsResp proto.InternalMessageInfo -func (m *GetPaginationFriendsResp) GetFriendsInfo() []*sdk_ws.FriendInfo { +func (m *GetPaginationFriendsResp) GetFriendsInfo() []*sdkws.FriendInfo { if m != nil { return m.FriendsInfo } @@ -277,11 +277,11 @@ func (m *ImportFriendResp) XXX_DiscardUnknown() { var xxx_messageInfo_ImportFriendResp proto.InternalMessageInfo type GetPaginationFriendsApplyToReq struct { - UserID string `protobuf:"bytes,1,opt,name=userID" json:"userID,omitempty"` - Pagination *sdk_ws.RequestPagination `protobuf:"bytes,2,opt,name=pagination" json:"pagination,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + UserID string `protobuf:"bytes,1,opt,name=userID" json:"userID,omitempty"` + Pagination *sdkws.RequestPagination `protobuf:"bytes,2,opt,name=pagination" json:"pagination,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetPaginationFriendsApplyToReq) Reset() { *m = GetPaginationFriendsApplyToReq{} } @@ -315,7 +315,7 @@ func (m *GetPaginationFriendsApplyToReq) GetUserID() string { return "" } -func (m *GetPaginationFriendsApplyToReq) GetPagination() *sdk_ws.RequestPagination { +func (m *GetPaginationFriendsApplyToReq) GetPagination() *sdkws.RequestPagination { if m != nil { return m.Pagination } @@ -323,11 +323,11 @@ func (m *GetPaginationFriendsApplyToReq) GetPagination() *sdk_ws.RequestPaginati } type GetPaginationFriendsApplyToResp struct { - FriendRequests []*sdk_ws.FriendRequest `protobuf:"bytes,1,rep,name=FriendRequests" json:"FriendRequests,omitempty"` - Total int32 `protobuf:"varint,2,opt,name=total" json:"total,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + FriendRequests []*sdkws.FriendRequest `protobuf:"bytes,1,rep,name=FriendRequests" json:"FriendRequests,omitempty"` + Total int32 `protobuf:"varint,2,opt,name=total" json:"total,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetPaginationFriendsApplyToResp) Reset() { *m = GetPaginationFriendsApplyToResp{} } @@ -354,7 +354,7 @@ func (m *GetPaginationFriendsApplyToResp) XXX_DiscardUnknown() { var xxx_messageInfo_GetPaginationFriendsApplyToResp proto.InternalMessageInfo -func (m *GetPaginationFriendsApplyToResp) GetFriendRequests() []*sdk_ws.FriendRequest { +func (m *GetPaginationFriendsApplyToResp) GetFriendRequests() []*sdkws.FriendRequest { if m != nil { return m.FriendRequests } @@ -369,11 +369,11 @@ func (m *GetPaginationFriendsApplyToResp) GetTotal() int32 { } type GetDesignatedFriendsReq struct { - Pagination *sdk_ws.RequestPagination `protobuf:"bytes,1,opt,name=pagination" json:"pagination,omitempty"` - UserID string `protobuf:"bytes,2,opt,name=userID" json:"userID,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Pagination *sdkws.RequestPagination `protobuf:"bytes,1,opt,name=pagination" json:"pagination,omitempty"` + UserID string `protobuf:"bytes,2,opt,name=userID" json:"userID,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetDesignatedFriendsReq) Reset() { *m = GetDesignatedFriendsReq{} } @@ -400,7 +400,7 @@ func (m *GetDesignatedFriendsReq) XXX_DiscardUnknown() { var xxx_messageInfo_GetDesignatedFriendsReq proto.InternalMessageInfo -func (m *GetDesignatedFriendsReq) GetPagination() *sdk_ws.RequestPagination { +func (m *GetDesignatedFriendsReq) GetPagination() *sdkws.RequestPagination { if m != nil { return m.Pagination } @@ -415,11 +415,11 @@ func (m *GetDesignatedFriendsReq) GetUserID() string { } type GetDesignatedFriendsResp struct { - FriendsInfo []*sdk_ws.FriendInfo `protobuf:"bytes,1,rep,name=FriendsInfo" json:"FriendsInfo,omitempty"` - Total int32 `protobuf:"varint,2,opt,name=total" json:"total,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + FriendsInfo []*sdkws.FriendInfo `protobuf:"bytes,1,rep,name=FriendsInfo" json:"FriendsInfo,omitempty"` + Total int32 `protobuf:"varint,2,opt,name=total" json:"total,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetDesignatedFriendsResp) Reset() { *m = GetDesignatedFriendsResp{} } @@ -446,7 +446,7 @@ func (m *GetDesignatedFriendsResp) XXX_DiscardUnknown() { var xxx_messageInfo_GetDesignatedFriendsResp proto.InternalMessageInfo -func (m *GetDesignatedFriendsResp) GetFriendsInfo() []*sdk_ws.FriendInfo { +func (m *GetDesignatedFriendsResp) GetFriendsInfo() []*sdkws.FriendInfo { if m != nil { return m.FriendsInfo } @@ -613,11 +613,11 @@ func (m *RemoveBlackResp) XXX_DiscardUnknown() { var xxx_messageInfo_RemoveBlackResp proto.InternalMessageInfo type GetPaginationBlacksReq struct { - UserID string `protobuf:"bytes,1,opt,name=userID" json:"userID,omitempty"` - Pagination *sdk_ws.RequestPagination `protobuf:"bytes,2,opt,name=pagination" json:"pagination,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + UserID string `protobuf:"bytes,1,opt,name=userID" json:"userID,omitempty"` + Pagination *sdkws.RequestPagination `protobuf:"bytes,2,opt,name=pagination" json:"pagination,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetPaginationBlacksReq) Reset() { *m = GetPaginationBlacksReq{} } @@ -651,7 +651,7 @@ func (m *GetPaginationBlacksReq) GetUserID() string { return "" } -func (m *GetPaginationBlacksReq) GetPagination() *sdk_ws.RequestPagination { +func (m *GetPaginationBlacksReq) GetPagination() *sdkws.RequestPagination { if m != nil { return m.Pagination } @@ -659,11 +659,11 @@ func (m *GetPaginationBlacksReq) GetPagination() *sdk_ws.RequestPagination { } type GetPaginationBlacksResp struct { - Blacks []*sdk_ws.BlackInfo `protobuf:"bytes,1,rep,name=blacks" json:"blacks,omitempty"` - Total int32 `protobuf:"varint,2,opt,name=total" json:"total,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Blacks []*sdkws.BlackInfo `protobuf:"bytes,1,rep,name=blacks" json:"blacks,omitempty"` + Total int32 `protobuf:"varint,2,opt,name=total" json:"total,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetPaginationBlacksResp) Reset() { *m = GetPaginationBlacksResp{} } @@ -690,7 +690,7 @@ func (m *GetPaginationBlacksResp) XXX_DiscardUnknown() { var xxx_messageInfo_GetPaginationBlacksResp proto.InternalMessageInfo -func (m *GetPaginationBlacksResp) GetBlacks() []*sdk_ws.BlackInfo { +func (m *GetPaginationBlacksResp) GetBlacks() []*sdkws.BlackInfo { if m != nil { return m.Blacks } @@ -1142,11 +1142,11 @@ func (m *SetFriendRemarkResp) XXX_DiscardUnknown() { var xxx_messageInfo_SetFriendRemarkResp proto.InternalMessageInfo type GetPaginationFriendsApplyFromReq struct { - UserID string `protobuf:"bytes,1,opt,name=userID" json:"userID,omitempty"` - Pagination *sdk_ws.RequestPagination `protobuf:"bytes,2,opt,name=pagination" json:"pagination,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + UserID string `protobuf:"bytes,1,opt,name=userID" json:"userID,omitempty"` + Pagination *sdkws.RequestPagination `protobuf:"bytes,2,opt,name=pagination" json:"pagination,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetPaginationFriendsApplyFromReq) Reset() { *m = GetPaginationFriendsApplyFromReq{} } @@ -1180,7 +1180,7 @@ func (m *GetPaginationFriendsApplyFromReq) GetUserID() string { return "" } -func (m *GetPaginationFriendsApplyFromReq) GetPagination() *sdk_ws.RequestPagination { +func (m *GetPaginationFriendsApplyFromReq) GetPagination() *sdkws.RequestPagination { if m != nil { return m.Pagination } @@ -1188,11 +1188,11 @@ func (m *GetPaginationFriendsApplyFromReq) GetPagination() *sdk_ws.RequestPagina } type GetPaginationFriendsApplyFromResp struct { - FriendRequests []*sdk_ws.FriendRequest `protobuf:"bytes,1,rep,name=friendRequests" json:"friendRequests,omitempty"` - Total int32 `protobuf:"varint,2,opt,name=total" json:"total,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + FriendRequests []*sdkws.FriendRequest `protobuf:"bytes,1,rep,name=friendRequests" json:"friendRequests,omitempty"` + Total int32 `protobuf:"varint,2,opt,name=total" json:"total,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetPaginationFriendsApplyFromResp) Reset() { *m = GetPaginationFriendsApplyFromResp{} } @@ -1219,7 +1219,7 @@ func (m *GetPaginationFriendsApplyFromResp) XXX_DiscardUnknown() { var xxx_messageInfo_GetPaginationFriendsApplyFromResp proto.InternalMessageInfo -func (m *GetPaginationFriendsApplyFromResp) GetFriendRequests() []*sdk_ws.FriendRequest { +func (m *GetPaginationFriendsApplyFromResp) GetFriendRequests() []*sdkws.FriendRequest { if m != nil { return m.FriendRequests } diff --git a/pkg/proto/friend/friend.proto b/pkg/proto/friend/friend.proto index a7e7df8bd..2120a72bb 100644 --- a/pkg/proto/friend/friend.proto +++ b/pkg/proto/friend/friend.proto @@ -1,5 +1,5 @@ syntax = "proto3"; -import "Open-IM-Server/pkg/proto/sdk_ws/ws.proto"; +import "Open-IM-Server/pkg/proto/sdkws/ws.proto"; option go_package = "Open_IM/pkg/proto/friend;friend"; package friend; @@ -8,7 +8,7 @@ message getPaginationFriendsReq{ repeated string friendUserIDs = 2; } message getPaginationFriendsResp{ - repeated server_api_params.FriendInfo friendsInfo = 1; + repeated sdkws.FriendInfo friendsInfo = 1; } @@ -33,21 +33,21 @@ message importFriendResp{ message getPaginationFriendsApplyToReq{ string userID = 1; - server_api_params.RequestPagination pagination = 2; + sdkws.RequestPagination pagination = 2; } message getPaginationFriendsApplyToResp{ - repeated server_api_params.FriendRequest FriendRequests = 1; + repeated sdkws.FriendRequest FriendRequests = 1; int32 total = 2; } message getDesignatedFriendsReq{ - server_api_params.RequestPagination pagination = 1; + sdkws.RequestPagination pagination = 1; string userID = 2; } message getDesignatedFriendsResp{ - repeated server_api_params.FriendInfo FriendsInfo = 1; + repeated sdkws.FriendInfo FriendsInfo = 1; int32 total = 2; } @@ -69,10 +69,10 @@ message removeBlackResp{ message getPaginationBlacksReq{ string userID = 1; - server_api_params.RequestPagination pagination = 2; + sdkws.RequestPagination pagination = 2; } message getPaginationBlacksResp{ - repeated server_api_params.BlackInfo blacks= 1; + repeated sdkws.BlackInfo blacks= 1; int32 total = 2; } @@ -124,10 +124,10 @@ message setFriendRemarkResp{ message getPaginationFriendsApplyFromReq{ string userID = 1; - server_api_params.RequestPagination pagination = 2; + sdkws.RequestPagination pagination = 2; } message getPaginationFriendsApplyFromResp{ - repeated server_api_params.FriendRequest friendRequests = 1; + repeated sdkws.FriendRequest friendRequests = 1; int32 total = 2; } diff --git a/pkg/proto/group/group.pb.go b/pkg/proto/group/group.pb.go index a125f304d..cbd0cdcf4 100644 --- a/pkg/proto/group/group.pb.go +++ b/pkg/proto/group/group.pb.go @@ -6,7 +6,7 @@ package group // import "Open_IM/pkg/proto/group" import proto "github.com/golang/protobuf/proto" import fmt "fmt" import math "math" -import sdk_ws "Open_IM/pkg/proto/sdk_ws" +import sdkws "Open_IM/pkg/proto/sdkws" import wrapperspb "google.golang.org/protobuf/types/known/wrapperspb" import ( @@ -26,13 +26,13 @@ var _ = math.Inf const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package type CreateGroupReq struct { - InitMembers []string `protobuf:"bytes,1,rep,name=initMembers" json:"initMembers,omitempty"` - GroupInfo *sdk_ws.GroupInfo `protobuf:"bytes,2,opt,name=groupInfo" json:"groupInfo,omitempty"` - AdminUserIDs []string `protobuf:"bytes,3,rep,name=adminUserIDs" json:"adminUserIDs,omitempty"` - OwnerUserID string `protobuf:"bytes,4,opt,name=ownerUserID" json:"ownerUserID,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + InitMembers []string `protobuf:"bytes,1,rep,name=initMembers" json:"initMembers,omitempty"` + GroupInfo *sdkws.GroupInfo `protobuf:"bytes,2,opt,name=groupInfo" json:"groupInfo,omitempty"` + AdminUserIDs []string `protobuf:"bytes,3,rep,name=adminUserIDs" json:"adminUserIDs,omitempty"` + OwnerUserID string `protobuf:"bytes,4,opt,name=ownerUserID" json:"ownerUserID,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *CreateGroupReq) Reset() { *m = CreateGroupReq{} } @@ -66,7 +66,7 @@ func (m *CreateGroupReq) GetInitMembers() []string { return nil } -func (m *CreateGroupReq) GetGroupInfo() *sdk_ws.GroupInfo { +func (m *CreateGroupReq) GetGroupInfo() *sdkws.GroupInfo { if m != nil { return m.GroupInfo } @@ -88,10 +88,10 @@ func (m *CreateGroupReq) GetOwnerUserID() string { } type CreateGroupResp struct { - GroupInfo *sdk_ws.GroupInfo `protobuf:"bytes,1,opt,name=groupInfo" json:"groupInfo,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + GroupInfo *sdkws.GroupInfo `protobuf:"bytes,1,opt,name=groupInfo" json:"groupInfo,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *CreateGroupResp) Reset() { *m = CreateGroupResp{} } @@ -118,7 +118,7 @@ func (m *CreateGroupResp) XXX_DiscardUnknown() { var xxx_messageInfo_CreateGroupResp proto.InternalMessageInfo -func (m *CreateGroupResp) GetGroupInfo() *sdk_ws.GroupInfo { +func (m *CreateGroupResp) GetGroupInfo() *sdkws.GroupInfo { if m != nil { return m.GroupInfo } @@ -164,10 +164,10 @@ func (m *GetGroupsInfoReq) GetGroupIDs() []string { } type GetGroupsInfoResp struct { - GroupInfos []*sdk_ws.GroupInfo `protobuf:"bytes,1,rep,name=groupInfos" json:"groupInfos,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + GroupInfos []*sdkws.GroupInfo `protobuf:"bytes,1,rep,name=groupInfos" json:"groupInfos,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetGroupsInfoResp) Reset() { *m = GetGroupsInfoResp{} } @@ -194,7 +194,7 @@ func (m *GetGroupsInfoResp) XXX_DiscardUnknown() { var xxx_messageInfo_GetGroupsInfoResp proto.InternalMessageInfo -func (m *GetGroupsInfoResp) GetGroupInfos() []*sdk_ws.GroupInfo { +func (m *GetGroupsInfoResp) GetGroupInfos() []*sdkws.GroupInfo { if m != nil { return m.GroupInfos } @@ -202,10 +202,10 @@ func (m *GetGroupsInfoResp) GetGroupInfos() []*sdk_ws.GroupInfo { } type SetGroupInfoReq struct { - GroupInfoForSet *sdk_ws.GroupInfoForSet `protobuf:"bytes,1,opt,name=groupInfoForSet" json:"groupInfoForSet,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + GroupInfoForSet *sdkws.GroupInfoForSet `protobuf:"bytes,1,opt,name=groupInfoForSet" json:"groupInfoForSet,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *SetGroupInfoReq) Reset() { *m = SetGroupInfoReq{} } @@ -232,7 +232,7 @@ func (m *SetGroupInfoReq) XXX_DiscardUnknown() { var xxx_messageInfo_SetGroupInfoReq proto.InternalMessageInfo -func (m *SetGroupInfoReq) GetGroupInfoForSet() *sdk_ws.GroupInfoForSet { +func (m *SetGroupInfoReq) GetGroupInfoForSet() *sdkws.GroupInfoForSet { if m != nil { return m.GroupInfoForSet } @@ -270,11 +270,11 @@ func (m *SetGroupInfoResp) XXX_DiscardUnknown() { var xxx_messageInfo_SetGroupInfoResp proto.InternalMessageInfo type GetGroupApplicationListReq struct { - Pagination *sdk_ws.RequestPagination `protobuf:"bytes,1,opt,name=pagination" json:"pagination,omitempty"` - FromUserID string `protobuf:"bytes,2,opt,name=fromUserID" json:"fromUserID,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Pagination *sdkws.RequestPagination `protobuf:"bytes,1,opt,name=pagination" json:"pagination,omitempty"` + FromUserID string `protobuf:"bytes,2,opt,name=fromUserID" json:"fromUserID,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetGroupApplicationListReq) Reset() { *m = GetGroupApplicationListReq{} } @@ -301,7 +301,7 @@ func (m *GetGroupApplicationListReq) XXX_DiscardUnknown() { var xxx_messageInfo_GetGroupApplicationListReq proto.InternalMessageInfo -func (m *GetGroupApplicationListReq) GetPagination() *sdk_ws.RequestPagination { +func (m *GetGroupApplicationListReq) GetPagination() *sdkws.RequestPagination { if m != nil { return m.Pagination } @@ -316,11 +316,11 @@ func (m *GetGroupApplicationListReq) GetFromUserID() string { } type GetGroupApplicationListResp struct { - Total uint32 `protobuf:"varint,1,opt,name=total" json:"total,omitempty"` - GroupRequests []*sdk_ws.GroupRequest `protobuf:"bytes,2,rep,name=groupRequests" json:"groupRequests,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Total uint32 `protobuf:"varint,1,opt,name=total" json:"total,omitempty"` + GroupRequests []*sdkws.GroupRequest `protobuf:"bytes,2,rep,name=groupRequests" json:"groupRequests,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetGroupApplicationListResp) Reset() { *m = GetGroupApplicationListResp{} } @@ -354,7 +354,7 @@ func (m *GetGroupApplicationListResp) GetTotal() uint32 { return 0 } -func (m *GetGroupApplicationListResp) GetGroupRequests() []*sdk_ws.GroupRequest { +func (m *GetGroupApplicationListResp) GetGroupRequests() []*sdkws.GroupRequest { if m != nil { return m.GroupRequests } @@ -362,11 +362,11 @@ func (m *GetGroupApplicationListResp) GetGroupRequests() []*sdk_ws.GroupRequest } type GetUserReqApplicationListReq struct { - Pagination *sdk_ws.RequestPagination `protobuf:"bytes,1,opt,name=pagination" json:"pagination,omitempty"` - UserID string `protobuf:"bytes,2,opt,name=userID" json:"userID,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Pagination *sdkws.RequestPagination `protobuf:"bytes,1,opt,name=pagination" json:"pagination,omitempty"` + UserID string `protobuf:"bytes,2,opt,name=userID" json:"userID,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetUserReqApplicationListReq) Reset() { *m = GetUserReqApplicationListReq{} } @@ -393,7 +393,7 @@ func (m *GetUserReqApplicationListReq) XXX_DiscardUnknown() { var xxx_messageInfo_GetUserReqApplicationListReq proto.InternalMessageInfo -func (m *GetUserReqApplicationListReq) GetPagination() *sdk_ws.RequestPagination { +func (m *GetUserReqApplicationListReq) GetPagination() *sdkws.RequestPagination { if m != nil { return m.Pagination } @@ -408,11 +408,11 @@ func (m *GetUserReqApplicationListReq) GetUserID() string { } type GetUserReqApplicationListResp struct { - Total uint32 `protobuf:"varint,1,opt,name=total" json:"total,omitempty"` - GroupRequests []*sdk_ws.GroupRequest `protobuf:"bytes,2,rep,name=groupRequests" json:"groupRequests,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Total uint32 `protobuf:"varint,1,opt,name=total" json:"total,omitempty"` + GroupRequests []*sdkws.GroupRequest `protobuf:"bytes,2,rep,name=groupRequests" json:"groupRequests,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetUserReqApplicationListResp) Reset() { *m = GetUserReqApplicationListResp{} } @@ -446,7 +446,7 @@ func (m *GetUserReqApplicationListResp) GetTotal() uint32 { return 0 } -func (m *GetUserReqApplicationListResp) GetGroupRequests() []*sdk_ws.GroupRequest { +func (m *GetUserReqApplicationListResp) GetGroupRequests() []*sdkws.GroupRequest { if m != nil { return m.GroupRequests } @@ -790,12 +790,12 @@ func (m *QuitGroupResp) XXX_DiscardUnknown() { var xxx_messageInfo_QuitGroupResp proto.InternalMessageInfo type GetGroupMemberListReq struct { - Pagination *sdk_ws.RequestPagination `protobuf:"bytes,1,opt,name=pagination" json:"pagination,omitempty"` - GroupID string `protobuf:"bytes,2,opt,name=groupID" json:"groupID,omitempty"` - Filter int32 `protobuf:"varint,3,opt,name=filter" json:"filter,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Pagination *sdkws.RequestPagination `protobuf:"bytes,1,opt,name=pagination" json:"pagination,omitempty"` + GroupID string `protobuf:"bytes,2,opt,name=groupID" json:"groupID,omitempty"` + Filter int32 `protobuf:"varint,3,opt,name=filter" json:"filter,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetGroupMemberListReq) Reset() { *m = GetGroupMemberListReq{} } @@ -822,7 +822,7 @@ func (m *GetGroupMemberListReq) XXX_DiscardUnknown() { var xxx_messageInfo_GetGroupMemberListReq proto.InternalMessageInfo -func (m *GetGroupMemberListReq) GetPagination() *sdk_ws.RequestPagination { +func (m *GetGroupMemberListReq) GetPagination() *sdkws.RequestPagination { if m != nil { return m.Pagination } @@ -844,11 +844,11 @@ func (m *GetGroupMemberListReq) GetFilter() int32 { } type GetGroupMemberListResp struct { - Total uint32 `protobuf:"varint,1,opt,name=total" json:"total,omitempty"` - Members []*sdk_ws.GroupMemberFullInfo `protobuf:"bytes,2,rep,name=members" json:"members,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Total uint32 `protobuf:"varint,1,opt,name=total" json:"total,omitempty"` + Members []*sdkws.GroupMemberFullInfo `protobuf:"bytes,2,rep,name=members" json:"members,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetGroupMemberListResp) Reset() { *m = GetGroupMemberListResp{} } @@ -882,7 +882,7 @@ func (m *GetGroupMemberListResp) GetTotal() uint32 { return 0 } -func (m *GetGroupMemberListResp) GetMembers() []*sdk_ws.GroupMemberFullInfo { +func (m *GetGroupMemberListResp) GetMembers() []*sdkws.GroupMemberFullInfo { if m != nil { return m.Members } @@ -936,10 +936,10 @@ func (m *GetGroupMembersInfoReq) GetMembers() []string { } type GetGroupMembersInfoResp struct { - Members []*sdk_ws.GroupMemberFullInfo `protobuf:"bytes,1,rep,name=members" json:"members,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Members []*sdkws.GroupMemberFullInfo `protobuf:"bytes,1,rep,name=members" json:"members,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetGroupMembersInfoResp) Reset() { *m = GetGroupMembersInfoResp{} } @@ -966,7 +966,7 @@ func (m *GetGroupMembersInfoResp) XXX_DiscardUnknown() { var xxx_messageInfo_GetGroupMembersInfoResp proto.InternalMessageInfo -func (m *GetGroupMembersInfoResp) GetMembers() []*sdk_ws.GroupMemberFullInfo { +func (m *GetGroupMembersInfoResp) GetMembers() []*sdkws.GroupMemberFullInfo { if m != nil { return m.Members } @@ -1058,11 +1058,11 @@ func (m *KickGroupMemberResp) XXX_DiscardUnknown() { var xxx_messageInfo_KickGroupMemberResp proto.InternalMessageInfo type GetJoinedGroupListReq struct { - Pagination *sdk_ws.RequestPagination `protobuf:"bytes,1,opt,name=pagination" json:"pagination,omitempty"` - FromUserID string `protobuf:"bytes,2,opt,name=fromUserID" json:"fromUserID,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Pagination *sdkws.RequestPagination `protobuf:"bytes,1,opt,name=pagination" json:"pagination,omitempty"` + FromUserID string `protobuf:"bytes,2,opt,name=fromUserID" json:"fromUserID,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetJoinedGroupListReq) Reset() { *m = GetJoinedGroupListReq{} } @@ -1089,7 +1089,7 @@ func (m *GetJoinedGroupListReq) XXX_DiscardUnknown() { var xxx_messageInfo_GetJoinedGroupListReq proto.InternalMessageInfo -func (m *GetJoinedGroupListReq) GetPagination() *sdk_ws.RequestPagination { +func (m *GetJoinedGroupListReq) GetPagination() *sdkws.RequestPagination { if m != nil { return m.Pagination } @@ -1104,11 +1104,11 @@ func (m *GetJoinedGroupListReq) GetFromUserID() string { } type GetJoinedGroupListResp struct { - Total uint32 `protobuf:"varint,1,opt,name=total" json:"total,omitempty"` - Groups []*sdk_ws.GroupInfo `protobuf:"bytes,2,rep,name=groups" json:"groups,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Total uint32 `protobuf:"varint,1,opt,name=total" json:"total,omitempty"` + Groups []*sdkws.GroupInfo `protobuf:"bytes,2,rep,name=groups" json:"groups,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetJoinedGroupListResp) Reset() { *m = GetJoinedGroupListResp{} } @@ -1142,7 +1142,7 @@ func (m *GetJoinedGroupListResp) GetTotal() uint32 { return 0 } -func (m *GetJoinedGroupListResp) GetGroups() []*sdk_ws.GroupInfo { +func (m *GetJoinedGroupListResp) GetGroups() []*sdkws.GroupInfo { if m != nil { return m.Groups } @@ -1234,11 +1234,11 @@ func (m *InviteUserToGroupResp) XXX_DiscardUnknown() { var xxx_messageInfo_InviteUserToGroupResp proto.InternalMessageInfo type GetGroupAllMemberReq struct { - Pagination *sdk_ws.RequestPagination `protobuf:"bytes,1,opt,name=pagination" json:"pagination,omitempty"` - GroupID string `protobuf:"bytes,2,opt,name=groupID" json:"groupID,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Pagination *sdkws.RequestPagination `protobuf:"bytes,1,opt,name=pagination" json:"pagination,omitempty"` + GroupID string `protobuf:"bytes,2,opt,name=groupID" json:"groupID,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetGroupAllMemberReq) Reset() { *m = GetGroupAllMemberReq{} } @@ -1265,7 +1265,7 @@ func (m *GetGroupAllMemberReq) XXX_DiscardUnknown() { var xxx_messageInfo_GetGroupAllMemberReq proto.InternalMessageInfo -func (m *GetGroupAllMemberReq) GetPagination() *sdk_ws.RequestPagination { +func (m *GetGroupAllMemberReq) GetPagination() *sdkws.RequestPagination { if m != nil { return m.Pagination } @@ -1280,10 +1280,10 @@ func (m *GetGroupAllMemberReq) GetGroupID() string { } type GetGroupAllMemberResp struct { - Members []*sdk_ws.GroupMemberFullInfo `protobuf:"bytes,1,rep,name=members" json:"members,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Members []*sdkws.GroupMemberFullInfo `protobuf:"bytes,1,rep,name=members" json:"members,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetGroupAllMemberResp) Reset() { *m = GetGroupAllMemberResp{} } @@ -1310,7 +1310,7 @@ func (m *GetGroupAllMemberResp) XXX_DiscardUnknown() { var xxx_messageInfo_GetGroupAllMemberResp proto.InternalMessageInfo -func (m *GetGroupAllMemberResp) GetMembers() []*sdk_ws.GroupMemberFullInfo { +func (m *GetGroupAllMemberResp) GetMembers() []*sdkws.GroupMemberFullInfo { if m != nil { return m.Members } @@ -1318,12 +1318,12 @@ func (m *GetGroupAllMemberResp) GetMembers() []*sdk_ws.GroupMemberFullInfo { } type CMSGroup struct { - GroupInfo *sdk_ws.GroupInfo `protobuf:"bytes,1,opt,name=groupInfo" json:"groupInfo,omitempty"` - GroupOwnerUserName string `protobuf:"bytes,2,opt,name=groupOwnerUserName" json:"groupOwnerUserName,omitempty"` - GroupOwnerUserID string `protobuf:"bytes,3,opt,name=groupOwnerUserID" json:"groupOwnerUserID,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + GroupInfo *sdkws.GroupInfo `protobuf:"bytes,1,opt,name=groupInfo" json:"groupInfo,omitempty"` + GroupOwnerUserName string `protobuf:"bytes,2,opt,name=groupOwnerUserName" json:"groupOwnerUserName,omitempty"` + GroupOwnerUserID string `protobuf:"bytes,3,opt,name=groupOwnerUserID" json:"groupOwnerUserID,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *CMSGroup) Reset() { *m = CMSGroup{} } @@ -1350,7 +1350,7 @@ func (m *CMSGroup) XXX_DiscardUnknown() { var xxx_messageInfo_CMSGroup proto.InternalMessageInfo -func (m *CMSGroup) GetGroupInfo() *sdk_ws.GroupInfo { +func (m *CMSGroup) GetGroupInfo() *sdkws.GroupInfo { if m != nil { return m.GroupInfo } @@ -1372,12 +1372,12 @@ func (m *CMSGroup) GetGroupOwnerUserID() string { } type GetGroupsReq struct { - Pagination *sdk_ws.RequestPagination `protobuf:"bytes,1,opt,name=pagination" json:"pagination,omitempty"` - GroupName string `protobuf:"bytes,2,opt,name=groupName" json:"groupName,omitempty"` - GroupID string `protobuf:"bytes,3,opt,name=groupID" json:"groupID,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Pagination *sdkws.RequestPagination `protobuf:"bytes,1,opt,name=pagination" json:"pagination,omitempty"` + GroupName string `protobuf:"bytes,2,opt,name=groupName" json:"groupName,omitempty"` + GroupID string `protobuf:"bytes,3,opt,name=groupID" json:"groupID,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetGroupsReq) Reset() { *m = GetGroupsReq{} } @@ -1404,7 +1404,7 @@ func (m *GetGroupsReq) XXX_DiscardUnknown() { var xxx_messageInfo_GetGroupsReq proto.InternalMessageInfo -func (m *GetGroupsReq) GetPagination() *sdk_ws.RequestPagination { +func (m *GetGroupsReq) GetPagination() *sdkws.RequestPagination { if m != nil { return m.Pagination } @@ -1510,12 +1510,12 @@ func (m *GetGroupMemberReq) GetGroupID() string { } type GetGroupMembersCMSReq struct { - Pagination *sdk_ws.RequestPagination `protobuf:"bytes,1,opt,name=pagination" json:"pagination,omitempty"` - GroupID string `protobuf:"bytes,2,opt,name=groupID" json:"groupID,omitempty"` - UserName string `protobuf:"bytes,3,opt,name=userName" json:"userName,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Pagination *sdkws.RequestPagination `protobuf:"bytes,1,opt,name=pagination" json:"pagination,omitempty"` + GroupID string `protobuf:"bytes,2,opt,name=groupID" json:"groupID,omitempty"` + UserName string `protobuf:"bytes,3,opt,name=userName" json:"userName,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetGroupMembersCMSReq) Reset() { *m = GetGroupMembersCMSReq{} } @@ -1542,7 +1542,7 @@ func (m *GetGroupMembersCMSReq) XXX_DiscardUnknown() { var xxx_messageInfo_GetGroupMembersCMSReq proto.InternalMessageInfo -func (m *GetGroupMembersCMSReq) GetPagination() *sdk_ws.RequestPagination { +func (m *GetGroupMembersCMSReq) GetPagination() *sdkws.RequestPagination { if m != nil { return m.Pagination } @@ -1564,11 +1564,11 @@ func (m *GetGroupMembersCMSReq) GetUserName() string { } type GetGroupMembersCMSResp struct { - Total uint32 `protobuf:"varint,1,opt,name=total" json:"total,omitempty"` - Members []*sdk_ws.GroupMemberFullInfo `protobuf:"bytes,2,rep,name=members" json:"members,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Total uint32 `protobuf:"varint,1,opt,name=total" json:"total,omitempty"` + Members []*sdkws.GroupMemberFullInfo `protobuf:"bytes,2,rep,name=members" json:"members,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetGroupMembersCMSResp) Reset() { *m = GetGroupMembersCMSResp{} } @@ -1602,7 +1602,7 @@ func (m *GetGroupMembersCMSResp) GetTotal() uint32 { return 0 } -func (m *GetGroupMembersCMSResp) GetMembers() []*sdk_ws.GroupMemberFullInfo { +func (m *GetGroupMembersCMSResp) GetMembers() []*sdkws.GroupMemberFullInfo { if m != nil { return m.Members } @@ -2096,10 +2096,10 @@ func (m *GetJoinedSuperGroupListReq) GetUserID() string { } type GetJoinedSuperGroupListResp struct { - Groups []*sdk_ws.GroupInfo `protobuf:"bytes,1,rep,name=groups" json:"groups,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Groups []*sdkws.GroupInfo `protobuf:"bytes,1,rep,name=groups" json:"groups,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetJoinedSuperGroupListResp) Reset() { *m = GetJoinedSuperGroupListResp{} } @@ -2126,7 +2126,7 @@ func (m *GetJoinedSuperGroupListResp) XXX_DiscardUnknown() { var xxx_messageInfo_GetJoinedSuperGroupListResp proto.InternalMessageInfo -func (m *GetJoinedSuperGroupListResp) GetGroups() []*sdk_ws.GroupInfo { +func (m *GetJoinedSuperGroupListResp) GetGroups() []*sdkws.GroupInfo { if m != nil { return m.Groups } @@ -2172,10 +2172,10 @@ func (m *GetSuperGroupsInfoReq) GetGroupIDs() []string { } type GetSuperGroupsInfoResp struct { - GroupInfos []*sdk_ws.GroupInfo `protobuf:"bytes,1,rep,name=groupInfos" json:"groupInfos,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + GroupInfos []*sdkws.GroupInfo `protobuf:"bytes,1,rep,name=groupInfos" json:"groupInfos,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetSuperGroupsInfoResp) Reset() { *m = GetSuperGroupsInfoResp{} } @@ -2202,7 +2202,7 @@ func (m *GetSuperGroupsInfoResp) XXX_DiscardUnknown() { var xxx_messageInfo_GetSuperGroupsInfoResp proto.InternalMessageInfo -func (m *GetSuperGroupsInfoResp) GetGroupInfos() []*sdk_ws.GroupInfo { +func (m *GetSuperGroupsInfoResp) GetGroupInfos() []*sdkws.GroupInfo { if m != nil { return m.GroupInfos } @@ -2494,10 +2494,10 @@ func (m *GetUserInGroupMembersReq) GetGroupIDs() []string { } type GetUserInGroupMembersResp struct { - Members []*sdk_ws.GroupMemberFullInfo `protobuf:"bytes,1,rep,name=members" json:"members,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Members []*sdkws.GroupMemberFullInfo `protobuf:"bytes,1,rep,name=members" json:"members,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetUserInGroupMembersResp) Reset() { *m = GetUserInGroupMembersResp{} } @@ -2524,7 +2524,7 @@ func (m *GetUserInGroupMembersResp) XXX_DiscardUnknown() { var xxx_messageInfo_GetUserInGroupMembersResp proto.InternalMessageInfo -func (m *GetUserInGroupMembersResp) GetMembers() []*sdk_ws.GroupMemberFullInfo { +func (m *GetUserInGroupMembersResp) GetMembers() []*sdkws.GroupMemberFullInfo { if m != nil { return m.Members } diff --git a/pkg/proto/group/group.proto b/pkg/proto/group/group.proto index 75da6054d..67e48beb8 100644 --- a/pkg/proto/group/group.proto +++ b/pkg/proto/group/group.proto @@ -1,6 +1,6 @@ syntax = "proto3"; -import "Open-IM-Server/pkg/proto/sdk_ws/ws.proto"; -import "Open-IM-Server/pkg/proto/sdk_ws/wrappers.proto"; +import "Open-IM-Server/pkg/proto/sdkws/ws.proto"; +import "Open-IM-Server/pkg/proto/sdkws/wrappers.proto"; option go_package = "Open_IM/pkg/proto/group;group"; package group; @@ -8,12 +8,12 @@ package group; message CreateGroupReq{ repeated string initMembers = 1; - server_api_params.GroupInfo groupInfo = 2; + sdkws.GroupInfo groupInfo = 2; repeated string adminUserIDs = 3; string ownerUserID = 4; //owner } message CreateGroupResp{ - server_api_params.GroupInfo groupInfo = 1; + sdkws.GroupInfo groupInfo = 1; } @@ -21,34 +21,34 @@ message GetGroupsInfoReq{ repeated string groupIDs = 1; } message GetGroupsInfoResp{ - repeated server_api_params.GroupInfo groupInfos = 1; + repeated sdkws.GroupInfo groupInfos = 1; } message SetGroupInfoReq{ - server_api_params.GroupInfoForSet groupInfoForSet = 1; + sdkws.GroupInfoForSet groupInfoForSet = 1; } message SetGroupInfoResp{ } message GetGroupApplicationListReq { - server_api_params.RequestPagination pagination = 1; + sdkws.RequestPagination pagination = 1; string fromUserID = 2; //owner or admin } message GetGroupApplicationListResp { uint32 total = 1; - repeated server_api_params.GroupRequest groupRequests = 2; + repeated sdkws.GroupRequest groupRequests = 2; } message GetUserReqApplicationListReq{ - server_api_params.RequestPagination pagination = 1; + sdkws.RequestPagination pagination = 1; string userID = 2; } message GetUserReqApplicationListResp{ uint32 total = 1; - repeated server_api_params.GroupRequest groupRequests = 2; + repeated sdkws.GroupRequest groupRequests = 2; } @@ -91,14 +91,14 @@ message QuitGroupResp{ message GetGroupMemberListReq { - server_api_params.RequestPagination pagination = 1; + sdkws.RequestPagination pagination = 1; string groupID = 2; int32 filter = 3; } message GetGroupMemberListResp { uint32 total = 1; - repeated server_api_params.GroupMemberFullInfo members = 2; + repeated sdkws.GroupMemberFullInfo members = 2; } @@ -108,7 +108,7 @@ message GetGroupMembersInfoReq { } message GetGroupMembersInfoResp { - repeated server_api_params.GroupMemberFullInfo members = 1; + repeated sdkws.GroupMemberFullInfo members = 1; } message KickGroupMemberReq { @@ -123,12 +123,12 @@ message KickGroupMemberResp { message GetJoinedGroupListReq { - server_api_params.RequestPagination pagination = 1; + sdkws.RequestPagination pagination = 1; string fromUserID = 2; } message GetJoinedGroupListResp{ uint32 total = 1; - repeated server_api_params.GroupInfo groups = 2; + repeated sdkws.GroupInfo groups = 2; } @@ -143,22 +143,22 @@ message InviteUserToGroupResp { message GetGroupAllMemberReq { - server_api_params.RequestPagination pagination = 1; + sdkws.RequestPagination pagination = 1; string groupID = 2; } message GetGroupAllMemberResp { - repeated server_api_params.GroupMemberFullInfo members = 1; + repeated sdkws.GroupMemberFullInfo members = 1; } message CMSGroup { - server_api_params.GroupInfo groupInfo = 1; + sdkws.GroupInfo groupInfo = 1; string groupOwnerUserName = 2; string groupOwnerUserID = 3; } message GetGroupsReq { - server_api_params.RequestPagination pagination = 1; + sdkws.RequestPagination pagination = 1; string groupName = 2; string groupID = 3; } @@ -173,14 +173,14 @@ message GetGroupMemberReq { } message GetGroupMembersCMSReq { - server_api_params.RequestPagination pagination = 1; + sdkws.RequestPagination pagination = 1; string groupID = 2; string userName = 3; } message GetGroupMembersCMSResp { uint32 total = 1; - repeated server_api_params.GroupMemberFullInfo members = 2; + repeated sdkws.GroupMemberFullInfo members = 2; } message DismissGroupReq{ @@ -243,7 +243,7 @@ message GetJoinedSuperGroupListReq { } message GetJoinedSuperGroupListResp { - repeated server_api_params.GroupInfo groups = 1; + repeated sdkws.GroupInfo groups = 1; } message GetSuperGroupsInfoReq { @@ -251,7 +251,7 @@ message GetSuperGroupsInfoReq { } message GetSuperGroupsInfoResp { - repeated server_api_params.GroupInfo groupInfos = 1; + repeated sdkws.GroupInfo groupInfos = 1; } message SetGroupMemberInfoReq{ @@ -286,7 +286,7 @@ message getUserInGroupMembersReq { repeated string groupIDs = 2; } message getUserInGroupMembersResp{ - repeated server_api_params.GroupMemberFullInfo members = 1; + repeated sdkws.GroupMemberFullInfo members = 1; } service group{ diff --git a/pkg/proto/msg/msg.pb.go b/pkg/proto/msg/msg.pb.go index bdb1e3464..60eb493e3 100644 --- a/pkg/proto/msg/msg.pb.go +++ b/pkg/proto/msg/msg.pb.go @@ -6,7 +6,7 @@ package msg // import "Open_IM/pkg/proto/msg" import proto "github.com/golang/protobuf/proto" import fmt "fmt" import math "math" -import sdk_ws "Open_IM/pkg/proto/sdk_ws" +import sdkws "Open_IM/pkg/proto/sdkws" import wrapperspb "google.golang.org/protobuf/types/known/wrapperspb" import ( @@ -26,12 +26,12 @@ var _ = math.Inf const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package type MsgDataToMQ struct { - Token string `protobuf:"bytes,1,opt,name=token" json:"token,omitempty"` - OperationID string `protobuf:"bytes,2,opt,name=operationID" json:"operationID,omitempty"` - MsgData *sdk_ws.MsgData `protobuf:"bytes,3,opt,name=msgData" json:"msgData,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Token string `protobuf:"bytes,1,opt,name=token" json:"token,omitempty"` + OperationID string `protobuf:"bytes,2,opt,name=operationID" json:"operationID,omitempty"` + MsgData *sdkws.MsgData `protobuf:"bytes,3,opt,name=msgData" json:"msgData,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *MsgDataToMQ) Reset() { *m = MsgDataToMQ{} } @@ -72,7 +72,7 @@ func (m *MsgDataToMQ) GetOperationID() string { return "" } -func (m *MsgDataToMQ) GetMsgData() *sdk_ws.MsgData { +func (m *MsgDataToMQ) GetMsgData() *sdkws.MsgData { if m != nil { return m.MsgData } @@ -80,11 +80,11 @@ func (m *MsgDataToMQ) GetMsgData() *sdk_ws.MsgData { } type MsgDataToDB struct { - MsgData *sdk_ws.MsgData `protobuf:"bytes,1,opt,name=msgData" json:"msgData,omitempty"` - OperationID string `protobuf:"bytes,2,opt,name=operationID" json:"operationID,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + MsgData *sdkws.MsgData `protobuf:"bytes,1,opt,name=msgData" json:"msgData,omitempty"` + OperationID string `protobuf:"bytes,2,opt,name=operationID" json:"operationID,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *MsgDataToDB) Reset() { *m = MsgDataToDB{} } @@ -111,7 +111,7 @@ func (m *MsgDataToDB) XXX_DiscardUnknown() { var xxx_messageInfo_MsgDataToDB proto.InternalMessageInfo -func (m *MsgDataToDB) GetMsgData() *sdk_ws.MsgData { +func (m *MsgDataToDB) GetMsgData() *sdkws.MsgData { if m != nil { return m.MsgData } @@ -126,12 +126,12 @@ func (m *MsgDataToDB) GetOperationID() string { } type PushMsgDataToMQ struct { - OperationID string `protobuf:"bytes,1,opt,name=OperationID" json:"OperationID,omitempty"` - MsgData *sdk_ws.MsgData `protobuf:"bytes,2,opt,name=msgData" json:"msgData,omitempty"` - PushToUserID string `protobuf:"bytes,3,opt,name=pushToUserID" json:"pushToUserID,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + OperationID string `protobuf:"bytes,1,opt,name=OperationID" json:"OperationID,omitempty"` + MsgData *sdkws.MsgData `protobuf:"bytes,2,opt,name=msgData" json:"msgData,omitempty"` + PushToUserID string `protobuf:"bytes,3,opt,name=pushToUserID" json:"pushToUserID,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *PushMsgDataToMQ) Reset() { *m = PushMsgDataToMQ{} } @@ -165,7 +165,7 @@ func (m *PushMsgDataToMQ) GetOperationID() string { return "" } -func (m *PushMsgDataToMQ) GetMsgData() *sdk_ws.MsgData { +func (m *PushMsgDataToMQ) GetMsgData() *sdkws.MsgData { if m != nil { return m.MsgData } @@ -370,12 +370,12 @@ func (m *GetMaxAndMinSeqResp) GetMinSeq() uint32 { } type SendMsgReq struct { - Token string `protobuf:"bytes,1,opt,name=token" json:"token,omitempty"` - OperationID string `protobuf:"bytes,2,opt,name=operationID" json:"operationID,omitempty"` - MsgData *sdk_ws.MsgData `protobuf:"bytes,3,opt,name=msgData" json:"msgData,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Token string `protobuf:"bytes,1,opt,name=token" json:"token,omitempty"` + OperationID string `protobuf:"bytes,2,opt,name=operationID" json:"operationID,omitempty"` + MsgData *sdkws.MsgData `protobuf:"bytes,3,opt,name=msgData" json:"msgData,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *SendMsgReq) Reset() { *m = SendMsgReq{} } @@ -416,7 +416,7 @@ func (m *SendMsgReq) GetOperationID() string { return "" } -func (m *SendMsgReq) GetMsgData() *sdk_ws.MsgData { +func (m *SendMsgReq) GetMsgData() *sdkws.MsgData { if m != nil { return m.MsgData } @@ -1056,12 +1056,12 @@ func (m *GetSuperGroupMsgReq) GetGroupID() string { } type GetSuperGroupMsgResp struct { - ErrCode int32 `protobuf:"varint,1,opt,name=errCode" json:"errCode,omitempty"` - ErrMsg string `protobuf:"bytes,2,opt,name=errMsg" json:"errMsg,omitempty"` - MsgData *sdk_ws.MsgData `protobuf:"bytes,3,opt,name=msgData" json:"msgData,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + ErrCode int32 `protobuf:"varint,1,opt,name=errCode" json:"errCode,omitempty"` + ErrMsg string `protobuf:"bytes,2,opt,name=errMsg" json:"errMsg,omitempty"` + MsgData *sdkws.MsgData `protobuf:"bytes,3,opt,name=msgData" json:"msgData,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetSuperGroupMsgResp) Reset() { *m = GetSuperGroupMsgResp{} } @@ -1102,7 +1102,7 @@ func (m *GetSuperGroupMsgResp) GetErrMsg() string { return "" } -func (m *GetSuperGroupMsgResp) GetMsgData() *sdk_ws.MsgData { +func (m *GetSuperGroupMsgResp) GetMsgData() *sdkws.MsgData { if m != nil { return m.MsgData } @@ -1156,12 +1156,12 @@ func (m *GetWriteDiffMsgReq) GetSeq() uint32 { } type GetWriteDiffMsgResp struct { - ErrCode int32 `protobuf:"varint,1,opt,name=errCode" json:"errCode,omitempty"` - ErrMsg string `protobuf:"bytes,2,opt,name=errMsg" json:"errMsg,omitempty"` - MsgData *sdk_ws.MsgData `protobuf:"bytes,3,opt,name=msgData" json:"msgData,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + ErrCode int32 `protobuf:"varint,1,opt,name=errCode" json:"errCode,omitempty"` + ErrMsg string `protobuf:"bytes,2,opt,name=errMsg" json:"errMsg,omitempty"` + MsgData *sdkws.MsgData `protobuf:"bytes,3,opt,name=msgData" json:"msgData,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetWriteDiffMsgResp) Reset() { *m = GetWriteDiffMsgResp{} } @@ -1202,7 +1202,7 @@ func (m *GetWriteDiffMsgResp) GetErrMsg() string { return "" } -func (m *GetWriteDiffMsgResp) GetMsgData() *sdk_ws.MsgData { +func (m *GetWriteDiffMsgResp) GetMsgData() *sdkws.MsgData { if m != nil { return m.MsgData } @@ -1210,20 +1210,20 @@ func (m *GetWriteDiffMsgResp) GetMsgData() *sdk_ws.MsgData { } type ModifyMessageReactionExtensionsReq struct { - OperationID string `protobuf:"bytes,1,opt,name=operationID" json:"operationID,omitempty"` - SourceID string `protobuf:"bytes,2,opt,name=sourceID" json:"sourceID,omitempty"` - OpUserID string `protobuf:"bytes,3,opt,name=opUserID" json:"opUserID,omitempty"` - SessionType int32 `protobuf:"varint,4,opt,name=sessionType" json:"sessionType,omitempty"` - ReactionExtensionList map[string]*sdk_ws.KeyValue `protobuf:"bytes,5,rep,name=reactionExtensionList" json:"reactionExtensionList,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` - ClientMsgID string `protobuf:"bytes,6,opt,name=clientMsgID" json:"clientMsgID,omitempty"` - Ex *wrapperspb.StringValue `protobuf:"bytes,7,opt,name=ex" json:"ex,omitempty"` - AttachedInfo *wrapperspb.StringValue `protobuf:"bytes,8,opt,name=attachedInfo" json:"attachedInfo,omitempty"` - IsReact bool `protobuf:"varint,9,opt,name=isReact" json:"isReact,omitempty"` - IsExternalExtensions bool `protobuf:"varint,10,opt,name=isExternalExtensions" json:"isExternalExtensions,omitempty"` - MsgFirstModifyTime int64 `protobuf:"varint,11,opt,name=msgFirstModifyTime" json:"msgFirstModifyTime,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + OperationID string `protobuf:"bytes,1,opt,name=operationID" json:"operationID,omitempty"` + SourceID string `protobuf:"bytes,2,opt,name=sourceID" json:"sourceID,omitempty"` + OpUserID string `protobuf:"bytes,3,opt,name=opUserID" json:"opUserID,omitempty"` + SessionType int32 `protobuf:"varint,4,opt,name=sessionType" json:"sessionType,omitempty"` + ReactionExtensionList map[string]*sdkws.KeyValue `protobuf:"bytes,5,rep,name=reactionExtensionList" json:"reactionExtensionList,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + ClientMsgID string `protobuf:"bytes,6,opt,name=clientMsgID" json:"clientMsgID,omitempty"` + Ex *wrapperspb.StringValue `protobuf:"bytes,7,opt,name=ex" json:"ex,omitempty"` + AttachedInfo *wrapperspb.StringValue `protobuf:"bytes,8,opt,name=attachedInfo" json:"attachedInfo,omitempty"` + IsReact bool `protobuf:"varint,9,opt,name=isReact" json:"isReact,omitempty"` + IsExternalExtensions bool `protobuf:"varint,10,opt,name=isExternalExtensions" json:"isExternalExtensions,omitempty"` + MsgFirstModifyTime int64 `protobuf:"varint,11,opt,name=msgFirstModifyTime" json:"msgFirstModifyTime,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *ModifyMessageReactionExtensionsReq) Reset() { *m = ModifyMessageReactionExtensionsReq{} } @@ -1278,7 +1278,7 @@ func (m *ModifyMessageReactionExtensionsReq) GetSessionType() int32 { return 0 } -func (m *ModifyMessageReactionExtensionsReq) GetReactionExtensionList() map[string]*sdk_ws.KeyValue { +func (m *ModifyMessageReactionExtensionsReq) GetReactionExtensionList() map[string]*sdkws.KeyValue { if m != nil { return m.ReactionExtensionList } @@ -1328,20 +1328,20 @@ func (m *ModifyMessageReactionExtensionsReq) GetMsgFirstModifyTime() int64 { } type SetMessageReactionExtensionsReq struct { - OperationID string `protobuf:"bytes,1,opt,name=operationID" json:"operationID,omitempty"` - SourceID string `protobuf:"bytes,2,opt,name=sourceID" json:"sourceID,omitempty"` - OpUserID string `protobuf:"bytes,3,opt,name=opUserID" json:"opUserID,omitempty"` - SessionType int32 `protobuf:"varint,4,opt,name=sessionType" json:"sessionType,omitempty"` - ReactionExtensionList map[string]*sdk_ws.KeyValue `protobuf:"bytes,5,rep,name=reactionExtensionList" json:"reactionExtensionList,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` - ClientMsgID string `protobuf:"bytes,6,opt,name=clientMsgID" json:"clientMsgID,omitempty"` - Ex *wrapperspb.StringValue `protobuf:"bytes,7,opt,name=ex" json:"ex,omitempty"` - AttachedInfo *wrapperspb.StringValue `protobuf:"bytes,8,opt,name=attachedInfo" json:"attachedInfo,omitempty"` - IsReact bool `protobuf:"varint,9,opt,name=isReact" json:"isReact,omitempty"` - IsExternalExtensions bool `protobuf:"varint,10,opt,name=isExternalExtensions" json:"isExternalExtensions,omitempty"` - MsgFirstModifyTime int64 `protobuf:"varint,11,opt,name=msgFirstModifyTime" json:"msgFirstModifyTime,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + OperationID string `protobuf:"bytes,1,opt,name=operationID" json:"operationID,omitempty"` + SourceID string `protobuf:"bytes,2,opt,name=sourceID" json:"sourceID,omitempty"` + OpUserID string `protobuf:"bytes,3,opt,name=opUserID" json:"opUserID,omitempty"` + SessionType int32 `protobuf:"varint,4,opt,name=sessionType" json:"sessionType,omitempty"` + ReactionExtensionList map[string]*sdkws.KeyValue `protobuf:"bytes,5,rep,name=reactionExtensionList" json:"reactionExtensionList,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + ClientMsgID string `protobuf:"bytes,6,opt,name=clientMsgID" json:"clientMsgID,omitempty"` + Ex *wrapperspb.StringValue `protobuf:"bytes,7,opt,name=ex" json:"ex,omitempty"` + AttachedInfo *wrapperspb.StringValue `protobuf:"bytes,8,opt,name=attachedInfo" json:"attachedInfo,omitempty"` + IsReact bool `protobuf:"varint,9,opt,name=isReact" json:"isReact,omitempty"` + IsExternalExtensions bool `protobuf:"varint,10,opt,name=isExternalExtensions" json:"isExternalExtensions,omitempty"` + MsgFirstModifyTime int64 `protobuf:"varint,11,opt,name=msgFirstModifyTime" json:"msgFirstModifyTime,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *SetMessageReactionExtensionsReq) Reset() { *m = SetMessageReactionExtensionsReq{} } @@ -1396,7 +1396,7 @@ func (m *SetMessageReactionExtensionsReq) GetSessionType() int32 { return 0 } -func (m *SetMessageReactionExtensionsReq) GetReactionExtensionList() map[string]*sdk_ws.KeyValue { +func (m *SetMessageReactionExtensionsReq) GetReactionExtensionList() map[string]*sdkws.KeyValue { if m != nil { return m.ReactionExtensionList } @@ -1698,13 +1698,13 @@ func (m *GetMessageListReactionExtensionsResp) GetSingleMessageResult() []*Singl } type SingleMessageExtensionResult struct { - ErrCode int32 `protobuf:"varint,1,opt,name=errCode" json:"errCode,omitempty"` - ErrMsg string `protobuf:"bytes,2,opt,name=errMsg" json:"errMsg,omitempty"` - ReactionExtensionList map[string]*sdk_ws.KeyValue `protobuf:"bytes,3,rep,name=reactionExtensionList" json:"reactionExtensionList,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` - ClientMsgID string `protobuf:"bytes,4,opt,name=clientMsgID" json:"clientMsgID,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + ErrCode int32 `protobuf:"varint,1,opt,name=errCode" json:"errCode,omitempty"` + ErrMsg string `protobuf:"bytes,2,opt,name=errMsg" json:"errMsg,omitempty"` + ReactionExtensionList map[string]*sdkws.KeyValue `protobuf:"bytes,3,rep,name=reactionExtensionList" json:"reactionExtensionList,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + ClientMsgID string `protobuf:"bytes,4,opt,name=clientMsgID" json:"clientMsgID,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *SingleMessageExtensionResult) Reset() { *m = SingleMessageExtensionResult{} } @@ -1745,7 +1745,7 @@ func (m *SingleMessageExtensionResult) GetErrMsg() string { return "" } -func (m *SingleMessageExtensionResult) GetReactionExtensionList() map[string]*sdk_ws.KeyValue { +func (m *SingleMessageExtensionResult) GetReactionExtensionList() map[string]*sdkws.KeyValue { if m != nil { return m.ReactionExtensionList } @@ -1822,17 +1822,17 @@ func (m *ModifyMessageReactionExtensionsResp) GetFailedList() []*ExtendMsgResp { } type DeleteMessageListReactionExtensionsReq struct { - OperationID string `protobuf:"bytes,1,opt,name=operationID" json:"operationID,omitempty"` - OpUserID string `protobuf:"bytes,2,opt,name=opUserID" json:"opUserID,omitempty"` - SourceID string `protobuf:"bytes,3,opt,name=sourceID" json:"sourceID,omitempty"` - SessionType int32 `protobuf:"varint,4,opt,name=sessionType" json:"sessionType,omitempty"` - ClientMsgID string `protobuf:"bytes,5,opt,name=clientMsgID" json:"clientMsgID,omitempty"` - IsExternalExtensions bool `protobuf:"varint,6,opt,name=isExternalExtensions" json:"isExternalExtensions,omitempty"` - MsgFirstModifyTime int64 `protobuf:"varint,7,opt,name=msgFirstModifyTime" json:"msgFirstModifyTime,omitempty"` - ReactionExtensionList []*sdk_ws.KeyValue `protobuf:"bytes,8,rep,name=reactionExtensionList" json:"reactionExtensionList,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + OperationID string `protobuf:"bytes,1,opt,name=operationID" json:"operationID,omitempty"` + OpUserID string `protobuf:"bytes,2,opt,name=opUserID" json:"opUserID,omitempty"` + SourceID string `protobuf:"bytes,3,opt,name=sourceID" json:"sourceID,omitempty"` + SessionType int32 `protobuf:"varint,4,opt,name=sessionType" json:"sessionType,omitempty"` + ClientMsgID string `protobuf:"bytes,5,opt,name=clientMsgID" json:"clientMsgID,omitempty"` + IsExternalExtensions bool `protobuf:"varint,6,opt,name=isExternalExtensions" json:"isExternalExtensions,omitempty"` + MsgFirstModifyTime int64 `protobuf:"varint,7,opt,name=msgFirstModifyTime" json:"msgFirstModifyTime,omitempty"` + ReactionExtensionList []*sdkws.KeyValue `protobuf:"bytes,8,rep,name=reactionExtensionList" json:"reactionExtensionList,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *DeleteMessageListReactionExtensionsReq) Reset() { @@ -1910,7 +1910,7 @@ func (m *DeleteMessageListReactionExtensionsReq) GetMsgFirstModifyTime() int64 { return 0 } -func (m *DeleteMessageListReactionExtensionsReq) GetReactionExtensionList() []*sdk_ws.KeyValue { +func (m *DeleteMessageListReactionExtensionsReq) GetReactionExtensionList() []*sdkws.KeyValue { if m != nil { return m.ReactionExtensionList } @@ -2098,12 +2098,12 @@ func (m *ExtendMsg) GetEx() string { } type KeyValueResp struct { - KeyValue *sdk_ws.KeyValue `protobuf:"bytes,1,opt,name=keyValue" json:"keyValue,omitempty"` - ErrCode int32 `protobuf:"varint,2,opt,name=errCode" json:"errCode,omitempty"` - ErrMsg string `protobuf:"bytes,3,opt,name=errMsg" json:"errMsg,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + KeyValue *sdkws.KeyValue `protobuf:"bytes,1,opt,name=keyValue" json:"keyValue,omitempty"` + ErrCode int32 `protobuf:"varint,2,opt,name=errCode" json:"errCode,omitempty"` + ErrMsg string `protobuf:"bytes,3,opt,name=errMsg" json:"errMsg,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *KeyValueResp) Reset() { *m = KeyValueResp{} } @@ -2130,7 +2130,7 @@ func (m *KeyValueResp) XXX_DiscardUnknown() { var xxx_messageInfo_KeyValueResp proto.InternalMessageInfo -func (m *KeyValueResp) GetKeyValue() *sdk_ws.KeyValue { +func (m *KeyValueResp) GetKeyValue() *sdkws.KeyValue { if m != nil { return m.KeyValue } @@ -2229,15 +2229,15 @@ func init() { proto.RegisterType((*GetWriteDiffMsgReq)(nil), "msg.GetWriteDiffMsgReq") proto.RegisterType((*GetWriteDiffMsgResp)(nil), "msg.GetWriteDiffMsgResp") proto.RegisterType((*ModifyMessageReactionExtensionsReq)(nil), "msg.ModifyMessageReactionExtensionsReq") - proto.RegisterMapType((map[string]*sdk_ws.KeyValue)(nil), "msg.ModifyMessageReactionExtensionsReq.ReactionExtensionListEntry") + proto.RegisterMapType((map[string]*sdkws.KeyValue)(nil), "msg.ModifyMessageReactionExtensionsReq.ReactionExtensionListEntry") proto.RegisterType((*SetMessageReactionExtensionsReq)(nil), "msg.SetMessageReactionExtensionsReq") - proto.RegisterMapType((map[string]*sdk_ws.KeyValue)(nil), "msg.SetMessageReactionExtensionsReq.ReactionExtensionListEntry") + proto.RegisterMapType((map[string]*sdkws.KeyValue)(nil), "msg.SetMessageReactionExtensionsReq.ReactionExtensionListEntry") proto.RegisterType((*SetMessageReactionExtensionsResp)(nil), "msg.SetMessageReactionExtensionsResp") proto.RegisterType((*GetMessageListReactionExtensionsReq)(nil), "msg.GetMessageListReactionExtensionsReq") proto.RegisterType((*GetMessageListReactionExtensionsReq_MessageReactionKey)(nil), "msg.GetMessageListReactionExtensionsReq.MessageReactionKey") proto.RegisterType((*GetMessageListReactionExtensionsResp)(nil), "msg.GetMessageListReactionExtensionsResp") proto.RegisterType((*SingleMessageExtensionResult)(nil), "msg.SingleMessageExtensionResult") - proto.RegisterMapType((map[string]*sdk_ws.KeyValue)(nil), "msg.SingleMessageExtensionResult.ReactionExtensionListEntry") + proto.RegisterMapType((map[string]*sdkws.KeyValue)(nil), "msg.SingleMessageExtensionResult.ReactionExtensionListEntry") proto.RegisterType((*ModifyMessageReactionExtensionsResp)(nil), "msg.ModifyMessageReactionExtensionsResp") proto.RegisterType((*DeleteMessageListReactionExtensionsReq)(nil), "msg.DeleteMessageListReactionExtensionsReq") proto.RegisterType((*DeleteMessageListReactionExtensionsResp)(nil), "msg.DeleteMessageListReactionExtensionsResp") @@ -2259,10 +2259,10 @@ const _ = grpc.SupportPackageIsVersion4 // Client API for Msg service type MsgClient interface { - GetMaxAndMinSeq(ctx context.Context, in *sdk_ws.GetMaxAndMinSeqReq, opts ...grpc.CallOption) (*sdk_ws.GetMaxAndMinSeqResp, error) - PullMessageBySeqList(ctx context.Context, in *sdk_ws.PullMessageBySeqListReq, opts ...grpc.CallOption) (*sdk_ws.PullMessageBySeqListResp, error) + GetMaxAndMinSeq(ctx context.Context, in *sdkws.GetMaxAndMinSeqReq, opts ...grpc.CallOption) (*sdkws.GetMaxAndMinSeqResp, error) + PullMessageBySeqList(ctx context.Context, in *sdkws.PullMessageBySeqListReq, opts ...grpc.CallOption) (*sdkws.PullMessageBySeqListResp, error) SendMsg(ctx context.Context, in *SendMsgReq, opts ...grpc.CallOption) (*SendMsgResp, error) - DelMsgList(ctx context.Context, in *sdk_ws.DelMsgListReq, opts ...grpc.CallOption) (*sdk_ws.DelMsgListResp, error) + DelMsgList(ctx context.Context, in *sdkws.DelMsgListReq, opts ...grpc.CallOption) (*sdkws.DelMsgListResp, error) DelSuperGroupMsg(ctx context.Context, in *DelSuperGroupMsgReq, opts ...grpc.CallOption) (*DelSuperGroupMsgResp, error) ClearMsg(ctx context.Context, in *ClearMsgReq, opts ...grpc.CallOption) (*ClearMsgResp, error) SetMsgMinSeq(ctx context.Context, in *SetMsgMinSeqReq, opts ...grpc.CallOption) (*SetMsgMinSeqResp, error) @@ -2285,8 +2285,8 @@ func NewMsgClient(cc *grpc.ClientConn) MsgClient { return &msgClient{cc} } -func (c *msgClient) GetMaxAndMinSeq(ctx context.Context, in *sdk_ws.GetMaxAndMinSeqReq, opts ...grpc.CallOption) (*sdk_ws.GetMaxAndMinSeqResp, error) { - out := new(sdk_ws.GetMaxAndMinSeqResp) +func (c *msgClient) GetMaxAndMinSeq(ctx context.Context, in *sdkws.GetMaxAndMinSeqReq, opts ...grpc.CallOption) (*sdkws.GetMaxAndMinSeqResp, error) { + out := new(sdkws.GetMaxAndMinSeqResp) err := grpc.Invoke(ctx, "/msg.msg/GetMaxAndMinSeq", in, out, c.cc, opts...) if err != nil { return nil, err @@ -2294,8 +2294,8 @@ func (c *msgClient) GetMaxAndMinSeq(ctx context.Context, in *sdk_ws.GetMaxAndMin return out, nil } -func (c *msgClient) PullMessageBySeqList(ctx context.Context, in *sdk_ws.PullMessageBySeqListReq, opts ...grpc.CallOption) (*sdk_ws.PullMessageBySeqListResp, error) { - out := new(sdk_ws.PullMessageBySeqListResp) +func (c *msgClient) PullMessageBySeqList(ctx context.Context, in *sdkws.PullMessageBySeqListReq, opts ...grpc.CallOption) (*sdkws.PullMessageBySeqListResp, error) { + out := new(sdkws.PullMessageBySeqListResp) err := grpc.Invoke(ctx, "/msg.msg/PullMessageBySeqList", in, out, c.cc, opts...) if err != nil { return nil, err @@ -2312,8 +2312,8 @@ func (c *msgClient) SendMsg(ctx context.Context, in *SendMsgReq, opts ...grpc.Ca return out, nil } -func (c *msgClient) DelMsgList(ctx context.Context, in *sdk_ws.DelMsgListReq, opts ...grpc.CallOption) (*sdk_ws.DelMsgListResp, error) { - out := new(sdk_ws.DelMsgListResp) +func (c *msgClient) DelMsgList(ctx context.Context, in *sdkws.DelMsgListReq, opts ...grpc.CallOption) (*sdkws.DelMsgListResp, error) { + out := new(sdkws.DelMsgListResp) err := grpc.Invoke(ctx, "/msg.msg/DelMsgList", in, out, c.cc, opts...) if err != nil { return nil, err @@ -2423,10 +2423,10 @@ func (c *msgClient) DeleteMessageReactionExtensions(ctx context.Context, in *Del // Server API for Msg service type MsgServer interface { - GetMaxAndMinSeq(context.Context, *sdk_ws.GetMaxAndMinSeqReq) (*sdk_ws.GetMaxAndMinSeqResp, error) - PullMessageBySeqList(context.Context, *sdk_ws.PullMessageBySeqListReq) (*sdk_ws.PullMessageBySeqListResp, error) + GetMaxAndMinSeq(context.Context, *sdkws.GetMaxAndMinSeqReq) (*sdkws.GetMaxAndMinSeqResp, error) + PullMessageBySeqList(context.Context, *sdkws.PullMessageBySeqListReq) (*sdkws.PullMessageBySeqListResp, error) SendMsg(context.Context, *SendMsgReq) (*SendMsgResp, error) - DelMsgList(context.Context, *sdk_ws.DelMsgListReq) (*sdk_ws.DelMsgListResp, error) + DelMsgList(context.Context, *sdkws.DelMsgListReq) (*sdkws.DelMsgListResp, error) DelSuperGroupMsg(context.Context, *DelSuperGroupMsgReq) (*DelSuperGroupMsgResp, error) ClearMsg(context.Context, *ClearMsgReq) (*ClearMsgResp, error) SetMsgMinSeq(context.Context, *SetMsgMinSeqReq) (*SetMsgMinSeqResp, error) @@ -2446,7 +2446,7 @@ func RegisterMsgServer(s *grpc.Server, srv MsgServer) { } func _Msg_GetMaxAndMinSeq_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(sdk_ws.GetMaxAndMinSeqReq) + in := new(sdkws.GetMaxAndMinSeqReq) if err := dec(in); err != nil { return nil, err } @@ -2458,13 +2458,13 @@ func _Msg_GetMaxAndMinSeq_Handler(srv interface{}, ctx context.Context, dec func FullMethod: "/msg.msg/GetMaxAndMinSeq", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).GetMaxAndMinSeq(ctx, req.(*sdk_ws.GetMaxAndMinSeqReq)) + return srv.(MsgServer).GetMaxAndMinSeq(ctx, req.(*sdkws.GetMaxAndMinSeqReq)) } return interceptor(ctx, in, info, handler) } func _Msg_PullMessageBySeqList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(sdk_ws.PullMessageBySeqListReq) + in := new(sdkws.PullMessageBySeqListReq) if err := dec(in); err != nil { return nil, err } @@ -2476,7 +2476,7 @@ func _Msg_PullMessageBySeqList_Handler(srv interface{}, ctx context.Context, dec FullMethod: "/msg.msg/PullMessageBySeqList", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).PullMessageBySeqList(ctx, req.(*sdk_ws.PullMessageBySeqListReq)) + return srv.(MsgServer).PullMessageBySeqList(ctx, req.(*sdkws.PullMessageBySeqListReq)) } return interceptor(ctx, in, info, handler) } @@ -2500,7 +2500,7 @@ func _Msg_SendMsg_Handler(srv interface{}, ctx context.Context, dec func(interfa } func _Msg_DelMsgList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(sdk_ws.DelMsgListReq) + in := new(sdkws.DelMsgListReq) if err := dec(in); err != nil { return nil, err } @@ -2512,7 +2512,7 @@ func _Msg_DelMsgList_Handler(srv interface{}, ctx context.Context, dec func(inte FullMethod: "/msg.msg/DelMsgList", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).DelMsgList(ctx, req.(*sdk_ws.DelMsgListReq)) + return srv.(MsgServer).DelMsgList(ctx, req.(*sdkws.DelMsgListReq)) } return interceptor(ctx, in, info, handler) } diff --git a/pkg/proto/msg/msg.proto b/pkg/proto/msg/msg.proto index 287340517..c6952d2a8 100644 --- a/pkg/proto/msg/msg.proto +++ b/pkg/proto/msg/msg.proto @@ -1,24 +1,24 @@ syntax = "proto3"; -import "Open-IM-Server/pkg/proto/sdk_ws/ws.proto"; -import "Open-IM-Server/pkg/proto/sdk_ws/wrappers.proto"; +import "Open-IM-Server/pkg/proto/sdkws/ws.proto"; +import "Open-IM-Server/pkg/proto/sdkws/wrappers.proto"; option go_package = "Open_IM/pkg/proto/msg;msg"; package msg; message MsgDataToMQ{ string token =1; string operationID = 2; - server_api_params.MsgData msgData = 3; + sdkws.MsgData msgData = 3; } message MsgDataToDB { - server_api_params.MsgData msgData = 1; + sdkws.MsgData msgData = 1; string operationID = 2; } message PushMsgDataToMQ{ string OperationID = 1; - server_api_params.MsgData msgData = 2; + sdkws.MsgData msgData = 2; string pushToUserID = 3; } message MsgDataToMongoByMQ{ @@ -65,7 +65,7 @@ message SendMsgReq { string token =1; string operationID = 2; -server_api_params.MsgData msgData = 3; +sdkws.MsgData msgData = 3; } @@ -141,7 +141,7 @@ message GetSuperGroupMsgReq{ message GetSuperGroupMsgResp{ int32 errCode = 1; string errMsg = 2; - server_api_params.MsgData msgData = 3; + sdkws.MsgData msgData = 3; } message GetWriteDiffMsgReq{ string operationID = 1; @@ -151,7 +151,7 @@ message GetWriteDiffMsgReq{ message GetWriteDiffMsgResp{ int32 errCode = 1; string errMsg = 2; - server_api_params.MsgData msgData = 3; + sdkws.MsgData msgData = 3; } message ModifyMessageReactionExtensionsReq { @@ -159,7 +159,7 @@ message ModifyMessageReactionExtensionsReq { string sourceID = 2; string opUserID = 3; int32 sessionType = 4; - map reactionExtensionList = 5; + map reactionExtensionList = 5; string clientMsgID = 6; google.protobuf.StringValue ex = 7; google.protobuf.StringValue attachedInfo = 8; @@ -172,7 +172,7 @@ message SetMessageReactionExtensionsReq { string sourceID = 2; string opUserID = 3; int32 sessionType = 4; - map reactionExtensionList = 5; + map reactionExtensionList = 5; string clientMsgID = 6; google.protobuf.StringValue ex = 7; google.protobuf.StringValue attachedInfo = 8; @@ -210,7 +210,7 @@ message GetMessageListReactionExtensionsResp{ message SingleMessageExtensionResult { int32 errCode = 1; string errMsg = 2; - map reactionExtensionList = 3; + map reactionExtensionList = 3; string clientMsgID = 4; } @@ -230,7 +230,7 @@ message DeleteMessageListReactionExtensionsReq { string clientMsgID = 5; bool isExternalExtensions = 6; int64 msgFirstModifyTime = 7; - repeated server_api_params.KeyValue reactionExtensionList = 8; + repeated sdkws.KeyValue reactionExtensionList = 8; } message DeleteMessageListReactionExtensionsResp { @@ -254,7 +254,7 @@ message ExtendMsg { } message KeyValueResp { - server_api_params.KeyValue keyValue = 1; + sdkws.KeyValue keyValue = 1; int32 errCode = 2; string errMsg = 3; } @@ -267,10 +267,10 @@ message MsgDataToModifyByMQ{ service msg { - rpc GetMaxAndMinSeq(server_api_params.GetMaxAndMinSeqReq) returns(server_api_params.GetMaxAndMinSeqResp); - rpc PullMessageBySeqList(server_api_params.PullMessageBySeqListReq) returns(server_api_params.PullMessageBySeqListResp); + rpc GetMaxAndMinSeq(sdkws.GetMaxAndMinSeqReq) returns(sdkws.GetMaxAndMinSeqResp); + rpc PullMessageBySeqList(sdkws.PullMessageBySeqListReq) returns(sdkws.PullMessageBySeqListResp); rpc SendMsg(SendMsgReq) returns(SendMsgResp); - rpc DelMsgList(server_api_params.DelMsgListReq) returns(server_api_params.DelMsgListResp); + rpc DelMsgList(sdkws.DelMsgListReq) returns(sdkws.DelMsgListResp); rpc DelSuperGroupMsg(DelSuperGroupMsgReq) returns(DelSuperGroupMsgResp); rpc ClearMsg(ClearMsgReq) returns(ClearMsgResp); rpc SetMsgMinSeq(SetMsgMinSeqReq) returns(SetMsgMinSeqResp); diff --git a/pkg/proto/office/office.pb.go b/pkg/proto/office/office.pb.go index 92feb549e..d9eaf3857 100644 --- a/pkg/proto/office/office.pb.go +++ b/pkg/proto/office/office.pb.go @@ -7,7 +7,7 @@ package office import ( - sdk_ws "Open_IM/pkg/proto/sdk_ws" + sdkws "Open_IM/pkg/proto/sdkws" context "context" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" @@ -817,9 +817,9 @@ type GetTagSendLogsReq struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Pagination *sdk_ws.RequestPagination `protobuf:"bytes,1,opt,name=Pagination,proto3" json:"Pagination,omitempty"` - UserID string `protobuf:"bytes,2,opt,name=userID,proto3" json:"userID,omitempty"` - OperationID string `protobuf:"bytes,3,opt,name=operationID,proto3" json:"operationID,omitempty"` + Pagination *sdkws.RequestPagination `protobuf:"bytes,1,opt,name=Pagination,proto3" json:"Pagination,omitempty"` + UserID string `protobuf:"bytes,2,opt,name=userID,proto3" json:"userID,omitempty"` + OperationID string `protobuf:"bytes,3,opt,name=operationID,proto3" json:"operationID,omitempty"` } func (x *GetTagSendLogsReq) Reset() { @@ -854,7 +854,7 @@ func (*GetTagSendLogsReq) Descriptor() ([]byte, []int) { return file_office_office_proto_rawDescGZIP(), []int{13} } -func (x *GetTagSendLogsReq) GetPagination() *sdk_ws.RequestPagination { +func (x *GetTagSendLogsReq) GetPagination() *sdkws.RequestPagination { if x != nil { return x.Pagination } @@ -943,9 +943,9 @@ type GetTagSendLogsResp struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - CommonResp *CommonResp `protobuf:"bytes,1,opt,name=commonResp,proto3" json:"commonResp,omitempty"` - Pagination *sdk_ws.ResponsePagination `protobuf:"bytes,2,opt,name=Pagination,proto3" json:"Pagination,omitempty"` - TagSendLogs []*TagSendLog `protobuf:"bytes,3,rep,name=tagSendLogs,proto3" json:"tagSendLogs,omitempty"` + CommonResp *CommonResp `protobuf:"bytes,1,opt,name=commonResp,proto3" json:"commonResp,omitempty"` + Pagination *sdkws.ResponsePagination `protobuf:"bytes,2,opt,name=Pagination,proto3" json:"Pagination,omitempty"` + TagSendLogs []*TagSendLog `protobuf:"bytes,3,rep,name=tagSendLogs,proto3" json:"tagSendLogs,omitempty"` } func (x *GetTagSendLogsResp) Reset() { @@ -987,7 +987,7 @@ func (x *GetTagSendLogsResp) GetCommonResp() *CommonResp { return nil } -func (x *GetTagSendLogsResp) GetPagination() *sdk_ws.ResponsePagination { +func (x *GetTagSendLogsResp) GetPagination() *sdkws.ResponsePagination { if x != nil { return x.Pagination } @@ -2392,10 +2392,10 @@ type GetUserWorkMomentsReq struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - UserID string `protobuf:"bytes,1,opt,name=userID,proto3" json:"userID,omitempty"` - OpUserID string `protobuf:"bytes,2,opt,name=opUserID,proto3" json:"opUserID,omitempty"` - Pagination *sdk_ws.RequestPagination `protobuf:"bytes,3,opt,name=Pagination,proto3" json:"Pagination,omitempty"` - OperationID string `protobuf:"bytes,4,opt,name=operationID,proto3" json:"operationID,omitempty"` + UserID string `protobuf:"bytes,1,opt,name=userID,proto3" json:"userID,omitempty"` + OpUserID string `protobuf:"bytes,2,opt,name=opUserID,proto3" json:"opUserID,omitempty"` + Pagination *sdkws.RequestPagination `protobuf:"bytes,3,opt,name=Pagination,proto3" json:"Pagination,omitempty"` + OperationID string `protobuf:"bytes,4,opt,name=operationID,proto3" json:"operationID,omitempty"` } func (x *GetUserWorkMomentsReq) Reset() { @@ -2444,7 +2444,7 @@ func (x *GetUserWorkMomentsReq) GetOpUserID() string { return "" } -func (x *GetUserWorkMomentsReq) GetPagination() *sdk_ws.RequestPagination { +func (x *GetUserWorkMomentsReq) GetPagination() *sdkws.RequestPagination { if x != nil { return x.Pagination } @@ -2463,9 +2463,9 @@ type GetUserWorkMomentsResp struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - CommonResp *CommonResp `protobuf:"bytes,1,opt,name=commonResp,proto3" json:"commonResp,omitempty"` - WorkMoments []*WorkMoment `protobuf:"bytes,2,rep,name=workMoments,proto3" json:"workMoments,omitempty"` - Pagination *sdk_ws.ResponsePagination `protobuf:"bytes,3,opt,name=Pagination,proto3" json:"Pagination,omitempty"` + CommonResp *CommonResp `protobuf:"bytes,1,opt,name=commonResp,proto3" json:"commonResp,omitempty"` + WorkMoments []*WorkMoment `protobuf:"bytes,2,rep,name=workMoments,proto3" json:"workMoments,omitempty"` + Pagination *sdkws.ResponsePagination `protobuf:"bytes,3,opt,name=Pagination,proto3" json:"Pagination,omitempty"` } func (x *GetUserWorkMomentsResp) Reset() { @@ -2514,7 +2514,7 @@ func (x *GetUserWorkMomentsResp) GetWorkMoments() []*WorkMoment { return nil } -func (x *GetUserWorkMomentsResp) GetPagination() *sdk_ws.ResponsePagination { +func (x *GetUserWorkMomentsResp) GetPagination() *sdkws.ResponsePagination { if x != nil { return x.Pagination } @@ -2526,9 +2526,9 @@ type GetUserFriendWorkMomentsReq struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - UserID string `protobuf:"bytes,1,opt,name=userID,proto3" json:"userID,omitempty"` - Pagination *sdk_ws.RequestPagination `protobuf:"bytes,2,opt,name=Pagination,proto3" json:"Pagination,omitempty"` - OperationID string `protobuf:"bytes,3,opt,name=operationID,proto3" json:"operationID,omitempty"` + UserID string `protobuf:"bytes,1,opt,name=userID,proto3" json:"userID,omitempty"` + Pagination *sdkws.RequestPagination `protobuf:"bytes,2,opt,name=Pagination,proto3" json:"Pagination,omitempty"` + OperationID string `protobuf:"bytes,3,opt,name=operationID,proto3" json:"operationID,omitempty"` } func (x *GetUserFriendWorkMomentsReq) Reset() { @@ -2570,7 +2570,7 @@ func (x *GetUserFriendWorkMomentsReq) GetUserID() string { return "" } -func (x *GetUserFriendWorkMomentsReq) GetPagination() *sdk_ws.RequestPagination { +func (x *GetUserFriendWorkMomentsReq) GetPagination() *sdkws.RequestPagination { if x != nil { return x.Pagination } @@ -2589,9 +2589,9 @@ type GetUserFriendWorkMomentsResp struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - CommonResp *CommonResp `protobuf:"bytes,1,opt,name=commonResp,proto3" json:"commonResp,omitempty"` - WorkMoments []*WorkMoment `protobuf:"bytes,2,rep,name=workMoments,proto3" json:"workMoments,omitempty"` - Pagination *sdk_ws.ResponsePagination `protobuf:"bytes,3,opt,name=Pagination,proto3" json:"Pagination,omitempty"` + CommonResp *CommonResp `protobuf:"bytes,1,opt,name=commonResp,proto3" json:"commonResp,omitempty"` + WorkMoments []*WorkMoment `protobuf:"bytes,2,rep,name=workMoments,proto3" json:"workMoments,omitempty"` + Pagination *sdkws.ResponsePagination `protobuf:"bytes,3,opt,name=Pagination,proto3" json:"Pagination,omitempty"` } func (x *GetUserFriendWorkMomentsResp) Reset() { @@ -2640,7 +2640,7 @@ func (x *GetUserFriendWorkMomentsResp) GetWorkMoments() []*WorkMoment { return nil } -func (x *GetUserFriendWorkMomentsResp) GetPagination() *sdk_ws.ResponsePagination { +func (x *GetUserFriendWorkMomentsResp) GetPagination() *sdkws.ResponsePagination { if x != nil { return x.Pagination } @@ -3419,8 +3419,8 @@ var file_office_office_proto_goTypes = []interface{}{ (*WorkMomentNotificationMsg)(nil), // 42: office.WorkMomentNotificationMsg (*SetUserWorkMomentsLevelReq)(nil), // 43: office.SetUserWorkMomentsLevelReq (*SetUserWorkMomentsLevelResp)(nil), // 44: office.SetUserWorkMomentsLevelResp - (*sdk_ws.RequestPagination)(nil), // 45: server_api_params.RequestPagination - (*sdk_ws.ResponsePagination)(nil), // 46: server_api_params.ResponsePagination + (*sdkws.RequestPagination)(nil), // 45: sdkws.RequestPagination + (*sdkws.ResponsePagination)(nil), // 46: sdkws.ResponsePagination } var file_office_office_proto_depIdxs = []int32{ 1, // 0: office.Tag.userList:type_name -> office.TagUser @@ -3430,10 +3430,10 @@ var file_office_office_proto_depIdxs = []int32{ 0, // 4: office.DeleteTagResp.commonResp:type_name -> office.CommonResp 0, // 5: office.SetTagResp.commonResp:type_name -> office.CommonResp 0, // 6: office.SendMsg2TagResp.commonResp:type_name -> office.CommonResp - 45, // 7: office.GetTagSendLogsReq.Pagination:type_name -> server_api_params.RequestPagination + 45, // 7: office.GetTagSendLogsReq.Pagination:type_name -> sdkws.RequestPagination 1, // 8: office.TagSendLog.userList:type_name -> office.TagUser 0, // 9: office.GetTagSendLogsResp.commonResp:type_name -> office.CommonResp - 46, // 10: office.GetTagSendLogsResp.Pagination:type_name -> server_api_params.ResponsePagination + 46, // 10: office.GetTagSendLogsResp.Pagination:type_name -> sdkws.ResponsePagination 14, // 11: office.GetTagSendLogsResp.tagSendLogs:type_name -> office.TagSendLog 0, // 12: office.GetUserTagByIDResp.commonResp:type_name -> office.CommonResp 2, // 13: office.GetUserTagByIDResp.tag:type_name -> office.Tag @@ -3451,14 +3451,14 @@ var file_office_office_proto_depIdxs = []int32{ 0, // 25: office.GetWorkMomentByIDResp.commonResp:type_name -> office.CommonResp 23, // 26: office.GetWorkMomentByIDResp.workMoment:type_name -> office.WorkMoment 0, // 27: office.ChangeWorkMomentPermissionResp.commonResp:type_name -> office.CommonResp - 45, // 28: office.GetUserWorkMomentsReq.Pagination:type_name -> server_api_params.RequestPagination + 45, // 28: office.GetUserWorkMomentsReq.Pagination:type_name -> sdkws.RequestPagination 0, // 29: office.GetUserWorkMomentsResp.commonResp:type_name -> office.CommonResp 23, // 30: office.GetUserWorkMomentsResp.workMoments:type_name -> office.WorkMoment - 46, // 31: office.GetUserWorkMomentsResp.Pagination:type_name -> server_api_params.ResponsePagination - 45, // 32: office.GetUserFriendWorkMomentsReq.Pagination:type_name -> server_api_params.RequestPagination + 46, // 31: office.GetUserWorkMomentsResp.Pagination:type_name -> sdkws.ResponsePagination + 45, // 32: office.GetUserFriendWorkMomentsReq.Pagination:type_name -> sdkws.RequestPagination 0, // 33: office.GetUserFriendWorkMomentsResp.commonResp:type_name -> office.CommonResp 23, // 34: office.GetUserFriendWorkMomentsResp.workMoments:type_name -> office.WorkMoment - 46, // 35: office.GetUserFriendWorkMomentsResp.Pagination:type_name -> server_api_params.ResponsePagination + 46, // 35: office.GetUserFriendWorkMomentsResp.Pagination:type_name -> sdkws.ResponsePagination 0, // 36: office.SetUserWorkMomentsLevelResp.commonResp:type_name -> office.CommonResp 3, // 37: office.OfficeService.GetUserTags:input_type -> office.GetUserTagsReq 5, // 38: office.OfficeService.CreateTag:input_type -> office.CreateTagReq diff --git a/pkg/proto/office/office.proto b/pkg/proto/office/office.proto index 23b422bad..213fa3cae 100644 --- a/pkg/proto/office/office.proto +++ b/pkg/proto/office/office.proto @@ -1,5 +1,5 @@ syntax = "proto3"; -import "Open-IM-Server/pkg/proto/sdk_ws/ws.proto"; +import "Open-IM-Server/pkg/proto/sdkws/ws.proto"; option go_package = "Open_IM/pkg/proto/office;office"; package office; @@ -78,7 +78,7 @@ message SendMsg2TagResp { } message GetTagSendLogsReq { - server_api_params.RequestPagination Pagination = 1; + sdkws.RequestPagination Pagination = 1; string userID = 2; string operationID = 3; } @@ -91,7 +91,7 @@ message TagSendLog { message GetTagSendLogsResp { CommonResp commonResp = 1; - server_api_params.ResponsePagination Pagination = 2; + sdkws.ResponsePagination Pagination = 2; repeated TagSendLog tagSendLogs = 3; } @@ -232,26 +232,26 @@ message ChangeWorkMomentPermissionResp { message GetUserWorkMomentsReq { string userID = 1; string opUserID = 2; - server_api_params.RequestPagination Pagination = 3; + sdkws.RequestPagination Pagination = 3; string operationID = 4; } message GetUserWorkMomentsResp { CommonResp commonResp = 1; repeated WorkMoment workMoments = 2; - server_api_params.ResponsePagination Pagination = 3; + sdkws.ResponsePagination Pagination = 3; } message GetUserFriendWorkMomentsReq { string userID = 1; - server_api_params.RequestPagination Pagination = 2; + sdkws.RequestPagination Pagination = 2; string operationID = 3; } message GetUserFriendWorkMomentsResp { CommonResp commonResp = 1; repeated WorkMoment workMoments = 2; - server_api_params.ResponsePagination Pagination = 3; + sdkws.ResponsePagination Pagination = 3; } message WorkMomentNotificationMsg { diff --git a/pkg/proto/proto_dir.cfg b/pkg/proto/proto_dir.cfg index 8d4b3d80e..48eeb4ba7 100644 --- a/pkg/proto/proto_dir.cfg +++ b/pkg/proto/proto_dir.cfg @@ -9,9 +9,7 @@ all_proto=( msg/msg.proto push/push.proto relay/relay.proto - sdk_ws/ws.proto + sdkws/ws.proto conversation/conversation.proto office/office.proto - cache/cache.proto - organization/organization.proto ) diff --git a/pkg/proto/push/push.pb.go b/pkg/proto/push/push.pb.go index 1c4d10593..04a475951 100644 --- a/pkg/proto/push/push.pb.go +++ b/pkg/proto/push/push.pb.go @@ -6,7 +6,7 @@ package pbPush // import "Open_IM/pkg/proto/push" import proto "github.com/golang/protobuf/proto" import fmt "fmt" import math "math" -import sdk_ws "Open_IM/pkg/proto/sdk_ws" +import sdkws "Open_IM/pkg/proto/sdkws" import ( context "golang.org/x/net/context" @@ -25,12 +25,12 @@ var _ = math.Inf const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package type PushMsgReq struct { - OperationID string `protobuf:"bytes,1,opt,name=operationID" json:"operationID,omitempty"` - MsgData *sdk_ws.MsgData `protobuf:"bytes,2,opt,name=msgData" json:"msgData,omitempty"` - PushToUserID string `protobuf:"bytes,3,opt,name=pushToUserID" json:"pushToUserID,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + OperationID string `protobuf:"bytes,1,opt,name=operationID" json:"operationID,omitempty"` + MsgData *sdkws.MsgData `protobuf:"bytes,2,opt,name=msgData" json:"msgData,omitempty"` + PushToUserID string `protobuf:"bytes,3,opt,name=pushToUserID" json:"pushToUserID,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *PushMsgReq) Reset() { *m = PushMsgReq{} } @@ -64,7 +64,7 @@ func (m *PushMsgReq) GetOperationID() string { return "" } -func (m *PushMsgReq) GetMsgData() *sdk_ws.MsgData { +func (m *PushMsgReq) GetMsgData() *sdkws.MsgData { if m != nil { return m.MsgData } diff --git a/pkg/proto/push/push.proto b/pkg/proto/push/push.proto index d9f864510..56463af2f 100644 --- a/pkg/proto/push/push.proto +++ b/pkg/proto/push/push.proto @@ -1,11 +1,11 @@ syntax = "proto3"; -import "Open-IM-Server/pkg/proto/sdk_ws/ws.proto"; +import "Open-IM-Server/pkg/proto/sdkws/ws.proto"; option go_package = "Open_IM/pkg/proto/push;pbPush"; package push; message PushMsgReq { string operationID = 1; - server_api_params.MsgData msgData = 2; + sdkws.MsgData msgData = 2; string pushToUserID = 3; } message PushMsgResp{ diff --git a/pkg/proto/relay/relay.pb.go b/pkg/proto/relay/relay.pb.go index 7cf7e019c..57288faee 100644 --- a/pkg/proto/relay/relay.pb.go +++ b/pkg/proto/relay/relay.pb.go @@ -6,7 +6,7 @@ package pbRelay // import "Open_IM/pkg/proto/relay" import proto "github.com/golang/protobuf/proto" import fmt "fmt" import math "math" -import sdk_ws "Open_IM/pkg/proto/sdk_ws" +import sdkws "Open_IM/pkg/proto/sdkws" import ( context "golang.org/x/net/context" @@ -25,12 +25,12 @@ var _ = math.Inf const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package type OnlinePushMsgReq struct { - OperationID string `protobuf:"bytes,1,opt,name=OperationID" json:"OperationID,omitempty"` - MsgData *sdk_ws.MsgData `protobuf:"bytes,2,opt,name=msgData" json:"msgData,omitempty"` - PushToUserID string `protobuf:"bytes,3,opt,name=pushToUserID" json:"pushToUserID,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + OperationID string `protobuf:"bytes,1,opt,name=OperationID" json:"OperationID,omitempty"` + MsgData *sdkws.MsgData `protobuf:"bytes,2,opt,name=msgData" json:"msgData,omitempty"` + PushToUserID string `protobuf:"bytes,3,opt,name=pushToUserID" json:"pushToUserID,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *OnlinePushMsgReq) Reset() { *m = OnlinePushMsgReq{} } @@ -64,7 +64,7 @@ func (m *OnlinePushMsgReq) GetOperationID() string { return "" } -func (m *OnlinePushMsgReq) GetMsgData() *sdk_ws.MsgData { +func (m *OnlinePushMsgReq) GetMsgData() *sdkws.MsgData { if m != nil { return m.MsgData } @@ -171,12 +171,12 @@ func (m *SingelMsgToUserResultList) GetOnlinePush() bool { } type OnlineBatchPushOneMsgReq struct { - OperationID string `protobuf:"bytes,1,opt,name=OperationID" json:"OperationID,omitempty"` - MsgData *sdk_ws.MsgData `protobuf:"bytes,2,opt,name=msgData" json:"msgData,omitempty"` - PushToUserIDList []string `protobuf:"bytes,3,rep,name=pushToUserIDList" json:"pushToUserIDList,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + OperationID string `protobuf:"bytes,1,opt,name=OperationID" json:"OperationID,omitempty"` + MsgData *sdkws.MsgData `protobuf:"bytes,2,opt,name=msgData" json:"msgData,omitempty"` + PushToUserIDList []string `protobuf:"bytes,3,rep,name=pushToUserIDList" json:"pushToUserIDList,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *OnlineBatchPushOneMsgReq) Reset() { *m = OnlineBatchPushOneMsgReq{} } @@ -210,7 +210,7 @@ func (m *OnlineBatchPushOneMsgReq) GetOperationID() string { return "" } -func (m *OnlineBatchPushOneMsgReq) GetMsgData() *sdk_ws.MsgData { +func (m *OnlineBatchPushOneMsgReq) GetMsgData() *sdkws.MsgData { if m != nil { return m.MsgData } diff --git a/pkg/proto/relay/relay.proto b/pkg/proto/relay/relay.proto index ee1c926cf..5177fac7f 100644 --- a/pkg/proto/relay/relay.proto +++ b/pkg/proto/relay/relay.proto @@ -1,11 +1,11 @@ syntax = "proto3"; -import "Open-IM-Server/pkg/proto/sdk_ws/ws.proto"; +import "Open-IM-Server/pkg/proto/sdkws/ws.proto"; option go_package = "Open_IM/pkg/proto/relay;pbRelay"; package relay; message OnlinePushMsgReq { string OperationID = 1; - server_api_params.MsgData msgData = 2; + sdkws.MsgData msgData = 2; string pushToUserID = 3; } message OnlinePushMsgResp{ @@ -19,7 +19,7 @@ message SingelMsgToUserResultList{ } message OnlineBatchPushOneMsgReq{ string OperationID = 1; - server_api_params.MsgData msgData = 2; + sdkws.MsgData msgData = 2; repeated string pushToUserIDList = 3; } message OnlineBatchPushOneMsgResp{ diff --git a/pkg/proto/sdk_ws/wrappers.proto b/pkg/proto/sdkws/wrappers.proto similarity index 100% rename from pkg/proto/sdk_ws/wrappers.proto rename to pkg/proto/sdkws/wrappers.proto diff --git a/pkg/proto/sdk_ws/ws.pb.go b/pkg/proto/sdkws/ws.pb.go similarity index 96% rename from pkg/proto/sdk_ws/ws.pb.go rename to pkg/proto/sdkws/ws.pb.go index 63a5106c4..2bba6281c 100644 --- a/pkg/proto/sdk_ws/ws.pb.go +++ b/pkg/proto/sdkws/ws.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. -// source: sdk_ws/ws.proto +// source: sdkws/ws.proto -package server_api_params // import "Open_IM/pkg/proto/sdk_ws" +package sdkws // import "Open_IM/pkg/proto/sdkws" import proto "github.com/golang/protobuf/proto" import fmt "fmt" @@ -6227,102 +6227,102 @@ func (m *ResponsePagination) GetShowNumber() int32 { } func init() { - proto.RegisterType((*GroupInfo)(nil), "server_api_params.GroupInfo") - proto.RegisterType((*GroupInfoForSet)(nil), "server_api_params.GroupInfoForSet") - proto.RegisterType((*GroupMemberFullInfo)(nil), "server_api_params.GroupMemberFullInfo") - proto.RegisterType((*PublicUserInfo)(nil), "server_api_params.PublicUserInfo") - proto.RegisterType((*UserInfo)(nil), "server_api_params.UserInfo") - proto.RegisterType((*FriendInfo)(nil), "server_api_params.FriendInfo") - proto.RegisterType((*BlackInfo)(nil), "server_api_params.BlackInfo") - proto.RegisterType((*GroupRequest)(nil), "server_api_params.GroupRequest") - proto.RegisterType((*FriendRequest)(nil), "server_api_params.FriendRequest") - proto.RegisterType((*Department)(nil), "server_api_params.Department") - proto.RegisterType((*OrganizationUser)(nil), "server_api_params.OrganizationUser") - proto.RegisterType((*DepartmentMember)(nil), "server_api_params.DepartmentMember") - proto.RegisterType((*UserDepartmentMember)(nil), "server_api_params.UserDepartmentMember") - proto.RegisterType((*UserInDepartment)(nil), "server_api_params.UserInDepartment") - proto.RegisterType((*PullMessageBySeqListReq)(nil), "server_api_params.PullMessageBySeqListReq") - proto.RegisterMapType((map[string]*SeqList)(nil), "server_api_params.PullMessageBySeqListReq.GroupSeqListEntry") - proto.RegisterType((*SeqList)(nil), "server_api_params.seqList") - proto.RegisterType((*MsgDataList)(nil), "server_api_params.MsgDataList") - proto.RegisterType((*PullMessageBySeqListResp)(nil), "server_api_params.PullMessageBySeqListResp") - proto.RegisterMapType((map[string]*MsgDataList)(nil), "server_api_params.PullMessageBySeqListResp.GroupMsgDataListEntry") - proto.RegisterType((*GetMaxAndMinSeqReq)(nil), "server_api_params.GetMaxAndMinSeqReq") - proto.RegisterType((*MaxAndMinSeq)(nil), "server_api_params.MaxAndMinSeq") - proto.RegisterType((*GetMaxAndMinSeqResp)(nil), "server_api_params.GetMaxAndMinSeqResp") - proto.RegisterMapType((map[string]*MaxAndMinSeq)(nil), "server_api_params.GetMaxAndMinSeqResp.GroupMaxAndMinSeqEntry") - proto.RegisterType((*UserSendMsgResp)(nil), "server_api_params.UserSendMsgResp") - proto.RegisterType((*MsgData)(nil), "server_api_params.MsgData") - proto.RegisterMapType((map[string]bool)(nil), "server_api_params.MsgData.OptionsEntry") - proto.RegisterType((*OfflinePushInfo)(nil), "server_api_params.OfflinePushInfo") - proto.RegisterType((*TipsComm)(nil), "server_api_params.TipsComm") - proto.RegisterType((*GroupCreatedTips)(nil), "server_api_params.GroupCreatedTips") - proto.RegisterType((*GroupInfoSetTips)(nil), "server_api_params.GroupInfoSetTips") - proto.RegisterType((*JoinGroupApplicationTips)(nil), "server_api_params.JoinGroupApplicationTips") - proto.RegisterType((*MemberQuitTips)(nil), "server_api_params.MemberQuitTips") - proto.RegisterType((*GroupApplicationAcceptedTips)(nil), "server_api_params.GroupApplicationAcceptedTips") - proto.RegisterType((*GroupApplicationRejectedTips)(nil), "server_api_params.GroupApplicationRejectedTips") - proto.RegisterType((*GroupOwnerTransferredTips)(nil), "server_api_params.GroupOwnerTransferredTips") - proto.RegisterType((*MemberKickedTips)(nil), "server_api_params.MemberKickedTips") - proto.RegisterType((*MemberInvitedTips)(nil), "server_api_params.MemberInvitedTips") - proto.RegisterType((*MemberEnterTips)(nil), "server_api_params.MemberEnterTips") - proto.RegisterType((*GroupDismissedTips)(nil), "server_api_params.GroupDismissedTips") - proto.RegisterType((*GroupMemberMutedTips)(nil), "server_api_params.GroupMemberMutedTips") - proto.RegisterType((*GroupMemberCancelMutedTips)(nil), "server_api_params.GroupMemberCancelMutedTips") - proto.RegisterType((*GroupMutedTips)(nil), "server_api_params.GroupMutedTips") - proto.RegisterType((*GroupCancelMutedTips)(nil), "server_api_params.GroupCancelMutedTips") - proto.RegisterType((*GroupMemberInfoSetTips)(nil), "server_api_params.GroupMemberInfoSetTips") - proto.RegisterType((*OrganizationChangedTips)(nil), "server_api_params.OrganizationChangedTips") - proto.RegisterType((*FriendApplication)(nil), "server_api_params.FriendApplication") - proto.RegisterType((*FromToUserID)(nil), "server_api_params.FromToUserID") - proto.RegisterType((*FriendApplicationTips)(nil), "server_api_params.FriendApplicationTips") - proto.RegisterType((*FriendApplicationApprovedTips)(nil), "server_api_params.FriendApplicationApprovedTips") - proto.RegisterType((*FriendApplicationRejectedTips)(nil), "server_api_params.FriendApplicationRejectedTips") - proto.RegisterType((*FriendAddedTips)(nil), "server_api_params.FriendAddedTips") - proto.RegisterType((*FriendDeletedTips)(nil), "server_api_params.FriendDeletedTips") - proto.RegisterType((*BlackAddedTips)(nil), "server_api_params.BlackAddedTips") - proto.RegisterType((*BlackDeletedTips)(nil), "server_api_params.BlackDeletedTips") - proto.RegisterType((*FriendInfoChangedTips)(nil), "server_api_params.FriendInfoChangedTips") - proto.RegisterType((*UserInfoUpdatedTips)(nil), "server_api_params.UserInfoUpdatedTips") - proto.RegisterType((*ConversationUpdateTips)(nil), "server_api_params.ConversationUpdateTips") - proto.RegisterType((*ConversationSetPrivateTips)(nil), "server_api_params.ConversationSetPrivateTips") - proto.RegisterType((*DeleteMessageTips)(nil), "server_api_params.DeleteMessageTips") - proto.RegisterType((*RequestPagination)(nil), "server_api_params.RequestPagination") - proto.RegisterType((*SignalReq)(nil), "server_api_params.SignalReq") - proto.RegisterType((*SignalResp)(nil), "server_api_params.SignalResp") - proto.RegisterType((*InvitationInfo)(nil), "server_api_params.InvitationInfo") - proto.RegisterType((*ParticipantMetaData)(nil), "server_api_params.ParticipantMetaData") - proto.RegisterType((*SignalInviteReq)(nil), "server_api_params.SignalInviteReq") - proto.RegisterType((*SignalInviteReply)(nil), "server_api_params.SignalInviteReply") - proto.RegisterType((*SignalInviteInGroupReq)(nil), "server_api_params.SignalInviteInGroupReq") - proto.RegisterType((*SignalInviteInGroupReply)(nil), "server_api_params.SignalInviteInGroupReply") - proto.RegisterType((*SignalCancelReq)(nil), "server_api_params.SignalCancelReq") - proto.RegisterType((*SignalCancelReply)(nil), "server_api_params.SignalCancelReply") - proto.RegisterType((*SignalAcceptReq)(nil), "server_api_params.SignalAcceptReq") - proto.RegisterType((*SignalAcceptReply)(nil), "server_api_params.SignalAcceptReply") - proto.RegisterType((*SignalHungUpReq)(nil), "server_api_params.SignalHungUpReq") - proto.RegisterType((*SignalHungUpReply)(nil), "server_api_params.SignalHungUpReply") - proto.RegisterType((*SignalRejectReq)(nil), "server_api_params.SignalRejectReq") - proto.RegisterType((*SignalRejectReply)(nil), "server_api_params.SignalRejectReply") - proto.RegisterType((*SignalGetRoomByGroupIDReq)(nil), "server_api_params.SignalGetRoomByGroupIDReq") - proto.RegisterType((*SignalGetRoomByGroupIDReply)(nil), "server_api_params.SignalGetRoomByGroupIDReply") - proto.RegisterType((*SignalOnRoomParticipantConnectedReq)(nil), "server_api_params.SignalOnRoomParticipantConnectedReq") - proto.RegisterType((*SignalOnRoomParticipantDisconnectedReq)(nil), "server_api_params.SignalOnRoomParticipantDisconnectedReq") - proto.RegisterType((*SignalGetTokenByRoomIDReq)(nil), "server_api_params.SignalGetTokenByRoomIDReq") - proto.RegisterType((*SignalGetTokenByRoomIDReply)(nil), "server_api_params.SignalGetTokenByRoomIDReply") - proto.RegisterType((*DelMsgListReq)(nil), "server_api_params.DelMsgListReq") - proto.RegisterType((*DelMsgListResp)(nil), "server_api_params.DelMsgListResp") - proto.RegisterType((*SetAppBackgroundStatusReq)(nil), "server_api_params.SetAppBackgroundStatusReq") - proto.RegisterType((*SetAppBackgroundStatusResp)(nil), "server_api_params.SetAppBackgroundStatusResp") - proto.RegisterType((*ExtendMsgSet)(nil), "server_api_params.ExtendMsgSet") - proto.RegisterMapType((map[string]*ExtendMsg)(nil), "server_api_params.ExtendMsgSet.ExtendMsgsEntry") - proto.RegisterType((*ExtendMsg)(nil), "server_api_params.ExtendMsg") - proto.RegisterMapType((map[string]*KeyValue)(nil), "server_api_params.ExtendMsg.ReactionExtensionListEntry") - proto.RegisterType((*KeyValue)(nil), "server_api_params.KeyValue") - proto.RegisterType((*ResponsePagination)(nil), "server_api_params.ResponsePagination") + proto.RegisterType((*GroupInfo)(nil), "sdkws.GroupInfo") + proto.RegisterType((*GroupInfoForSet)(nil), "sdkws.GroupInfoForSet") + proto.RegisterType((*GroupMemberFullInfo)(nil), "sdkws.GroupMemberFullInfo") + proto.RegisterType((*PublicUserInfo)(nil), "sdkws.PublicUserInfo") + proto.RegisterType((*UserInfo)(nil), "sdkws.UserInfo") + proto.RegisterType((*FriendInfo)(nil), "sdkws.FriendInfo") + proto.RegisterType((*BlackInfo)(nil), "sdkws.BlackInfo") + proto.RegisterType((*GroupRequest)(nil), "sdkws.GroupRequest") + proto.RegisterType((*FriendRequest)(nil), "sdkws.FriendRequest") + proto.RegisterType((*Department)(nil), "sdkws.Department") + proto.RegisterType((*OrganizationUser)(nil), "sdkws.OrganizationUser") + proto.RegisterType((*DepartmentMember)(nil), "sdkws.DepartmentMember") + proto.RegisterType((*UserDepartmentMember)(nil), "sdkws.UserDepartmentMember") + proto.RegisterType((*UserInDepartment)(nil), "sdkws.UserInDepartment") + proto.RegisterType((*PullMessageBySeqListReq)(nil), "sdkws.PullMessageBySeqListReq") + proto.RegisterMapType((map[string]*SeqList)(nil), "sdkws.PullMessageBySeqListReq.GroupSeqListEntry") + proto.RegisterType((*SeqList)(nil), "sdkws.seqList") + proto.RegisterType((*MsgDataList)(nil), "sdkws.MsgDataList") + proto.RegisterType((*PullMessageBySeqListResp)(nil), "sdkws.PullMessageBySeqListResp") + proto.RegisterMapType((map[string]*MsgDataList)(nil), "sdkws.PullMessageBySeqListResp.GroupMsgDataListEntry") + proto.RegisterType((*GetMaxAndMinSeqReq)(nil), "sdkws.GetMaxAndMinSeqReq") + proto.RegisterType((*MaxAndMinSeq)(nil), "sdkws.MaxAndMinSeq") + proto.RegisterType((*GetMaxAndMinSeqResp)(nil), "sdkws.GetMaxAndMinSeqResp") + proto.RegisterMapType((map[string]*MaxAndMinSeq)(nil), "sdkws.GetMaxAndMinSeqResp.GroupMaxAndMinSeqEntry") + proto.RegisterType((*UserSendMsgResp)(nil), "sdkws.UserSendMsgResp") + proto.RegisterType((*MsgData)(nil), "sdkws.MsgData") + proto.RegisterMapType((map[string]bool)(nil), "sdkws.MsgData.OptionsEntry") + proto.RegisterType((*OfflinePushInfo)(nil), "sdkws.OfflinePushInfo") + proto.RegisterType((*TipsComm)(nil), "sdkws.TipsComm") + proto.RegisterType((*GroupCreatedTips)(nil), "sdkws.GroupCreatedTips") + proto.RegisterType((*GroupInfoSetTips)(nil), "sdkws.GroupInfoSetTips") + proto.RegisterType((*JoinGroupApplicationTips)(nil), "sdkws.JoinGroupApplicationTips") + proto.RegisterType((*MemberQuitTips)(nil), "sdkws.MemberQuitTips") + proto.RegisterType((*GroupApplicationAcceptedTips)(nil), "sdkws.GroupApplicationAcceptedTips") + proto.RegisterType((*GroupApplicationRejectedTips)(nil), "sdkws.GroupApplicationRejectedTips") + proto.RegisterType((*GroupOwnerTransferredTips)(nil), "sdkws.GroupOwnerTransferredTips") + proto.RegisterType((*MemberKickedTips)(nil), "sdkws.MemberKickedTips") + proto.RegisterType((*MemberInvitedTips)(nil), "sdkws.MemberInvitedTips") + proto.RegisterType((*MemberEnterTips)(nil), "sdkws.MemberEnterTips") + proto.RegisterType((*GroupDismissedTips)(nil), "sdkws.GroupDismissedTips") + proto.RegisterType((*GroupMemberMutedTips)(nil), "sdkws.GroupMemberMutedTips") + proto.RegisterType((*GroupMemberCancelMutedTips)(nil), "sdkws.GroupMemberCancelMutedTips") + proto.RegisterType((*GroupMutedTips)(nil), "sdkws.GroupMutedTips") + proto.RegisterType((*GroupCancelMutedTips)(nil), "sdkws.GroupCancelMutedTips") + proto.RegisterType((*GroupMemberInfoSetTips)(nil), "sdkws.GroupMemberInfoSetTips") + proto.RegisterType((*OrganizationChangedTips)(nil), "sdkws.OrganizationChangedTips") + proto.RegisterType((*FriendApplication)(nil), "sdkws.FriendApplication") + proto.RegisterType((*FromToUserID)(nil), "sdkws.FromToUserID") + proto.RegisterType((*FriendApplicationTips)(nil), "sdkws.FriendApplicationTips") + proto.RegisterType((*FriendApplicationApprovedTips)(nil), "sdkws.FriendApplicationApprovedTips") + proto.RegisterType((*FriendApplicationRejectedTips)(nil), "sdkws.FriendApplicationRejectedTips") + proto.RegisterType((*FriendAddedTips)(nil), "sdkws.FriendAddedTips") + proto.RegisterType((*FriendDeletedTips)(nil), "sdkws.FriendDeletedTips") + proto.RegisterType((*BlackAddedTips)(nil), "sdkws.BlackAddedTips") + proto.RegisterType((*BlackDeletedTips)(nil), "sdkws.BlackDeletedTips") + proto.RegisterType((*FriendInfoChangedTips)(nil), "sdkws.FriendInfoChangedTips") + proto.RegisterType((*UserInfoUpdatedTips)(nil), "sdkws.UserInfoUpdatedTips") + proto.RegisterType((*ConversationUpdateTips)(nil), "sdkws.ConversationUpdateTips") + proto.RegisterType((*ConversationSetPrivateTips)(nil), "sdkws.ConversationSetPrivateTips") + proto.RegisterType((*DeleteMessageTips)(nil), "sdkws.DeleteMessageTips") + proto.RegisterType((*RequestPagination)(nil), "sdkws.RequestPagination") + proto.RegisterType((*SignalReq)(nil), "sdkws.SignalReq") + proto.RegisterType((*SignalResp)(nil), "sdkws.SignalResp") + proto.RegisterType((*InvitationInfo)(nil), "sdkws.InvitationInfo") + proto.RegisterType((*ParticipantMetaData)(nil), "sdkws.ParticipantMetaData") + proto.RegisterType((*SignalInviteReq)(nil), "sdkws.SignalInviteReq") + proto.RegisterType((*SignalInviteReply)(nil), "sdkws.SignalInviteReply") + proto.RegisterType((*SignalInviteInGroupReq)(nil), "sdkws.SignalInviteInGroupReq") + proto.RegisterType((*SignalInviteInGroupReply)(nil), "sdkws.SignalInviteInGroupReply") + proto.RegisterType((*SignalCancelReq)(nil), "sdkws.SignalCancelReq") + proto.RegisterType((*SignalCancelReply)(nil), "sdkws.SignalCancelReply") + proto.RegisterType((*SignalAcceptReq)(nil), "sdkws.SignalAcceptReq") + proto.RegisterType((*SignalAcceptReply)(nil), "sdkws.SignalAcceptReply") + proto.RegisterType((*SignalHungUpReq)(nil), "sdkws.SignalHungUpReq") + proto.RegisterType((*SignalHungUpReply)(nil), "sdkws.SignalHungUpReply") + proto.RegisterType((*SignalRejectReq)(nil), "sdkws.SignalRejectReq") + proto.RegisterType((*SignalRejectReply)(nil), "sdkws.SignalRejectReply") + proto.RegisterType((*SignalGetRoomByGroupIDReq)(nil), "sdkws.SignalGetRoomByGroupIDReq") + proto.RegisterType((*SignalGetRoomByGroupIDReply)(nil), "sdkws.SignalGetRoomByGroupIDReply") + proto.RegisterType((*SignalOnRoomParticipantConnectedReq)(nil), "sdkws.SignalOnRoomParticipantConnectedReq") + proto.RegisterType((*SignalOnRoomParticipantDisconnectedReq)(nil), "sdkws.SignalOnRoomParticipantDisconnectedReq") + proto.RegisterType((*SignalGetTokenByRoomIDReq)(nil), "sdkws.SignalGetTokenByRoomIDReq") + proto.RegisterType((*SignalGetTokenByRoomIDReply)(nil), "sdkws.SignalGetTokenByRoomIDReply") + proto.RegisterType((*DelMsgListReq)(nil), "sdkws.DelMsgListReq") + proto.RegisterType((*DelMsgListResp)(nil), "sdkws.DelMsgListResp") + proto.RegisterType((*SetAppBackgroundStatusReq)(nil), "sdkws.SetAppBackgroundStatusReq") + proto.RegisterType((*SetAppBackgroundStatusResp)(nil), "sdkws.SetAppBackgroundStatusResp") + proto.RegisterType((*ExtendMsgSet)(nil), "sdkws.ExtendMsgSet") + proto.RegisterMapType((map[string]*ExtendMsg)(nil), "sdkws.ExtendMsgSet.ExtendMsgsEntry") + proto.RegisterType((*ExtendMsg)(nil), "sdkws.ExtendMsg") + proto.RegisterMapType((map[string]*KeyValue)(nil), "sdkws.ExtendMsg.ReactionExtensionListEntry") + proto.RegisterType((*KeyValue)(nil), "sdkws.KeyValue") + proto.RegisterType((*ResponsePagination)(nil), "sdkws.ResponsePagination") } -func init() { proto.RegisterFile("sdk_ws/ws.proto", fileDescriptor_ws_e08a07288a333e78) } +func init() { proto.RegisterFile("sdkws/ws.proto", fileDescriptor_ws_e08a07288a333e78) } var fileDescriptor_ws_e08a07288a333e78 = []byte{ // 4125 bytes of a gzipped FileDescriptorProto diff --git a/pkg/proto/sdk_ws/ws.proto b/pkg/proto/sdkws/ws.proto similarity index 91% rename from pkg/proto/sdk_ws/ws.proto rename to pkg/proto/sdkws/ws.proto index 11594fce1..bc1122e4b 100644 --- a/pkg/proto/sdk_ws/ws.proto +++ b/pkg/proto/sdkws/ws.proto @@ -1,7 +1,7 @@ syntax = "proto3"; -import "Open-IM-Server/pkg/proto/sdk_ws/wrappers.proto"; -option go_package = "Open_IM/pkg/proto/sdk_ws;server_api_params"; -package server_api_params; +import "Open-IM-Server/pkg/proto/sdkws/wrappers.proto"; +option go_package = "Open_IM/pkg/proto/sdkws;sdkws"; +package sdkws; ////////////////////////////////base/////////////////////////////// @@ -128,70 +128,6 @@ message FriendRequest{ string ex = 15; } -///////////////////////////////////organization///////////////////////////////////// - -message Department { - string departmentID = 1; - string faceURL = 2; - string name = 3; - string parentID = 4; - int32 order = 5; - int32 departmentType = 6; - int64 createTime = 7; - uint32 subDepartmentNum = 8; - uint32 memberNum = 9; - string ex = 10; -} - - - -message OrganizationUser { - string userID = 1; - string nickname = 2; - string englishName = 3; - string faceURL = 4; - int32 gender = 5; - string mobile = 6; - string telephone = 7; - uint32 birth = 8; - string email = 9; - int64 createTime = 10; - string ex = 11; - string birthStr = 12; -} - -message DepartmentMember { - string userID = 1; - string departmentID = 2; - int32 order = 3; - string position = 4; - int32 leader = 5; - int32 status = 6; - string ex = 7; -} - - -message UserDepartmentMember { - OrganizationUser organizationUser = 1; - DepartmentMember departmentMember = 2; -} - - -message UserInDepartment { - OrganizationUser organizationUser = 1; - repeated DepartmentMember departmentMemberList = 2; -} - - - - - -///////////////////////////////////organization end////////////////////////////////// - - - - - ///////////////////////////////////base end///////////////////////////////////// message PullMessageBySeqListReq{ diff --git a/pkg/proto/user/user.pb.go b/pkg/proto/user/user.pb.go index ceddb4b11..c55249f0c 100644 --- a/pkg/proto/user/user.pb.go +++ b/pkg/proto/user/user.pb.go @@ -7,7 +7,7 @@ import proto "github.com/golang/protobuf/proto" import fmt "fmt" import math "math" import conversation "Open_IM/pkg/proto/conversation" -import sdk_ws "Open_IM/pkg/proto/sdk_ws" +import sdkws "Open_IM/pkg/proto/sdkws" import ( context "golang.org/x/net/context" @@ -26,10 +26,10 @@ var _ = math.Inf const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package type GetAllUserIDReq struct { - Pagination *sdk_ws.RequestPagination `protobuf:"bytes,1,opt,name=pagination" json:"pagination,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Pagination *sdkws.RequestPagination `protobuf:"bytes,1,opt,name=pagination" json:"pagination,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetAllUserIDReq) Reset() { *m = GetAllUserIDReq{} } @@ -56,7 +56,7 @@ func (m *GetAllUserIDReq) XXX_DiscardUnknown() { var xxx_messageInfo_GetAllUserIDReq proto.InternalMessageInfo -func (m *GetAllUserIDReq) GetPagination() *sdk_ws.RequestPagination { +func (m *GetAllUserIDReq) GetPagination() *sdkws.RequestPagination { if m != nil { return m.Pagination } @@ -270,10 +270,10 @@ func (m *GetDesignateUsersReq) GetUserIDs() []string { } type GetDesignateUsersResp struct { - UsersInfo []*sdk_ws.UserInfo `protobuf:"bytes,1,rep,name=usersInfo" json:"usersInfo,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + UsersInfo []*sdkws.UserInfo `protobuf:"bytes,1,rep,name=usersInfo" json:"usersInfo,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetDesignateUsersResp) Reset() { *m = GetDesignateUsersResp{} } @@ -300,7 +300,7 @@ func (m *GetDesignateUsersResp) XXX_DiscardUnknown() { var xxx_messageInfo_GetDesignateUsersResp proto.InternalMessageInfo -func (m *GetDesignateUsersResp) GetUsersInfo() []*sdk_ws.UserInfo { +func (m *GetDesignateUsersResp) GetUsersInfo() []*sdkws.UserInfo { if m != nil { return m.UsersInfo } @@ -308,10 +308,10 @@ func (m *GetDesignateUsersResp) GetUsersInfo() []*sdk_ws.UserInfo { } type UpdateUserInfoReq struct { - UserInfo *sdk_ws.UserInfo `protobuf:"bytes,1,opt,name=userInfo" json:"userInfo,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + UserInfo *sdkws.UserInfo `protobuf:"bytes,1,opt,name=userInfo" json:"userInfo,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *UpdateUserInfoReq) Reset() { *m = UpdateUserInfoReq{} } @@ -338,7 +338,7 @@ func (m *UpdateUserInfoReq) XXX_DiscardUnknown() { var xxx_messageInfo_UpdateUserInfoReq proto.InternalMessageInfo -func (m *UpdateUserInfoReq) GetUserInfo() *sdk_ws.UserInfo { +func (m *UpdateUserInfoReq) GetUserInfo() *sdkws.UserInfo { if m != nil { return m.UserInfo } @@ -1012,10 +1012,10 @@ func (m *BatchSetConversationsResp) GetFailed() []string { } type GetPaginationUsersReq struct { - Pagination *sdk_ws.RequestPagination `protobuf:"bytes,2,opt,name=pagination" json:"pagination,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Pagination *sdkws.RequestPagination `protobuf:"bytes,2,opt,name=pagination" json:"pagination,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetPaginationUsersReq) Reset() { *m = GetPaginationUsersReq{} } @@ -1042,7 +1042,7 @@ func (m *GetPaginationUsersReq) XXX_DiscardUnknown() { var xxx_messageInfo_GetPaginationUsersReq proto.InternalMessageInfo -func (m *GetPaginationUsersReq) GetPagination() *sdk_ws.RequestPagination { +func (m *GetPaginationUsersReq) GetPagination() *sdkws.RequestPagination { if m != nil { return m.Pagination } @@ -1050,11 +1050,11 @@ func (m *GetPaginationUsersReq) GetPagination() *sdk_ws.RequestPagination { } type GetPaginationUsersResp struct { - Total int32 `protobuf:"varint,1,opt,name=total" json:"total,omitempty"` - Users []*sdk_ws.UserInfo `protobuf:"bytes,2,rep,name=users" json:"users,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Total int32 `protobuf:"varint,1,opt,name=total" json:"total,omitempty"` + Users []*sdkws.UserInfo `protobuf:"bytes,2,rep,name=users" json:"users,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetPaginationUsersResp) Reset() { *m = GetPaginationUsersResp{} } @@ -1088,7 +1088,7 @@ func (m *GetPaginationUsersResp) GetTotal() int32 { return 0 } -func (m *GetPaginationUsersResp) GetUsers() []*sdk_ws.UserInfo { +func (m *GetPaginationUsersResp) GetUsers() []*sdkws.UserInfo { if m != nil { return m.Users } @@ -1096,10 +1096,10 @@ func (m *GetPaginationUsersResp) GetUsers() []*sdk_ws.UserInfo { } type UserRegisterReq struct { - Users []*sdk_ws.UserInfo `protobuf:"bytes,1,rep,name=users" json:"users,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Users []*sdkws.UserInfo `protobuf:"bytes,1,rep,name=users" json:"users,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *UserRegisterReq) Reset() { *m = UserRegisterReq{} } @@ -1126,7 +1126,7 @@ func (m *UserRegisterReq) XXX_DiscardUnknown() { var xxx_messageInfo_UserRegisterReq proto.InternalMessageInfo -func (m *UserRegisterReq) GetUsers() []*sdk_ws.UserInfo { +func (m *UserRegisterReq) GetUsers() []*sdkws.UserInfo { if m != nil { return m.Users } diff --git a/pkg/proto/user/user.proto b/pkg/proto/user/user.proto index 5755963d4..3fb70a6a2 100644 --- a/pkg/proto/user/user.proto +++ b/pkg/proto/user/user.proto @@ -1,5 +1,5 @@ syntax = "proto3"; -import "Open-IM-Server/pkg/proto/sdk_ws/ws.proto"; +import "Open-IM-Server/pkg/proto/sdkws/ws.proto"; import "Open-IM-Server/pkg/proto/conversation/conversation.proto"; option go_package = "Open_IM/pkg/proto/user;user"; package user; @@ -8,7 +8,7 @@ package user; message getAllUserIDReq{ - server_api_params.RequestPagination pagination = 1; + sdkws.RequestPagination pagination = 1; } message getAllUserIDResp{ int32 total = 1; @@ -32,11 +32,11 @@ message getDesignateUsersReq{ repeated string userIDs = 1; } message getDesignateUsersResp{ - repeated server_api_params.UserInfo usersInfo = 1; + repeated sdkws.UserInfo usersInfo = 1; } message updateUserInfoReq{ - server_api_params.UserInfo userInfo = 1; + sdkws.UserInfo userInfo = 1; } message updateUserInfoResp{ } @@ -113,16 +113,16 @@ message batchSetConversationsResp{ message getPaginationUsersReq { - server_api_params.RequestPagination pagination = 2; + sdkws.RequestPagination pagination = 2; } message getPaginationUsersResp{ int32 total = 1; - repeated server_api_params.UserInfo users = 2; + repeated sdkws.UserInfo users = 2; } message userRegisterReq { - repeated server_api_params.UserInfo users = 1; + repeated sdkws.UserInfo users = 1; } message userRegisterResp { } diff --git a/pkg/utils/callback.go b/pkg/utils/callback.go index 73bc9e2ee..83793bf32 100644 --- a/pkg/utils/callback.go +++ b/pkg/utils/callback.go @@ -2,13 +2,13 @@ package utils import ( "Open_IM/pkg/common/constant" - server_api_params "Open_IM/pkg/proto/sdk_ws" + sdkws "Open_IM/pkg/proto/sdkws" "github.com/golang/protobuf/proto" ) -func GetContent(msg *server_api_params.MsgData) string { +func GetContent(msg *sdkws.MsgData) string { if msg.ContentType >= constant.NotificationBegin && msg.ContentType <= constant.NotificationEnd { - var tips server_api_params.TipsComm + var tips sdkws.TipsComm _ = proto.Unmarshal(msg.Content, &tips) content := tips.JsonDetail return content diff --git a/script/check_all.sh b/script/check_all.sh index 76535c79f..82b77f042 100644 --- a/script/check_all.sh +++ b/script/check_all.sh @@ -7,7 +7,6 @@ service_port_name=( openImWsPort openImApiPort openImSdkWsPort - openImDemoPort openImCmsApiPort openImUserPort openImFriendPort @@ -18,9 +17,7 @@ service_port_name=( openImPushPort openImAdminCmsPort openImOfficePort - openImOrganizationPort openImConversationPort - openImCachePort ) switch=$(cat $config_path | grep demoswitch |awk -F '[:]' '{print $NF}') for i in ${service_port_name[*]}; do diff --git a/script/demo_svr_start.sh b/script/demo_svr_start.sh deleted file mode 100644 index 85b36ab25..000000000 --- a/script/demo_svr_start.sh +++ /dev/null @@ -1,47 +0,0 @@ -#!/usr/bin/env bash -#Include shell font styles and some basic information -source ./style_info.cfg -source ./path_info.cfg -source ./function.sh -switch=$(cat $config_path | grep demoswitch |awk -F '[:]' '{print $NF}') -if [ ${switch} != "true" ]; then - echo -e ${YELLOW_PREFIX}" demo service switch is false not start demo "${COLOR_SUFFIX} - exit 0 -fi -list1=$(cat $config_path | grep openImDemoPort | awk -F '[:]' '{print $NF}') -list_to_string $list1 -api_ports=($ports_array) - -#Check if the service exists -#If it is exists,kill this process -check=$(ps aux | grep -w ./${demo_server_name} | grep -v grep | wc -l) -if [ $check -ge 1 ]; then - oldPid=$(ps aux | grep -w ./${demo_server_name} | grep -v grep | awk '{print $2}') - kill -9 $oldPid -fi -#Waiting port recycling -sleep 1 -cd ${demo_server_binary_root} - -for ((i = 0; i < ${#api_ports[@]}; i++)); do - nohup ./${demo_server_name} -port ${api_ports[$i]} >>../logs/openIM.log 2>&1 & -done - -sleep 3 -#Check launched service process -check=$(ps aux | grep -w ./${demo_server_name} | grep -v grep | wc -l) -if [ $check -ge 1 ]; then - newPid=$(ps aux | grep -w ./${demo_server_name} | grep -v grep | awk '{print $2}') - ports=$(netstat -netulp | grep -w ${newPid} | awk '{print $4}' | awk -F '[:]' '{print $NF}') - allPorts="" - - for i in $ports; do - allPorts=${allPorts}"$i " - done - echo -e ${SKY_BLUE_PREFIX}"SERVICE START SUCCESS "${COLOR_SUFFIX} - echo -e ${SKY_BLUE_PREFIX}"SERVICE_NAME: "${COLOR_SUFFIX}${YELLOW_PREFIX}${demo_server_name}${COLOR_SUFFIX} - echo -e ${SKY_BLUE_PREFIX}"PID: "${COLOR_SUFFIX}${YELLOW_PREFIX}${newPid}${COLOR_SUFFIX} - echo -e ${SKY_BLUE_PREFIX}"LISTENING_PORT: "${COLOR_SUFFIX}${YELLOW_PREFIX}${allPorts}${COLOR_SUFFIX} -else - echo -e ${YELLOW_PREFIX}${demo_server_name}${COLOR_SUFFIX}${RED_PREFIX}"SERVICE START ERROR, PLEASE CHECK openIM.log"${COLOR_SUFFIX} -fi \ No newline at end of file diff --git a/script/path_info.cfg b/script/path_info.cfg index 48ba5f96f..cde2736b1 100644 --- a/script/path_info.cfg +++ b/script/path_info.cfg @@ -47,7 +47,6 @@ service_source_root=( ../cmd/rpc/open_im_auth/ ../cmd/rpc/open_im_admin_cms/ ../cmd/rpc/open_im_office/ - ../cmd/rpc/open_im_organization/ ../cmd/rpc/open_im_conversation/ ../cmd/rpc/open_im_cache/ ../cmd/open_im_cron_task @@ -70,9 +69,7 @@ service_names=( open_im_auth open_im_admin_cms open_im_office - open_im_organization open_im_conversation - open_im_cache open_im_cron_task ${msg_gateway_name} ${msg_transfer_name} diff --git a/script/sdk_svr_start.sh b/script/sdk_svr_start.sh index 115ceff82..e10ff6bf8 100644 --- a/script/sdk_svr_start.sh +++ b/script/sdk_svr_start.sh @@ -10,7 +10,7 @@ api_address=$(cat $config_path | grep openImApiAddress | awk -F '[ ]' '{print $N list3=$(cat $config_path | grep openImSdkWsPort | awk -F '[:]' '{print $NF}') logLevel=$(cat $config_path | grep remainLogLevel | awk -F '[:]' '{print $NF}') list_to_string $list3 -sdk_ws_ports=($ports_array) +sdkws_ports=($ports_array) @@ -24,7 +24,7 @@ fi #Waiting port recycling sleep 1 cd ${sdk_server_binary_root} - nohup ./${sdk_server_name} -openIM_ws_address ${ws_address} -sdk_ws_port ${sdk_ws_ports[0]} -openIM_api_address ${api_address} -openIM_log_level ${logLevel} >>../logs/openIM.log 2>&1 & + nohup ./${sdk_server_name} -openIM_ws_address ${ws_address} -sdkws_port ${sdkws_ports[0]} -openIM_api_address ${api_address} -openIM_log_level ${logLevel} >>../logs/openIM.log 2>&1 & #Check launched service process sleep 3 diff --git a/script/start_rpc_service.sh b/script/start_rpc_service.sh index 8abfde5ed..6c3feaa97 100644 --- a/script/start_rpc_service.sh +++ b/script/start_rpc_service.sh @@ -17,9 +17,7 @@ service_filename=( open_im_admin_cms ${msg_name} open_im_office - open_im_organization open_im_conversation - open_im_cache ) #service config port name @@ -35,9 +33,7 @@ service_port_name=( openImAdminCmsPort openImMessagePort openImOfficePort - openImOrganizationPort openImConversationPort - openImCachePort ) service_prometheus_port_name=( @@ -52,9 +48,7 @@ service_prometheus_port_name=( adminCmsPrometheusPort messagePrometheusPort officePrometheusPort - organizationPrometheusPort conversationPrometheusPort - cachePrometheusPort ) for ((i = 0; i < ${#service_filename[*]}; i++)); do diff --git a/script/win_start_all_service.cmd b/script/win_start_all_service.cmd index e7b1c819e..5b221418b 100644 --- a/script/win_start_all_service.cmd +++ b/script/win_start_all_service.cmd @@ -16,7 +16,7 @@ start cmd /C .\open_im_conversation.exe -port 10230 start cmd /C .\open_im_cache.exe -port 10240 start cmd /C .\open_im_push.exe -port 10170 start cmd /C .\open_im_msg_transfer.exe -start cmd /C .\open_im_sdk_server.exe -openIM_api_port 10002 -openIM_ws_port 10001 -sdk_ws_port 10003 -openIM_log_level 6 +start cmd /C .\open_im_sdk_server.exe -openIM_api_port 10002 -openIM_ws_port 10001 -sdkws_port 10003 -openIM_log_level 6 start cmd /C .\open_im_msg_gateway.exe -rpc_port 10140 -ws_port 10001 start cmd /C .\open_im_demo.exe -port 10004 cd %ROOT% \ No newline at end of file