ソースを参照

update

master
DengBiao 1年前
コミット
b21d8361d5
4個のファイルの変更23行の追加11行の削除
  1. +13
    -6
      internal/logic/app/group_app.go
  2. +1
    -1
      internal/logic/domain/group/model/group.go
  3. +7
    -3
      pkg/pb/logic.ext.pb.go
  4. +2
    -1
      pkg/proto/logic.ext.proto

+ 13
- 6
internal/logic/app/group_app.go ファイルの表示

@@ -175,7 +175,7 @@ func (*groupApp) SetGroupMemberBanned(ctx context.Context, optId, groupId int64,
if groupUser == nil {
return nil, errors.New("未查询到群组用户信息")
}
if groupUser.MemberType != int(pb.MemberType_GMT_ADMIN) {
if groupUser.MemberType != int(pb.MemberType_GMT_ADMIN) && groupUser.MemberType != int(pb.MemberType_GMT_MANAGE) {
return nil, errors.New("非管理员操作")
}

@@ -200,10 +200,17 @@ func (*groupApp) SetGroupMemberBanned(ctx context.Context, optId, groupId int64,
} else {
//设置成员禁言
//1、更新 `group` 的 is_all_member_banned 状态
group.IsAllMemberBanned = int32(pb.AllMemberBannedType_NOT_All_Member_Banned)
err := repo.GroupRepo.Save(group)
if err != nil {
return nil, err
if group.IsAllMemberBanned != int32(pb.AllMemberBannedType_NOT_All_Member_Banned) {
group.IsAllMemberBanned = int32(pb.AllMemberBannedType_NOT_All_Member_Banned)
err := repo.GroupRepo.Save(group)
if err != nil {
return nil, err
}
//TODO::推送消息
err = group.PushGroupMemberBanned(ctx, optId, -1, isAllMemberBanned)
if err != nil {
return nil, err
}
}

//2、更新 `group_user` 的 status 状态
@@ -240,7 +247,7 @@ func (*groupApp) SetGroupMemberRemoveBanned(ctx context.Context, optId, groupId
if groupUser == nil {
return errors.New("未查询到群组用户信息")
}
if groupUser.MemberType != int(pb.MemberType_GMT_ADMIN) {
if groupUser.MemberType != int(pb.MemberType_GMT_ADMIN) && groupUser.MemberType != int(pb.MemberType_GMT_MANAGE) {
return errors.New("非管理员操作")
}



+ 1
- 1
internal/logic/domain/group/model/group.go ファイルの表示

@@ -93,7 +93,7 @@ func CreateGroup(userId int64, in *pb.CreateGroupReq) *Group {
UpdateTime: now,
}

// 创建者添加为管理员
// 创建者添加为群主
group.Members = append(group.Members, GroupUser{
GroupId: group.Id,
UserId: userId,


+ 7
- 3
pkg/pb/logic.ext.pb.go ファイルの表示

@@ -28,8 +28,9 @@ type MemberType int32

const (
MemberType_GMT_UNKNOWN MemberType = 0 // 未知
MemberType_GMT_ADMIN MemberType = 1 // 管理员
MemberType_GMT_ADMIN MemberType = 1 // 群主
MemberType_GMT_MEMBER MemberType = 2 // 成员
MemberType_GMT_MANAGE MemberType = 3 // 管理员
)

// Enum value maps for MemberType.
@@ -38,11 +39,13 @@ var (
0: "GMT_UNKNOWN",
1: "GMT_ADMIN",
2: "GMT_MEMBER",
3: "GMT_MANAGE",
}
MemberType_value = map[string]int32{
"GMT_UNKNOWN": 0,
"GMT_ADMIN": 1,
"GMT_MEMBER": 2,
"GMT_MANAGE": 3,
}
)

@@ -2659,11 +2662,12 @@ var file_logic_ext_proto_rawDesc = []byte{
0x42, 0x61, 0x6e, 0x6e, 0x65, 0x64, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73,
0x70, 0x12, 0x29, 0x0a, 0x07, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03,
0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x65, 0x6d,
0x62, 0x65, 0x72, 0x52, 0x07, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x2a, 0x3c, 0x0a, 0x0a,
0x62, 0x65, 0x72, 0x52, 0x07, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x2a, 0x4c, 0x0a, 0x0a,
0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0f, 0x0a, 0x0b, 0x47, 0x4d,
0x54, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x47,
0x4d, 0x54, 0x5f, 0x41, 0x44, 0x4d, 0x49, 0x4e, 0x10, 0x01, 0x12, 0x0e, 0x0a, 0x0a, 0x47, 0x4d,
0x54, 0x5f, 0x4d, 0x45, 0x4d, 0x42, 0x45, 0x52, 0x10, 0x02, 0x2a, 0x6a, 0x0a, 0x13, 0x41, 0x6c,
0x54, 0x5f, 0x4d, 0x45, 0x4d, 0x42, 0x45, 0x52, 0x10, 0x02, 0x12, 0x0e, 0x0a, 0x0a, 0x47, 0x4d,
0x54, 0x5f, 0x4d, 0x41, 0x4e, 0x41, 0x47, 0x45, 0x10, 0x03, 0x2a, 0x6a, 0x0a, 0x13, 0x41, 0x6c,
0x6c, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x42, 0x61, 0x6e, 0x6e, 0x65, 0x64, 0x54, 0x79, 0x70,
0x65, 0x12, 0x1d, 0x0a, 0x19, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x5f, 0x41, 0x6c, 0x6c,
0x5f, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x5f, 0x42, 0x61, 0x6e, 0x6e, 0x65, 0x64, 0x10, 0x00,


+ 2
- 1
pkg/proto/logic.ext.proto ファイルの表示

@@ -210,8 +210,9 @@ message AddGroupMembersResp {

enum MemberType {
GMT_UNKNOWN = 0; // 未知
GMT_ADMIN = 1; // 管理员
GMT_ADMIN = 1; // 群主
GMT_MEMBER = 2; // 成员
GMT_MANAGE = 3; // 管理员
}

message UpdateGroupMemberReq {


読み込み中…
キャンセル
保存