mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-08 11:05:59 +08:00
tidy code
This commit is contained in:
@@ -20,7 +20,7 @@ func InsertToFriend(toInsertFollow *Friend) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func FindFriendRelationshipFromFriend(OwnerUserID, FriendUserID string) (*Friend, error) {
|
||||
func GetFriendRelationshipFromFriend(OwnerUserID, FriendUserID string) (*Friend, error) {
|
||||
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -33,7 +33,7 @@ func FindFriendRelationshipFromFriend(OwnerUserID, FriendUserID string) (*Friend
|
||||
return &friend, err
|
||||
}
|
||||
|
||||
func FindUserInfoFromFriend(OwnerUserID string) ([]Friend, error) {
|
||||
func GetUserInfoFromFriend(OwnerUserID string) ([]Friend, error) {
|
||||
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
@@ -45,7 +45,7 @@ func GetSendFriendApplicationListByUserID(FromUserID string) ([]FriendRequest, e
|
||||
}
|
||||
|
||||
//reqId apply to add userId already
|
||||
func FindFriendApplicationByBothUserID(FromUserId, ToUserID string) (*FriendRequest, error) {
|
||||
func GetFriendApplicationByBothUserID(FromUserId, ToUserID string) (*FriendRequest, error) {
|
||||
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -58,7 +58,7 @@ func FindFriendApplicationByBothUserID(FromUserId, ToUserID string) (*FriendRequ
|
||||
return &friendRequest, nil
|
||||
}
|
||||
|
||||
func UpdateFriendApplication(friendRequest FriendRequest) error {
|
||||
func UpdateFriendApplication(friendRequest *FriendRequest) error {
|
||||
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -21,6 +21,7 @@ func InsertIntoGroupMember(toInsertInfo GroupMember) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
toInsertInfo.JoinSource = time.Now()
|
||||
err = dbConn.Table("group_member").Create(toInsertInfo).Error
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -54,13 +55,13 @@ func GetGroupMemberListByGroupID(groupID string) ([]GroupMember, error) {
|
||||
return groupMemberList, nil
|
||||
}
|
||||
|
||||
func GetGroupMemberListByGroupIDAndFilter(groupID string, filter int32) ([]GroupMember, error) {
|
||||
func GetGroupMemberListByGroupIDAndRoleLevel(groupID string, roleLevel int32) ([]GroupMember, error) {
|
||||
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var groupMemberList []GroupMember
|
||||
err = dbConn.Table("group_member").Where("group_id=? and role_level=?", groupID, filter).Find(&groupMemberList).Error
|
||||
err = dbConn.Table("group_member").Where("group_id=? and role_level=?", groupID, role_level).Find(&groupMemberList).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package im_mysql_model
|
||||
|
||||
import (
|
||||
"Open_IM/pkg/common/db"
|
||||
"Open_IM/pkg/common/log"
|
||||
"Open_IM/pkg/proto/group"
|
||||
"errors"
|
||||
"time"
|
||||
|
||||
Reference in New Issue
Block a user