fix friend

This commit is contained in:
wangchuxiao 2023-03-16 20:30:28 +08:00
parent 3d9945393a
commit 3f65376a35

View File

@ -43,13 +43,13 @@ func (f *FriendRequestGorm) Update(ctx context.Context, friendRequests []*relati
// 获取来指定用户的好友申请 未找到 不返回错误 // 获取来指定用户的好友申请 未找到 不返回错误
func (f *FriendRequestGorm) Find(ctx context.Context, fromUserID, toUserID string) (friendRequest *relation.FriendRequestModel, err error) { func (f *FriendRequestGorm) Find(ctx context.Context, fromUserID, toUserID string) (friendRequest *relation.FriendRequestModel, err error) {
friendRequest = &relation.FriendRequestModel{} friendRequest = &relation.FriendRequestModel{}
utils.Wrap(f.db(ctx).Where("from_user_id = ? and to_user_id", fromUserID, toUserID).Find(friendRequest).Error, "") utils.Wrap(f.db(ctx).Where("from_user_id = ? and to_user_id = ?", fromUserID, toUserID).Find(friendRequest).Error, "")
return return
} }
func (f *FriendRequestGorm) Take(ctx context.Context, fromUserID, toUserID string) (friendRequest *relation.FriendRequestModel, err error) { func (f *FriendRequestGorm) Take(ctx context.Context, fromUserID, toUserID string) (friendRequest *relation.FriendRequestModel, err error) {
friendRequest = &relation.FriendRequestModel{} friendRequest = &relation.FriendRequestModel{}
utils.Wrap(f.db(ctx).Where("from_user_id = ? and to_user_id", fromUserID, toUserID).Take(friendRequest).Error, "") utils.Wrap(f.db(ctx).Where("from_user_id = ? and to_user_id = ?", fromUserID, toUserID).Take(friendRequest).Error, "")
return return
} }