mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-04 09:05:59 +08:00
add
This commit is contained in:
@@ -11,6 +11,14 @@ type GroupResponse struct {
|
||||
ProfilePhoto string `json:"profile_photo"`
|
||||
}
|
||||
|
||||
type GetGroupByIdRequest struct {
|
||||
GroupId string `form:"group_id" binding:"required"`
|
||||
}
|
||||
|
||||
type GetGroupByIdResponse struct {
|
||||
GroupResponse
|
||||
}
|
||||
|
||||
type GetGroupRequest struct {
|
||||
GroupName string `form:"group_name" binding:"required"`
|
||||
RequestPagination
|
||||
@@ -86,4 +94,4 @@ type GetGroupMembersResponse struct {
|
||||
GroupMemberList []GroupMemberResponse `json:"group_member_list"`
|
||||
GroupMemberNums int `json:"group_member_nums"`
|
||||
ResponsePagination
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
package cms_api_struct
|
||||
|
||||
type StatisticsRequest struct {
|
||||
From string `json:"from"`
|
||||
To string `json:"to"`
|
||||
type GetStatisticsRequest struct {
|
||||
FromTime string `json:"from"`
|
||||
ToTime string `json:"to"`
|
||||
}
|
||||
|
||||
// 单聊
|
||||
type MessageStatisticsResponse struct {
|
||||
type GetMessageStatisticsResponse struct {
|
||||
PrivateMessageNum int `json:"private_message_num"`
|
||||
GroupMessageNum int `json:"group_message_num"`
|
||||
PrivateMessageNumList []struct {
|
||||
@@ -20,7 +20,7 @@ type MessageStatisticsResponse struct {
|
||||
}
|
||||
|
||||
// 用户统计
|
||||
type UserStatisticsResponse struct {
|
||||
type GetUserStatisticsResponse struct {
|
||||
IncreaseUserNum int `json:"increase_user_num"`
|
||||
ActiveUserNum int `json:"active_user_num"`
|
||||
TotalUserNum int `json:"total_user_num"`
|
||||
@@ -39,7 +39,7 @@ type UserStatisticsResponse struct {
|
||||
}
|
||||
|
||||
// 群聊统计
|
||||
type GroupMessageStatisticsResponse struct {
|
||||
type GetGroupMessageStatisticsResponse struct {
|
||||
IncreaseGroupNum int `json:"increase_group_num"`
|
||||
TotalGroupNum int `json:"total_group_num"`
|
||||
IncreaseGroupNumList []struct {
|
||||
@@ -52,7 +52,7 @@ type GroupMessageStatisticsResponse struct {
|
||||
} `json:"total_group_num_list"`
|
||||
}
|
||||
|
||||
type ActiveUserStatisticsResponse struct {
|
||||
type GetActiveUserStatisticsResponse struct {
|
||||
ActiveUserList []struct {
|
||||
NickName string `json:"nick_name"`
|
||||
Id int `json:"id"`
|
||||
@@ -60,7 +60,7 @@ type ActiveUserStatisticsResponse struct {
|
||||
} `json:"active_user_list"`
|
||||
}
|
||||
|
||||
type ActiveGroupStatisticsResponse struct {
|
||||
type GetActiveGroupStatisticsResponse struct {
|
||||
ActiveGroupList []struct {
|
||||
GroupNickName string `json:"group_nick_name"`
|
||||
GroupId int `json:"group_id"`
|
||||
|
||||
@@ -83,23 +83,18 @@ func GetGroups(pageNumber, showNumber int) ([]db.Group, error) {
|
||||
return groups, nil
|
||||
}
|
||||
|
||||
func BanGroupChat(groupId string) error {
|
||||
var group db.Group
|
||||
group.Status = constant.GroupBanChat
|
||||
|
||||
func OperateGroupStatus(groupId string, groupStatus int32) error {
|
||||
group := db.Group{
|
||||
GroupID: groupId,
|
||||
Status: groupStatus,
|
||||
}
|
||||
if err := SetGroupInfo(group); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func BanPrivateChat(groupId string) error {
|
||||
var group db.Group
|
||||
group.Status = constant.GroupBanPrivateChat
|
||||
if err := SetGroupInfo(group); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func DeleteGroup(groupId string) error {
|
||||
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
|
||||
@@ -114,7 +109,7 @@ func DeleteGroup(groupId string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func SetGroupMaster(userId, groupId string) error {
|
||||
func OperateGroupRole(userId, groupId string, roleLevel int32) error {
|
||||
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -123,6 +118,7 @@ func SetGroupMaster(userId, groupId string) error {
|
||||
groupMember := db.GroupMember{
|
||||
UserID: userId,
|
||||
GroupID: groupId,
|
||||
RoleLevel: roleLevel,
|
||||
}
|
||||
updateInfo := db.GroupMember{
|
||||
RoleLevel: constant.GroupOwner,
|
||||
@@ -145,3 +141,18 @@ func GetGroupsCountNum() (int, error) {
|
||||
}
|
||||
return count, nil
|
||||
}
|
||||
|
||||
func GetGroupsById(groupId string) (db.Group, error) {
|
||||
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
|
||||
group := db.Group{
|
||||
GroupID: groupId,
|
||||
}
|
||||
if err != nil {
|
||||
return group, err
|
||||
}
|
||||
dbConn.LogMode(true)
|
||||
if err := dbConn.Find(&group).First(&group).Error; err != nil {
|
||||
return group, err
|
||||
}
|
||||
return group, nil
|
||||
}
|
||||
+445
-409
File diff suppressed because it is too large
Load Diff
+21
-20
@@ -222,31 +222,24 @@ message GetGroupMemberReq {
|
||||
string OperationID = 2;
|
||||
}
|
||||
|
||||
message BanGroupChatReq {
|
||||
string GroupId = 1;
|
||||
string OperationID = 2;
|
||||
message OperateGroupStatusReq {
|
||||
string GroupId = 1;
|
||||
int32 Status = 2;
|
||||
string OperationID = 3;
|
||||
}
|
||||
|
||||
message BanGroupChatResp {
|
||||
message OperateGroupStatusResp {
|
||||
|
||||
}
|
||||
|
||||
message BanPrivateChatReq {
|
||||
string GroupId = 1;
|
||||
string OperationID = 2;
|
||||
}
|
||||
|
||||
message BanPrivateChatResp {
|
||||
|
||||
}
|
||||
|
||||
message SetMasterReq {
|
||||
message OperateUserRoleReq {
|
||||
string GroupId = 1;
|
||||
string UserId = 2;
|
||||
string OperationID = 3;
|
||||
int32 RoleLevel = 3;
|
||||
string OperationID = 4;
|
||||
}
|
||||
|
||||
message SetMasterResp {
|
||||
message OperateUserRoleResp {
|
||||
|
||||
}
|
||||
|
||||
@@ -259,6 +252,15 @@ message DeleteGroupResp {
|
||||
|
||||
}
|
||||
|
||||
message GetGroupByIdReq {
|
||||
string GroupId = 1;
|
||||
string OperationID = 2;
|
||||
}
|
||||
|
||||
message GetGroupByIdResp {
|
||||
server_api_params.GroupInfo GroupInfo = 1;
|
||||
}
|
||||
|
||||
service group{
|
||||
rpc createGroup(CreateGroupReq) returns(CreateGroupResp);
|
||||
rpc joinGroup(JoinGroupReq) returns(JoinGroupResp);
|
||||
@@ -275,12 +277,11 @@ service group{
|
||||
rpc inviteUserToGroup(InviteUserToGroupReq) returns (InviteUserToGroupResp);
|
||||
rpc getGroupAllMember(GetGroupAllMemberReq) returns(GetGroupAllMemberResp);
|
||||
|
||||
|
||||
rpc GetGroupById(GetGroupByIdReq) returns(GetGroupByIdResp);
|
||||
rpc GetGroup(GetGroupReq) returns(GetGroupResp);
|
||||
rpc GetGroups(GetGroupsReq) returns(GetGroupsResp);
|
||||
rpc BanGroupChat(BanGroupChatReq) returns(BanGroupChatResp);
|
||||
rpc BanPrivateChat(BanPrivateChatReq) returns(BanPrivateChatResp);
|
||||
rpc SetMaster(SetMasterReq) returns(SetMasterResp);
|
||||
rpc OperateGroupStatus(OperateGroupStatusReq) returns(OperateGroupStatusResp);
|
||||
rpc OperateUserRole(OperateUserRoleReq) returns(OperateUserRoleResp);
|
||||
rpc DeleteGroup(DeleteGroupReq) returns(DeleteGroupResp);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
|
||||
all_proto=(
|
||||
statistics/statistics.proto
|
||||
# auth/auth.proto
|
||||
# friend/friend.proto
|
||||
group/group.proto
|
||||
# group/group.proto
|
||||
# user/user.proto
|
||||
# chat/chat.proto
|
||||
# push/push.proto
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.26.0
|
||||
// protoc v3.19.3
|
||||
// protoc-gen-go v1.27.1
|
||||
// protoc v3.15.5
|
||||
// source: sdk_ws/ws.proto
|
||||
|
||||
package server_api_params
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,95 @@
|
||||
syntax = "proto3";
|
||||
import "Open_IM/pkg/proto/sdk_ws/ws.proto";
|
||||
option go_package = "./statistics;statistics";
|
||||
package statistics;
|
||||
|
||||
message StatisticsReq {
|
||||
string from = 1;
|
||||
string to = 2;
|
||||
}
|
||||
|
||||
message GetActiveUserReq{
|
||||
server_api_params.ResponsePagination Pagination = 1;
|
||||
string OperationID = 2;
|
||||
}
|
||||
|
||||
message UserResp{
|
||||
string NickName = 1;
|
||||
string UserId = 2;
|
||||
string MessageNum = 3;
|
||||
}
|
||||
|
||||
message GetActiveUserResp {
|
||||
repeated UserResp Users = 1;
|
||||
server_api_params.ResponsePagination Pagination = 2;
|
||||
}
|
||||
|
||||
message GetActiveGroupReq{
|
||||
server_api_params.ResponsePagination Pagination = 1;
|
||||
string OperationID = 2;
|
||||
}
|
||||
|
||||
message GroupResp {
|
||||
string GroupName = 1;
|
||||
string GroupId = 2;
|
||||
string MessageNum = 3;
|
||||
}
|
||||
|
||||
message GetActiveGroupResp {
|
||||
repeated GroupResp Groups = 1;
|
||||
server_api_params.ResponsePagination Pagination = 2;
|
||||
}
|
||||
|
||||
message DateNumList {
|
||||
string Date = 1;
|
||||
int32 Num = 2;
|
||||
}
|
||||
|
||||
|
||||
message GetMessageStatisticsReq {
|
||||
StatisticsReq StatisticsReq = 1;
|
||||
string OperationID = 2;
|
||||
}
|
||||
|
||||
|
||||
message GetMessageStatisticsResp {
|
||||
int32 PrivateMessageNum = 1;
|
||||
int32 GroupMessageNum = 2;
|
||||
repeated DateNumList PrivateMessageNumList = 3;
|
||||
repeated DateNumList GroupMessageNumList = 4;
|
||||
}
|
||||
|
||||
message GetGroupStatisticsReq {
|
||||
StatisticsReq StatisticsReq = 1;
|
||||
string OperationID = 2;
|
||||
}
|
||||
|
||||
|
||||
message GetGroupStatisticsResp {
|
||||
int32 IncreaseGroupNum = 1;
|
||||
int32 TotalGroupNum = 2;
|
||||
repeated DateNumList IncreaseGroupNumList = 3;
|
||||
repeated DateNumList TotalGroupNumList = 4;
|
||||
}
|
||||
|
||||
message GetUserStatisticsReq {
|
||||
StatisticsReq StatisticsReq = 1;
|
||||
string OperationID = 2;
|
||||
}
|
||||
|
||||
message GetUserStatisticsResp {
|
||||
int32 IncreaseUserNum = 1;
|
||||
int32 ActiveUserNum = 2;
|
||||
int32 TotalUserNum = 3;
|
||||
repeated DateNumList IncreaseUserNumList = 4;
|
||||
repeated DateNumList ActiveUserNumList = 5;
|
||||
repeated DateNumList TotalUserNumList = 6;
|
||||
}
|
||||
|
||||
service user {
|
||||
rpc GetActiveUser(GetActiveUserReq) returns(GetActiveUserResp);
|
||||
rpc GetActiveGroup(GetActiveGroupReq) returns(GetActiveGroupResp);
|
||||
rpc GetMessageStatistics(GetMessageStatisticsReq) returns(GetMessageStatisticsResp);
|
||||
rpc GetGroupStatistics(GetGroupStatisticsReq) returns(GetGroupStatisticsResp);
|
||||
rpc GetUserStatistics(GetUserStatisticsReq) returns(GetUserStatisticsResp);
|
||||
}
|
||||
Reference in New Issue
Block a user