Merge remote-tracking branch 'origin/tuoyun' into tuoyun

pull/218/head
skiffer-git 3 years ago
commit 11eaaab72d

@ -163,6 +163,7 @@ func (s *officeServer) SendMsg2Tag(_ context.Context, req *pbOffice.SendMsg2TagR
log.NewError(req.OperationID, utils.GetSelfFuncName(), "GetGroupMemberIDListByGroupID failed", err.Error())
continue
}
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), userIDList)
groupUserIDList = append(groupUserIDList, userIDList...)
}
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), groupUserIDList, req.GroupList)
@ -172,7 +173,7 @@ func (s *officeServer) SendMsg2Tag(_ context.Context, req *pbOffice.SendMsg2TagR
userIDList = append(userIDList, req.UserList...)
userIDList = utils.RemoveUserIDRepByMap(userIDList)
for i, userID := range userIDList {
if userID == req.SendID {
if userID == req.SendID || userID == "" {
userIDList = append(userIDList[:i], userIDList[i+1:]...)
}
}

@ -53,7 +53,6 @@ type SendMsg2TagReq struct {
SenderPlatformID int32 `json:"senderPlatformID" binding:"required"`
Content string `json:"content" binding:"required"`
ContentType int32 `json:"contentType" binding:"required"`
OperationID string `json:"operationID" binding:"required"`
}

@ -74,11 +74,15 @@ func GetGroupMemberIDListByGroupID(groupID string) ([]string, error) {
return nil, err
}
dbConn.LogMode(true)
var groupMemberIDList []string
err = dbConn.Table("group_members").Select("user_id").Where("group_id=?", groupID).Find(&groupMemberIDList).Error
var groupMembers []db.GroupMember
err = dbConn.Table("group_members").Select("user_id").Where("group_id=?", groupID).Find(&groupMembers).Error
if err != nil {
return nil, err
}
var groupMemberIDList []string
for _, v := range groupMembers {
groupMemberIDList = append(groupMemberIDList, v.UserID)
}
return groupMemberIDList, nil
}

Loading…
Cancel
Save