mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-23 18:00:32 +08:00
callback
This commit is contained in:
parent
16a56457ed
commit
bbe8c46df9
@ -91,12 +91,6 @@ func (s *groupServer) CreateGroup(ctx context.Context, req *pbGroup.CreateGroupR
|
|||||||
log.NewError(req.OperationID, "CheckAccess false ", req.OpUserID, req.OwnerUserID)
|
log.NewError(req.OperationID, "CheckAccess false ", req.OpUserID, req.OwnerUserID)
|
||||||
return &pbGroup.CreateGroupResp{ErrCode: constant.ErrAccess.ErrCode, ErrMsg: constant.ErrAccess.ErrMsg}, nil
|
return &pbGroup.CreateGroupResp{ErrCode: constant.ErrAccess.ErrCode, ErrMsg: constant.ErrAccess.ErrMsg}, nil
|
||||||
}
|
}
|
||||||
canCreate, err := callbackBeforeCreateGroup(req)
|
|
||||||
if err != nil || !canCreate {
|
|
||||||
if err != nil {
|
|
||||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "callbackBeforeCreateGroup failed")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
groupId := req.GroupInfo.GroupID
|
groupId := req.GroupInfo.GroupID
|
||||||
if groupId == "" {
|
if groupId == "" {
|
||||||
@ -107,11 +101,14 @@ func (s *groupServer) CreateGroup(ctx context.Context, req *pbGroup.CreateGroupR
|
|||||||
utils.CopyStructFields(&groupInfo, req.GroupInfo)
|
utils.CopyStructFields(&groupInfo, req.GroupInfo)
|
||||||
groupInfo.CreatorUserID = req.OpUserID
|
groupInfo.CreatorUserID = req.OpUserID
|
||||||
groupInfo.GroupID = groupId
|
groupInfo.GroupID = groupId
|
||||||
err = imdb.InsertIntoGroup(groupInfo)
|
err := imdb.InsertIntoGroup(groupInfo)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.NewError(req.OperationID, "InsertIntoGroup failed, ", err.Error(), groupInfo)
|
log.NewError(req.OperationID, "InsertIntoGroup failed, ", err.Error(), groupInfo)
|
||||||
return &pbGroup.CreateGroupResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}, http.WrapError(constant.ErrDB)
|
return &pbGroup.CreateGroupResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}, http.WrapError(constant.ErrDB)
|
||||||
}
|
}
|
||||||
|
var okUserIDList []string
|
||||||
|
|
||||||
|
if req.GroupInfo.GroupType == constant.NormalGroup {
|
||||||
groupMember := db.GroupMember{}
|
groupMember := db.GroupMember{}
|
||||||
us := &db.User{}
|
us := &db.User{}
|
||||||
if req.OwnerUserID == "" {
|
if req.OwnerUserID == "" {
|
||||||
@ -132,7 +129,7 @@ func (s *groupServer) CreateGroup(ctx context.Context, req *pbGroup.CreateGroupR
|
|||||||
return &pbGroup.CreateGroupResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}, http.WrapError(constant.ErrDB)
|
return &pbGroup.CreateGroupResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}, http.WrapError(constant.ErrDB)
|
||||||
}
|
}
|
||||||
|
|
||||||
initMemberList:
|
initMemberList:
|
||||||
var okUserIDList []string
|
var okUserIDList []string
|
||||||
//to group member
|
//to group member
|
||||||
for _, user := range req.InitMemberList {
|
for _, user := range req.InitMemberList {
|
||||||
@ -174,6 +171,13 @@ initMemberList:
|
|||||||
resp.GroupInfo.OwnerUserID = req.OwnerUserID
|
resp.GroupInfo.OwnerUserID = req.OwnerUserID
|
||||||
okUserIDList = append(okUserIDList, req.OwnerUserID)
|
okUserIDList = append(okUserIDList, req.OwnerUserID)
|
||||||
}
|
}
|
||||||
|
} else if req.GroupInfo.GroupType == constant.SuperGroup {
|
||||||
|
for _, v := range req.InitMemberList {
|
||||||
|
okUserIDList = append(okUserIDList, v.UserID)
|
||||||
|
}
|
||||||
|
//memberCount := len(okUserIDList)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if len(okUserIDList) != 0 {
|
if len(okUserIDList) != 0 {
|
||||||
addGroupMemberToCacheReq := &pbCache.AddGroupMemberToCacheReq{
|
addGroupMemberToCacheReq := &pbCache.AddGroupMemberToCacheReq{
|
||||||
|
@ -154,7 +154,8 @@ const (
|
|||||||
|
|
||||||
//GroupType
|
//GroupType
|
||||||
NormalGroup = 0
|
NormalGroup = 0
|
||||||
DepartmentGroup = 1
|
SuperGroup = 1
|
||||||
|
DepartmentGroup = 2
|
||||||
|
|
||||||
GroupBaned = 3
|
GroupBaned = 3
|
||||||
GroupBanPrivateChat = 4
|
GroupBanPrivateChat = 4
|
||||||
|
@ -878,6 +878,10 @@ func (d *DataBases) GetUserFriendWorkMoments(showNumber, pageNumber int32, userI
|
|||||||
return workMomentList, err
|
return workMomentList, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (d *DataBases) CreateSuperGroup() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
func generateTagID(tagName, userID string) string {
|
func generateTagID(tagName, userID string) string {
|
||||||
return utils.Md5(tagName + userID + strconv.Itoa(rand.Int()) + time.Now().String())
|
return utils.Md5(tagName + userID + strconv.Itoa(rand.Int()) + time.Now().String())
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user