From 010f24e5c3cd091259ea59fbe59a4466003bce40 Mon Sep 17 00:00:00 2001 From: wangchuxiao Date: Sun, 24 Apr 2022 17:46:47 +0800 Subject: [PATCH] work_moments --- pkg/common/db/mongoModel.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/pkg/common/db/mongoModel.go b/pkg/common/db/mongoModel.go index 14adb3057..6ff42d558 100644 --- a/pkg/common/db/mongoModel.go +++ b/pkg/common/db/mongoModel.go @@ -11,8 +11,6 @@ import ( "errors" "fmt" "github.com/gogo/protobuf/sortkeys" - "go.etcd.io/etcd/clientv3" - "go.mongodb.org/mongo-driver/bson/primitive" "go.mongodb.org/mongo-driver/mongo/options" "math/rand" @@ -682,7 +680,7 @@ func (d *DataBases) GetUserWorkMoments(opUserID, userID string, showNumber, page result, err := c.Find(ctx, bson.D{ // 等价条件: select * from {"user_id", userID}, {"$or", bson.A{ - bson.D{{"permission", constant.WorkMomentPermissionCantSee}, {opUserID, bson.D{{"$in", "permission_user_id_list"}}}}, + bson.D{{"permission", constant.WorkMomentPermissionCantSee}, {opUserID, bson.D{{"$nin", "permission_user_id_list"}}}}, bson.D{{"permission", constant.WorkMomentPermissionCanSee}, {opUserID, bson.D{{"$in", "permission_user_id_list"}}}}, bson.D{{"permission", constant.WorkMomentPublic}}, }}, @@ -702,7 +700,7 @@ func (d *DataBases) GetUserFriendWorkMoments(friendIDList []*string, showNumber, result, err := c.Find(ctx, bson.D{ // 等价条件: select * from t where user_id in friend_id_list and () or () or (); {"user_id", bson.D{{"$in", friendIDList}}}, {"$or", bson.A{ - bson.D{{"permission", constant.WorkMomentPermissionCantSee}, {userID, bson.D{{"$in", "permission_user_id_list"}}}}, + bson.D{{"permission", constant.WorkMomentPermissionCantSee}, {userID, bson.D{{"$nin", "permission_user_id_list"}}}}, bson.D{{"permission", constant.WorkMomentPermissionCanSee}, {userID, bson.D{{"$in", "permission_user_id_list"}}}}, bson.D{{"permission", constant.WorkMomentPublic}}, }},