diff --git a/pkg/common/config/config.go b/pkg/common/config/config.go index ca56d77b5..114b36b2d 100644 --- a/pkg/common/config/config.go +++ b/pkg/common/config/config.go @@ -2,13 +2,15 @@ package config import ( "fmt" - "github.com/OpenIMSDK/Open-IM-Server/pkg/discoveryregistry" "io/ioutil" "os" "path/filepath" "runtime" + "github.com/OpenIMSDK/Open-IM-Server/pkg/discoveryregistry" + _ "embed" + "gopkg.in/yaml.v3" ) @@ -189,6 +191,7 @@ type config struct { ElasticSearchAddr []string `yaml:"elasticSearchAddr"` ElasticSearchUser string `yaml:"elasticSearchUser"` ElasticSearchPassword string `yaml:"elasticSearchPassword"` + isJson bool `yaml:"isJson"` } ModuleName struct { LongConnSvrName string `yaml:"longConnSvrName"` diff --git a/pkg/common/db/relation/friend_request_model.go b/pkg/common/db/relation/friend_request_model.go index 658a0c5ed..5efb0bddd 100644 --- a/pkg/common/db/relation/friend_request_model.go +++ b/pkg/common/db/relation/friend_request_model.go @@ -43,14 +43,14 @@ func (f *FriendRequestGorm) Update(ctx context.Context, friendRequests []*relati // 获取来指定用户的好友申请 未找到 不返回错误 func (f *FriendRequestGorm) Find(ctx context.Context, fromUserID, toUserID string) (friendRequest *relation.FriendRequestModel, err error) { friendRequest = &relation.FriendRequestModel{} - utils.Wrap(f.db(ctx).Where("from_user_id = ? and to_user_id = ?", fromUserID, toUserID).Find(friendRequest).Error, "") - return + err = utils.Wrap(f.db(ctx).Where("from_user_id = ? and to_user_id = ?", fromUserID, toUserID).Find(friendRequest).Error, "") + return friendRequest, err } func (f *FriendRequestGorm) Take(ctx context.Context, fromUserID, toUserID string) (friendRequest *relation.FriendRequestModel, err error) { friendRequest = &relation.FriendRequestModel{} - utils.Wrap(f.db(ctx).Where("from_user_id = ? and to_user_id = ?", fromUserID, toUserID).Take(friendRequest).Error, "") - return + err = utils.Wrap(f.db(ctx).Where("from_user_id = ? and to_user_id = ?", fromUserID, toUserID).Take(friendRequest).Error, "") + return friendRequest, err } // 获取toUserID收到的好友申请列表