Merge branch 'refs/heads/feature-im-gitea'

This commit is contained in:
junleea 2024-08-20 10:50:42 +08:00
commit 4bf18347ce
2 changed files with 7 additions and 1 deletions

View File

@ -274,6 +274,6 @@ func FindGroupUsers(group_id int) []GroupUser {
func FindGroupByNameLike(groupName string) []Group {
var groups []Group
DB.Debug().Where("group_name like ?", "%"+groupName+"%").Find(&groups)
DB.Debug().Where("group_name like ?", "%"+groupName+"%").Limit(20).Find(&groups)
return groups
}

View File

@ -66,6 +66,12 @@ func CreateGeneralMessageService(from_id, to_id, msg_type, group_id int, content
err, id = dao.CreateGeneralMessage(from_id, to_id, msg_type, 0, group_id, content)
case proto.MSG_TYPE_GROUP_ADD:
//加入群聊请求
//判断是否在群里
groupUser := dao.FindGroupUser(from_id, group_id)
if len(groupUser) > 0 {
return errors.New("已在群里"), 0
}
err, id = dao.CreateGeneralMessage(from_id, to_id, msg_type, 0, group_id, content)
case proto.MSG_TYPE_GROUP_INVI:
//邀请加群,直接加入