diff --git a/internal/rpc/cache/cache.go b/internal/rpc/cache/cache.go index b7e3428b6..2cf6f33d0 100644 --- a/internal/rpc/cache/cache.go +++ b/internal/rpc/cache/cache.go @@ -97,7 +97,7 @@ func SyncDB2Cache() error { err = updateAllFriendToCache(userList) err = updateAllBlackListToCache(userList) err = updateAllGroupMemberListToCache() - return err + return utils.Wrap(err, "") } func DelRelationCache() {} @@ -141,7 +141,7 @@ func updateAllGroupMemberListToCache() error { log.NewError("", utils.GetSelfFuncName(), "GetGroupMemberIDListByGroupID", err.Error()) continue } - log.NewDebug("", utils.GetSelfFuncName(), "groupMemberIDList", groupMemberIDList) + //log.NewDebug("", utils.GetSelfFuncName(), "groupMemberIDList", groupMemberIDList) if len(groupMemberIDList) > 0 { if err := db.DB.AddGroupMemberToCache(groupID, groupMemberIDList...); err != nil { log.NewError("", utils.GetSelfFuncName(), "AddGroupMemberToCache", err.Error()) @@ -160,7 +160,7 @@ func updateAllFriendToCache(userList []db.User) error { log.NewError("0", utils.GetSelfFuncName(), err.Error()) continue } - log.NewDebug("", utils.GetSelfFuncName(), "friendIDList", user.UserID, friendIDList) + //log.NewDebug("", utils.GetSelfFuncName(), "friendIDList", user.UserID, friendIDList) if len(friendIDList) > 0 { if err := db.DB.AddFriendToCache(user.UserID, friendIDList...); err != nil { log.NewError("0", utils.GetSelfFuncName(), err.Error(), friendIDList, user.UserID) @@ -179,7 +179,7 @@ func updateAllBlackListToCache(userList []db.User) error { log.NewError("", utils.GetSelfFuncName(), err.Error()) continue } - log.NewDebug("", utils.GetSelfFuncName(), "updateAllBlackListToCache", user.UserID, blackIDList) + //log.NewDebug("", utils.GetSelfFuncName(), "updateAllBlackListToCache", user.UserID, blackIDList) if len(blackIDList) > 0 { if err := db.DB.AddBlackUserToCache(user.UserID, blackIDList...); err != nil { log.NewError("0", utils.GetSelfFuncName(), err.Error()) diff --git a/internal/rpc/office/office.go b/internal/rpc/office/office.go index e08cf2794..46e8a0cba 100644 --- a/internal/rpc/office/office.go +++ b/internal/rpc/office/office.go @@ -300,6 +300,18 @@ func (s *officeServer) CreateOneWorkMoment(_ context.Context, req *pbOffice.Crea workMoment.UserName = createUser.Nickname workMoment.FaceURL = createUser.FaceURL workMoment.PermissionUserIDList = s.getPermissionUserIDList(req.OperationID, req.WorkMoment.PermissionGroupList, req.WorkMoment.PermissionUserList) + workMoment.PermissionUserList = []*db.WorkMomentUser{} + for _, userID := range workMoment.PermissionUserIDList { + userName, err := imdb.GetUserNameByUserID(userID) + if err != nil { + log.NewError(req.OperationID, utils.GetSelfFuncName(), "GetUserNameByUserID failed", err.Error()) + continue + } + workMoment.PermissionUserList = append(workMoment.PermissionUserList, &db.WorkMomentUser{ + UserID: userID, + UserName: userName, + }) + } log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "workMoment to create", workMoment) err = db.DB.CreateOneWorkMoment(&workMoment) if err != nil {