dengbiao 1 week ago
parent
commit
0902e4701d
5 changed files with 486 additions and 287 deletions
  1. +15
    -0
      internal/logic/api/logic_ext.go
  2. +3
    -0
      internal/logic/domain/group/model/group.go
  3. +458
    -286
      pkg/pb/logic.ext.pb.go
  4. +1
    -1
      pkg/proto/business.ext.proto
  5. +9
    -0
      pkg/proto/logic.ext.proto

+ 15
- 0
internal/logic/api/logic_ext.go View File

@@ -280,6 +280,21 @@ func (s *LogicExtServer) AddGroupMembers(ctx context.Context, in *pb.AddGroupMem
return &pb.AddGroupMembersResp{UserIds: userIds}, err
}

func (s *LogicExtServer) ScanQrCodeAddGroup(ctx context.Context, in *pb.ScanQrCodeAddGroupReq) (*pb.ScanQrCodeAddGroupResp, error) {
userId, _, err := grpclib.GetCtxData(ctx)
if err != nil {
return nil, err
}
userIds, err := app.GroupApp.AddMembers(ctx, -2, in.GroupId, []int64{userId})
var isAlready bool
for _, v := range userIds {
if v == userId {
isAlready = true
}
}
return &pb.ScanQrCodeAddGroupResp{IsAlready: isAlready}, err
}

// UpdateGroupMember 更新群组成员信息
func (*LogicExtServer) UpdateGroupMember(ctx context.Context, in *pb.UpdateGroupMemberReq) (*pb.Empty, error) {
userId, _, err := grpclib.GetCtxData(ctx)


+ 3
- 0
internal/logic/domain/group/model/group.go View File

@@ -456,6 +456,9 @@ func (g *Group) PushAddMember(ctx context.Context, optUserId int64, addedIds []i
if optUserId == -1 {
optUser.Nickname = "后台操作"
}
if optUserId == -2 {
optUser.Nickname = "扫码加入"
}
err = g.PushMessage(ctx, pb.PushCode_PC_ADD_GROUP_MEMBERS, &pb.AddGroupMembersPush{
OptId: optUser.UserId,
OptName: optUser.Nickname,


+ 458
- 286
pkg/pb/logic.ext.pb.go
File diff suppressed because it is too large
View File


+ 1
- 1
pkg/proto/business.ext.proto View File

@@ -85,7 +85,7 @@ enum GroupNoticePublishType {
UNKNOWN_PUBLISH = 0; // 未知
ONLY_PUBLISH = 1; // 仅发布
PUBLISH_AND_NOTICE = 2; // 发布并通知
NOTICE_AND_TOP_UP = 3; // 存在骗钱行为
NOTICE_AND_TOP_UP = 3; // 通知并置顶
}




+ 9
- 0
pkg/proto/logic.ext.proto View File

@@ -42,6 +42,8 @@ service LogicExt {

// 添加群组成员
rpc AddGroupMembers (AddGroupMembersReq) returns (AddGroupMembersResp);
// 扫码入群
rpc ScanQrCodeAddGroup (ScanQrCodeAddGroupReq) returns (ScanQrCodeAddGroupResp);
// 更新群组成员信息
rpc UpdateGroupMember (UpdateGroupMemberReq) returns (Empty);
// 删除群组成员
@@ -223,6 +225,13 @@ message AddGroupMembersResp {
repeated int64 user_ids = 1; // 已经在群组的用户id列表
}

message ScanQrCodeAddGroupReq {
int64 group_id = 1; // 群组id
}
message ScanQrCodeAddGroupResp {
bool isAlready = 1; // 是否已加入群
}

enum GroupKindType {
CREATE_UNKNOWN = 0; // 未知
CREATE_USER = 1; // 用户创建


Loading…
Cancel
Save