mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-06 10:05:58 +08:00
log
This commit is contained in:
@@ -22,7 +22,7 @@ type Friend struct {
|
||||
|
||||
func (*Friend) Create(ctx context.Context, friends []*Friend) (err error) {
|
||||
defer func() {
|
||||
trace_log.SetContextInfo(ctx, utils.GetSelfFuncName(), err, "friends", friends)
|
||||
trace_log.SetCtxDebug(ctx, utils.GetSelfFuncName(), err, "friends", friends)
|
||||
}()
|
||||
err = utils.Wrap(FriendDB.Create(&friends).Error, "")
|
||||
return err
|
||||
@@ -30,7 +30,7 @@ func (*Friend) Create(ctx context.Context, friends []*Friend) (err error) {
|
||||
|
||||
func (*Friend) Delete(ctx context.Context, ownerUserID string, friendUserIDs []string) (err error) {
|
||||
defer func() {
|
||||
trace_log.SetContextInfo(ctx, utils.GetSelfFuncName(), err, "ownerUserID", ownerUserID, "friendUserIDs", friendUserIDs)
|
||||
trace_log.SetCtxDebug(ctx, utils.GetSelfFuncName(), err, "ownerUserID", ownerUserID, "friendUserIDs", friendUserIDs)
|
||||
}()
|
||||
err = utils.Wrap(FriendDB.Where("owner_user_id = ? and friend_user_id in (?)", ownerUserID, friendUserIDs).Delete(&Friend{}).Error, "")
|
||||
return err
|
||||
@@ -38,21 +38,21 @@ func (*Friend) Delete(ctx context.Context, ownerUserID string, friendUserIDs []s
|
||||
|
||||
func (*Friend) UpdateByMap(ctx context.Context, ownerUserID string, args map[string]interface{}) (err error) {
|
||||
defer func() {
|
||||
trace_log.SetContextInfo(ctx, utils.GetSelfFuncName(), err, "ownerUserID", ownerUserID, "args", args)
|
||||
trace_log.SetCtxDebug(ctx, utils.GetSelfFuncName(), err, "ownerUserID", ownerUserID, "args", args)
|
||||
}()
|
||||
return utils.Wrap(FriendDB.Where("owner_user_id = ?", ownerUserID).Updates(args).Error, "")
|
||||
}
|
||||
|
||||
func (*Friend) Update(ctx context.Context, friends []*Friend) (err error) {
|
||||
defer func() {
|
||||
trace_log.SetContextInfo(ctx, utils.GetSelfFuncName(), err, "friends", friends)
|
||||
trace_log.SetCtxDebug(ctx, utils.GetSelfFuncName(), err, "friends", friends)
|
||||
}()
|
||||
return utils.Wrap(FriendDB.Updates(&friends).Error, "")
|
||||
}
|
||||
|
||||
func (*Friend) Find(ctx context.Context, ownerUserID string) (friends []*Friend, err error) {
|
||||
defer func() {
|
||||
trace_log.SetContextInfo(ctx, utils.GetSelfFuncName(), err, "ownerUserID", ownerUserID, "friends", friends)
|
||||
trace_log.SetCtxDebug(ctx, utils.GetSelfFuncName(), err, "ownerUserID", ownerUserID, "friends", friends)
|
||||
}()
|
||||
err = utils.Wrap(FriendDB.Where("owner_user_id = ?", ownerUserID).Find(&friends).Error, "")
|
||||
return friends, err
|
||||
@@ -60,7 +60,7 @@ func (*Friend) Find(ctx context.Context, ownerUserID string) (friends []*Friend,
|
||||
|
||||
func (*Friend) Take(ctx context.Context, ownerUserID, friendUserID string) (group *Group, err error) {
|
||||
group = &Group{}
|
||||
defer trace_log.SetContextInfo(ctx, utils.GetSelfFuncName(), err, "ownerUserID", ownerUserID, "friendUserID", friendUserID, "group", *group)
|
||||
defer trace_log.SetCtxDebug(ctx, utils.GetSelfFuncName(), err, "ownerUserID", ownerUserID, "friendUserID", friendUserID, "group", *group)
|
||||
err = utils.Wrap(FriendDB.Where("owner_user_id = ? and friend_user_id", ownerUserID, friendUserID).Take(group).Error, "")
|
||||
return group, err
|
||||
}
|
||||
|
||||
@@ -29,33 +29,33 @@ type GroupMember struct {
|
||||
|
||||
func (g *GroupMember) Create(ctx context.Context, groupMemberList []*GroupMember) (err error) {
|
||||
defer func() {
|
||||
trace_log.SetContextInfo(ctx, utils.GetFuncName(1), err, "groupMemberList", groupMemberList)
|
||||
trace_log.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupMemberList", groupMemberList)
|
||||
}()
|
||||
return utils.Wrap(GroupMemberDB.Create(&groupMemberList).Error, "")
|
||||
}
|
||||
|
||||
func (g *GroupMember) Delete(ctx context.Context, groupMembers []*GroupMember) (err error) {
|
||||
defer func() {
|
||||
trace_log.SetContextInfo(ctx, utils.GetFuncName(1), err, "groupMembers", groupMembers)
|
||||
trace_log.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupMembers", groupMembers)
|
||||
}()
|
||||
return utils.Wrap(GroupMemberDB.Delete(groupMembers).Error, "")
|
||||
}
|
||||
|
||||
func (g *GroupMember) UpdateByMap(ctx context.Context, groupID string, userID string, args map[string]interface{}) (err error) {
|
||||
defer func() {
|
||||
trace_log.SetContextInfo(ctx, utils.GetFuncName(1), err, "groupID", groupID, "userID", userID, "args", args)
|
||||
trace_log.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupID", groupID, "userID", userID, "args", args)
|
||||
}()
|
||||
return utils.Wrap(GroupMemberDB.Model(&GroupMember{}).Where("group_id = ? and user_id = ?", groupID, userID).Updates(args).Error, "")
|
||||
}
|
||||
|
||||
func (g *GroupMember) Update(ctx context.Context, groupMembers []*GroupMember) (err error) {
|
||||
defer func() { trace_log.SetContextInfo(ctx, utils.GetFuncName(1), err, "groupMembers", groupMembers) }()
|
||||
defer func() { trace_log.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupMembers", groupMembers) }()
|
||||
return utils.Wrap(GroupMemberDB.Updates(&groupMembers).Error, "")
|
||||
}
|
||||
|
||||
func (g *GroupMember) Find(ctx context.Context, groupMembers []*GroupMember) (groupList []*GroupMember, err error) {
|
||||
defer func() {
|
||||
trace_log.SetContextInfo(ctx, utils.GetFuncName(1), err, "groupMembers", groupMembers, "groupList", groupList)
|
||||
trace_log.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupMembers", groupMembers, "groupList", groupList)
|
||||
}()
|
||||
var where [][]interface{}
|
||||
for _, groupMember := range groupMembers {
|
||||
@@ -67,7 +67,7 @@ func (g *GroupMember) Find(ctx context.Context, groupMembers []*GroupMember) (gr
|
||||
|
||||
func (g *GroupMember) Take(ctx context.Context, groupID string, userID string) (groupMember *GroupMember, err error) {
|
||||
defer func() {
|
||||
trace_log.SetContextInfo(ctx, utils.GetFuncName(1), err, "groupID", groupID, "userID", userID, "groupMember", *groupMember)
|
||||
trace_log.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupID", groupID, "userID", userID, "groupMember", *groupMember)
|
||||
}()
|
||||
groupMember = &GroupMember{}
|
||||
return groupMember, utils.Wrap(GroupMemberDB.Where("group_id = ? and user_id = ?", groupID, userID).Take(groupMember).Error, "")
|
||||
@@ -75,7 +75,7 @@ func (g *GroupMember) Take(ctx context.Context, groupID string, userID string) (
|
||||
|
||||
func (g *GroupMember) TakeOwnerInfo(ctx context.Context, groupID string) (groupMember *GroupMember, err error) {
|
||||
defer func() {
|
||||
trace_log.SetContextInfo(ctx, utils.GetFuncName(1), err, "groupID", groupID, "groupMember", *groupMember)
|
||||
trace_log.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupID", groupID, "groupMember", *groupMember)
|
||||
}()
|
||||
groupMember = &GroupMember{}
|
||||
err = GroupMemberDB.Where("group_id = ? and role_level = ?", groupID, constant.GroupOwner).Take(groupMember).Error
|
||||
|
||||
@@ -30,7 +30,7 @@ type Group struct {
|
||||
|
||||
func (*Group) Create(ctx context.Context, groups []*Group) (err error) {
|
||||
defer func() {
|
||||
trace_log.SetContextInfo(ctx, utils.GetFuncName(1), err, "groups", groups)
|
||||
trace_log.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groups", groups)
|
||||
}()
|
||||
err = utils.Wrap(GroupDB.Create(&groups).Error, "")
|
||||
return err
|
||||
@@ -38,28 +38,28 @@ func (*Group) Create(ctx context.Context, groups []*Group) (err error) {
|
||||
|
||||
func (*Group) Delete(ctx context.Context, groupIDs []string) (err error) {
|
||||
defer func() {
|
||||
trace_log.SetContextInfo(ctx, utils.GetFuncName(1), err, "groupIDs", groupIDs)
|
||||
trace_log.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupIDs", groupIDs)
|
||||
}()
|
||||
return utils.Wrap(GroupDB.Where("group_id in (?)", groupIDs).Delete(&Group{}).Error, "")
|
||||
}
|
||||
|
||||
func (*Group) UpdateByMap(ctx context.Context, groupID string, args map[string]interface{}) (err error) {
|
||||
defer func() {
|
||||
trace_log.SetContextInfo(ctx, utils.GetFuncName(1), err, "groupID", groupID, "args", args)
|
||||
trace_log.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupID", groupID, "args", args)
|
||||
}()
|
||||
return utils.Wrap(GroupDB.Where("group_id = ?", groupID).Updates(args).Error, "")
|
||||
}
|
||||
|
||||
func (*Group) Update(ctx context.Context, groups []*Group) (err error) {
|
||||
defer func() {
|
||||
trace_log.SetContextInfo(ctx, utils.GetFuncName(1), err, "groups", groups)
|
||||
trace_log.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groups", groups)
|
||||
}()
|
||||
return utils.Wrap(GroupDB.Updates(&groups).Error, "")
|
||||
}
|
||||
|
||||
func (*Group) Find(ctx context.Context, groupIDs []string) (groupList []*Group, err error) {
|
||||
defer func() {
|
||||
trace_log.SetContextInfo(ctx, utils.GetFuncName(1), err, "groupIDList", groupIDs, "groupList", groupList)
|
||||
trace_log.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupIDList", groupIDs, "groupList", groupList)
|
||||
}()
|
||||
err = utils.Wrap(GroupDB.Where("group_id in (?)", groupIDs).Find(&groupList).Error, "")
|
||||
return groupList, err
|
||||
@@ -68,7 +68,7 @@ func (*Group) Find(ctx context.Context, groupIDs []string) (groupList []*Group,
|
||||
func (*Group) Take(ctx context.Context, groupID string) (group *Group, err error) {
|
||||
group = &Group{}
|
||||
defer func() {
|
||||
trace_log.SetContextInfo(ctx, utils.GetFuncName(1), err, "groupID", groupID, "group", *group)
|
||||
trace_log.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupID", groupID, "group", *group)
|
||||
}()
|
||||
err = utils.Wrap(GroupDB.Where("group_id = ?", groupID).Take(group).Error, "")
|
||||
return group, err
|
||||
|
||||
@@ -27,35 +27,35 @@ type GroupRequest struct {
|
||||
|
||||
func (*GroupRequest) Create(ctx context.Context, groupRequests []*GroupRequest) (err error) {
|
||||
defer func() {
|
||||
trace_log.SetContextInfo(ctx, utils.GetSelfFuncName(), err, "groupRequests", groupRequests)
|
||||
trace_log.SetCtxDebug(ctx, utils.GetSelfFuncName(), err, "groupRequests", groupRequests)
|
||||
}()
|
||||
return utils.Wrap(GroupRequestDB.Create(&groupRequests).Error, utils.GetSelfFuncName())
|
||||
}
|
||||
|
||||
func (*GroupRequest) Delete(ctx context.Context, groupRequests []*GroupRequest) (err error) {
|
||||
defer func() {
|
||||
trace_log.SetContextInfo(ctx, utils.GetSelfFuncName(), err, "groupRequests", groupRequests)
|
||||
trace_log.SetCtxDebug(ctx, utils.GetSelfFuncName(), err, "groupRequests", groupRequests)
|
||||
}()
|
||||
return utils.Wrap(GroupRequestDB.Delete(&groupRequests).Error, utils.GetSelfFuncName())
|
||||
}
|
||||
|
||||
func (*GroupRequest) UpdateByMap(ctx context.Context, groupID string, userID string, args map[string]interface{}) (err error) {
|
||||
defer func() {
|
||||
trace_log.SetContextInfo(ctx, utils.GetSelfFuncName(), err, "groupID", groupID, "userID", userID, "args", args)
|
||||
trace_log.SetCtxDebug(ctx, utils.GetSelfFuncName(), err, "groupID", groupID, "userID", userID, "args", args)
|
||||
}()
|
||||
return utils.Wrap(GroupRequestDB.Where("group_id = ? and user_id = ? ", groupID, userID).Updates(args).Error, utils.GetSelfFuncName())
|
||||
}
|
||||
|
||||
func (*GroupRequest) Update(ctx context.Context, groupRequests []*GroupRequest) (err error) {
|
||||
defer func() {
|
||||
trace_log.SetContextInfo(ctx, utils.GetSelfFuncName(), err, "groupRequests", groupRequests)
|
||||
trace_log.SetCtxDebug(ctx, utils.GetSelfFuncName(), err, "groupRequests", groupRequests)
|
||||
}()
|
||||
return utils.Wrap(GroupRequestDB.Updates(&groupRequests).Error, utils.GetSelfFuncName())
|
||||
}
|
||||
|
||||
func (*GroupRequest) Find(ctx context.Context, groupRequests []*GroupRequest) (resultGroupRequests []*GroupRequest, err error) {
|
||||
defer func() {
|
||||
trace_log.SetContextInfo(ctx, utils.GetSelfFuncName(), err, "groupRequests", groupRequests, "resultGroupRequests", resultGroupRequests)
|
||||
trace_log.SetCtxDebug(ctx, utils.GetSelfFuncName(), err, "groupRequests", groupRequests, "resultGroupRequests", resultGroupRequests)
|
||||
}()
|
||||
var where [][]interface{}
|
||||
for _, groupMember := range groupRequests {
|
||||
@@ -67,7 +67,7 @@ func (*GroupRequest) Find(ctx context.Context, groupRequests []*GroupRequest) (r
|
||||
func (*GroupRequest) Take(ctx context.Context, groupID string, userID string) (groupRequest *GroupRequest, err error) {
|
||||
groupRequest = &GroupRequest{}
|
||||
defer func() {
|
||||
trace_log.SetContextInfo(ctx, utils.GetSelfFuncName(), err, "groupID", groupID, "userID", userID, "groupRequest", *groupRequest)
|
||||
trace_log.SetCtxDebug(ctx, utils.GetSelfFuncName(), err, "groupID", groupID, "userID", userID, "groupRequest", *groupRequest)
|
||||
}()
|
||||
return groupRequest, utils.Wrap(GroupRequestDB.Where("group_id = ? and user_id = ? ", groupID, userID).Take(groupRequest).Error, utils.GetSelfFuncName())
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ type Black struct {
|
||||
}
|
||||
|
||||
func InsertInToUserBlackList(ctx context.Context, black Black) (err error) {
|
||||
defer trace_log.SetContextInfo(ctx, utils.GetSelfFuncName(), err, "black", black)
|
||||
defer trace_log.SetCtxDebug(ctx, utils.GetSelfFuncName(), err, "black", black)
|
||||
black.CreateTime = time.Now()
|
||||
err = BlackDB.Create(black).Error
|
||||
return err
|
||||
|
||||
@@ -83,7 +83,7 @@ func GetFriendIDListFromCache(ctx context.Context, userID string) (friendIDList
|
||||
return string(bytes), nil
|
||||
}
|
||||
defer func() {
|
||||
trace_log.SetContextInfo(ctx, utils.GetFuncName(1), err, "userID", userID, "friendIDList", friendIDList)
|
||||
trace_log.SetCtxDebug(ctx, utils.GetFuncName(1), err, "userID", userID, "friendIDList", friendIDList)
|
||||
}()
|
||||
friendIDListStr, err := db.DB.Rc.Fetch(friendRelationCache+userID, time.Second*30*60, getFriendIDList)
|
||||
if err != nil {
|
||||
@@ -95,7 +95,7 @@ func GetFriendIDListFromCache(ctx context.Context, userID string) (friendIDList
|
||||
|
||||
func DelFriendIDListFromCache(ctx context.Context, userID string) (err error) {
|
||||
defer func() {
|
||||
trace_log.SetContextInfo(ctx, utils.GetFuncName(1), err, "userID", userID)
|
||||
trace_log.SetCtxDebug(ctx, utils.GetFuncName(1), err, "userID", userID)
|
||||
}()
|
||||
return db.DB.Rc.TagAsDeleted(friendRelationCache + userID)
|
||||
}
|
||||
@@ -113,7 +113,7 @@ func GetBlackListFromCache(ctx context.Context, userID string) (blackIDList []st
|
||||
return string(bytes), nil
|
||||
}
|
||||
defer func() {
|
||||
trace_log.SetContextInfo(ctx, utils.GetFuncName(1), err, "userID", userID, "blackIDList", blackIDList)
|
||||
trace_log.SetCtxDebug(ctx, utils.GetFuncName(1), err, "userID", userID, "blackIDList", blackIDList)
|
||||
}()
|
||||
blackIDListStr, err := db.DB.Rc.Fetch(blackListCache+userID, time.Second*30*60, getBlackIDList)
|
||||
if err != nil {
|
||||
@@ -125,7 +125,7 @@ func GetBlackListFromCache(ctx context.Context, userID string) (blackIDList []st
|
||||
|
||||
func DelBlackIDListFromCache(ctx context.Context, userID string) (err error) {
|
||||
defer func() {
|
||||
trace_log.SetContextInfo(ctx, utils.GetFuncName(1), err, "ctx", ctx)
|
||||
trace_log.SetCtxDebug(ctx, utils.GetFuncName(1), err, "ctx", ctx)
|
||||
}()
|
||||
return db.DB.Rc.TagAsDeleted(blackListCache + userID)
|
||||
}
|
||||
@@ -143,7 +143,7 @@ func GetJoinedGroupIDListFromCache(ctx context.Context, userID string) (joinedGr
|
||||
return string(bytes), nil
|
||||
}
|
||||
defer func() {
|
||||
trace_log.SetContextInfo(ctx, utils.GetFuncName(1), err, "userID", userID, "joinedGroupList", joinedGroupList)
|
||||
trace_log.SetCtxDebug(ctx, utils.GetFuncName(1), err, "userID", userID, "joinedGroupList", joinedGroupList)
|
||||
}()
|
||||
joinedGroupIDListStr, err := db.DB.Rc.Fetch(joinedGroupListCache+userID, time.Second*30*60, getJoinedGroupIDList)
|
||||
if err != nil {
|
||||
@@ -155,7 +155,7 @@ func GetJoinedGroupIDListFromCache(ctx context.Context, userID string) (joinedGr
|
||||
|
||||
func DelJoinedGroupIDListFromCache(ctx context.Context, userID string) (err error) {
|
||||
defer func() {
|
||||
trace_log.SetContextInfo(ctx, utils.GetFuncName(1), err, "userID", userID)
|
||||
trace_log.SetCtxDebug(ctx, utils.GetFuncName(1), err, "userID", userID)
|
||||
}()
|
||||
return db.DB.Rc.TagAsDeleted(joinedGroupListCache + userID)
|
||||
}
|
||||
@@ -186,7 +186,7 @@ func GetGroupMemberIDListFromCache(ctx context.Context, groupID string) (groupMe
|
||||
return string(bytes), nil
|
||||
}
|
||||
defer func() {
|
||||
trace_log.SetContextInfo(ctx, utils.GetFuncName(1), err, "groupID", groupID, "groupMemberIDList", groupMemberIDList)
|
||||
trace_log.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupID", groupID, "groupMemberIDList", groupMemberIDList)
|
||||
}()
|
||||
groupIDListStr, err := db.DB.Rc.Fetch(groupCache+groupID, time.Second*30*60, f)
|
||||
if err != nil {
|
||||
@@ -198,7 +198,7 @@ func GetGroupMemberIDListFromCache(ctx context.Context, groupID string) (groupMe
|
||||
|
||||
func DelGroupMemberIDListFromCache(ctx context.Context, groupID string) (err error) {
|
||||
defer func() {
|
||||
trace_log.SetContextInfo(ctx, utils.GetFuncName(1), err, "groupID", groupID)
|
||||
trace_log.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupID", groupID)
|
||||
}()
|
||||
return db.DB.Rc.TagAsDeleted(groupCache + groupID)
|
||||
}
|
||||
@@ -216,7 +216,7 @@ func GetUserInfoFromCache(ctx context.Context, userID string) (userInfo *imdb.Us
|
||||
return string(bytes), nil
|
||||
}
|
||||
defer func() {
|
||||
trace_log.SetContextInfo(ctx, utils.GetFuncName(1), err, "userID", userID, "userInfo", *userInfo)
|
||||
trace_log.SetCtxDebug(ctx, utils.GetFuncName(1), err, "userID", userID, "userInfo", *userInfo)
|
||||
}()
|
||||
userInfoStr, err := db.DB.Rc.Fetch(userInfoCache+userID, time.Second*30*60, getUserInfo)
|
||||
if err != nil {
|
||||
@@ -241,7 +241,7 @@ func GetUserInfoFromCacheBatch(ctx context.Context, userIDs []string) ([]*imdb.U
|
||||
|
||||
func DelUserInfoFromCache(ctx context.Context, userID string) (err error) {
|
||||
defer func() {
|
||||
trace_log.SetContextInfo(ctx, utils.GetFuncName(1), err, "userID", userID)
|
||||
trace_log.SetCtxDebug(ctx, utils.GetFuncName(1), err, "userID", userID)
|
||||
}()
|
||||
return db.DB.Rc.TagAsDeleted(userInfoCache + userID)
|
||||
}
|
||||
@@ -259,7 +259,7 @@ func GetGroupMemberInfoFromCache(ctx context.Context, groupID, userID string) (g
|
||||
return string(bytes), nil
|
||||
}
|
||||
defer func() {
|
||||
trace_log.SetContextInfo(ctx, utils.GetFuncName(1), err, "groupID", groupID, "userID", userID, "groupMember", *groupMember)
|
||||
trace_log.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupID", groupID, "userID", userID, "groupMember", *groupMember)
|
||||
}()
|
||||
groupMemberInfoStr, err := db.DB.Rc.Fetch(groupMemberInfoCache+groupID+"-"+userID, time.Second*30*60, getGroupMemberInfo)
|
||||
if err != nil {
|
||||
@@ -272,14 +272,14 @@ func GetGroupMemberInfoFromCache(ctx context.Context, groupID, userID string) (g
|
||||
|
||||
func DelGroupMemberInfoFromCache(ctx context.Context, groupID, userID string) (err error) {
|
||||
defer func() {
|
||||
trace_log.SetContextInfo(ctx, utils.GetFuncName(1), err, "groupID", groupID, "userID", userID)
|
||||
trace_log.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupID", groupID, "userID", userID)
|
||||
}()
|
||||
return db.DB.Rc.TagAsDeleted(groupMemberInfoCache + groupID + "-" + userID)
|
||||
}
|
||||
|
||||
func GetGroupMembersInfoFromCache(ctx context.Context, count, offset int32, groupID string) (groupMembers []*imdb.GroupMember, err error) {
|
||||
defer func() {
|
||||
trace_log.SetContextInfo(ctx, utils.GetFuncName(1), err, "count", count, "offset", offset, "groupID", groupID, "groupMember", groupMembers)
|
||||
trace_log.SetCtxDebug(ctx, utils.GetFuncName(1), err, "count", count, "offset", offset, "groupID", groupID, "groupMember", groupMembers)
|
||||
}()
|
||||
groupMemberIDList, err := GetGroupMemberIDListFromCache(ctx, groupID)
|
||||
if err != nil {
|
||||
@@ -326,7 +326,7 @@ func GetGroupMembersInfoFromCache(ctx context.Context, count, offset int32, grou
|
||||
|
||||
func GetAllGroupMembersInfoFromCache(ctx context.Context, groupID string) (groupMembers []*imdb.GroupMember, err error) {
|
||||
defer func() {
|
||||
trace_log.SetContextInfo(ctx, utils.GetFuncName(1), err, "groupID", groupID, "groupMembers", groupMembers)
|
||||
trace_log.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupID", groupID, "groupMembers", groupMembers)
|
||||
}()
|
||||
getGroupMemberInfo := func() (string, error) {
|
||||
groupMembers, err := imdb.GetGroupMemberListByGroupID(groupID)
|
||||
@@ -349,7 +349,7 @@ func GetAllGroupMembersInfoFromCache(ctx context.Context, groupID string) (group
|
||||
|
||||
func DelAllGroupMembersInfoFromCache(ctx context.Context, groupID string) (err error) {
|
||||
defer func() {
|
||||
trace_log.SetContextInfo(ctx, utils.GetFuncName(1), err, "groupID", groupID)
|
||||
trace_log.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupID", groupID)
|
||||
}()
|
||||
return db.DB.Rc.TagAsDeleted(groupAllMemberInfoCache + groupID)
|
||||
}
|
||||
@@ -368,7 +368,7 @@ func GetGroupInfoFromCache(ctx context.Context, groupID string) (groupInfo *imdb
|
||||
}
|
||||
groupInfo = &imdb.Group{}
|
||||
defer func() {
|
||||
trace_log.SetContextInfo(ctx, utils.GetFuncName(1), err, "groupID", groupID, "groupInfo", groupInfo)
|
||||
trace_log.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupID", groupID, "groupInfo", groupInfo)
|
||||
}()
|
||||
groupInfoStr, err := db.DB.Rc.Fetch(groupInfoCache+groupID, time.Second*30*60, getGroupInfo)
|
||||
if err != nil {
|
||||
@@ -380,7 +380,7 @@ func GetGroupInfoFromCache(ctx context.Context, groupID string) (groupInfo *imdb
|
||||
|
||||
func DelGroupInfoFromCache(ctx context.Context, groupID string) (err error) {
|
||||
defer func() {
|
||||
trace_log.SetContextInfo(ctx, utils.GetFuncName(1), err, "groupID", groupID)
|
||||
trace_log.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupID", groupID)
|
||||
}()
|
||||
return db.DB.Rc.TagAsDeleted(groupInfoCache + groupID)
|
||||
}
|
||||
@@ -398,7 +398,7 @@ func GetAllFriendsInfoFromCache(ctx context.Context, userID string) (friends []*
|
||||
return string(bytes), nil
|
||||
}
|
||||
defer func() {
|
||||
trace_log.SetContextInfo(ctx, utils.GetFuncName(1), err, "userID", userID, "friends", friends)
|
||||
trace_log.SetCtxDebug(ctx, utils.GetFuncName(1), err, "userID", userID, "friends", friends)
|
||||
}()
|
||||
allFriendInfoStr, err := db.DB.Rc.Fetch(allFriendInfoCache+userID, time.Second*30*60, getAllFriendInfo)
|
||||
if err != nil {
|
||||
@@ -410,7 +410,7 @@ func GetAllFriendsInfoFromCache(ctx context.Context, userID string) (friends []*
|
||||
|
||||
func DelAllFriendsInfoFromCache(ctx context.Context, userID string) (err error) {
|
||||
defer func() {
|
||||
trace_log.SetContextInfo(ctx, utils.GetFuncName(1), err, "userID", userID)
|
||||
trace_log.SetCtxDebug(ctx, utils.GetFuncName(1), err, "userID", userID)
|
||||
}()
|
||||
return db.DB.Rc.TagAsDeleted(allFriendInfoCache + userID)
|
||||
}
|
||||
@@ -478,7 +478,7 @@ func GetJoinedSuperGroupListFromCache(ctx context.Context, userID string) (joine
|
||||
return string(bytes), nil
|
||||
}
|
||||
defer func() {
|
||||
trace_log.SetContextInfo(ctx, utils.GetFuncName(1), err, "userID", userID, "joinedSuperGroupIDs", joinedSuperGroupIDs)
|
||||
trace_log.SetCtxDebug(ctx, utils.GetFuncName(1), err, "userID", userID, "joinedSuperGroupIDs", joinedSuperGroupIDs)
|
||||
}()
|
||||
joinedSuperGroupListStr, err := db.DB.Rc.Fetch(joinedSuperGroupListCache+userID, time.Second*30*60, getJoinedSuperGroupIDList)
|
||||
if err != nil {
|
||||
@@ -490,7 +490,7 @@ func GetJoinedSuperGroupListFromCache(ctx context.Context, userID string) (joine
|
||||
|
||||
func DelJoinedSuperGroupIDListFromCache(ctx context.Context, userID string) (err error) {
|
||||
defer func() {
|
||||
trace_log.SetContextInfo(ctx, utils.GetFuncName(1), err, "userID", userID)
|
||||
trace_log.SetCtxDebug(ctx, utils.GetFuncName(1), err, "userID", userID)
|
||||
}()
|
||||
return db.DB.Rc.TagAsDeleted(joinedSuperGroupListCache + userID)
|
||||
}
|
||||
@@ -518,7 +518,7 @@ func GetGroupMemberListHashFromCache(ctx context.Context, groupID string) (hashC
|
||||
return strconv.Itoa(int(bi.Uint64())), nil
|
||||
}
|
||||
defer func() {
|
||||
trace_log.SetContextInfo(ctx, utils.GetFuncName(1), err, "groupID", groupID, "hashCodeUint64", hashCodeUint64)
|
||||
trace_log.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupID", groupID, "hashCodeUint64", hashCodeUint64)
|
||||
}()
|
||||
hashCodeStr, err := db.DB.Rc.Fetch(groupMemberListHashCache+groupID, time.Second*30*60, generateHash)
|
||||
if err != nil {
|
||||
@@ -530,7 +530,7 @@ func GetGroupMemberListHashFromCache(ctx context.Context, groupID string) (hashC
|
||||
|
||||
func DelGroupMemberListHashFromCache(ctx context.Context, groupID string) (err error) {
|
||||
defer func() {
|
||||
trace_log.SetContextInfo(ctx, utils.GetFuncName(1), err, "groupID", groupID)
|
||||
trace_log.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupID", groupID)
|
||||
}()
|
||||
return db.DB.Rc.TagAsDeleted(groupMemberListHashCache + groupID)
|
||||
}
|
||||
@@ -544,7 +544,7 @@ func GetGroupMemberNumFromCache(ctx context.Context, groupID string) (num int, e
|
||||
return strconv.Itoa(int(num)), nil
|
||||
}
|
||||
defer func() {
|
||||
trace_log.SetContextInfo(ctx, utils.GetFuncName(1), err, "groupID", groupID, "num", num)
|
||||
trace_log.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupID", groupID, "num", num)
|
||||
}()
|
||||
groupMember, err := db.DB.Rc.Fetch(groupMemberNumCache+groupID, time.Second*30*60, getGroupMemberNum)
|
||||
if err != nil {
|
||||
@@ -555,7 +555,7 @@ func GetGroupMemberNumFromCache(ctx context.Context, groupID string) (num int, e
|
||||
|
||||
func DelGroupMemberNumFromCache(ctx context.Context, groupID string) (err error) {
|
||||
defer func() {
|
||||
trace_log.SetContextInfo(ctx, utils.GetFuncName(1), err, "groupID", groupID)
|
||||
trace_log.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupID", groupID)
|
||||
}()
|
||||
return db.DB.Rc.TagAsDeleted(groupMemberNumCache + groupID)
|
||||
}
|
||||
@@ -574,7 +574,7 @@ func GetUserConversationIDListFromCache(ctx context.Context, userID string) (con
|
||||
return string(bytes), nil
|
||||
}
|
||||
defer func() {
|
||||
trace_log.SetContextInfo(ctx, utils.GetFuncName(1), err, "userID", userID, "conversationIDs", conversationIDs)
|
||||
trace_log.SetCtxDebug(ctx, utils.GetFuncName(1), err, "userID", userID, "conversationIDs", conversationIDs)
|
||||
}()
|
||||
conversationIDListStr, err := db.DB.Rc.Fetch(conversationIDListCache+userID, time.Second*30*60, getConversationIDList)
|
||||
err = json.Unmarshal([]byte(conversationIDListStr), &conversationIDs)
|
||||
@@ -586,7 +586,7 @@ func GetUserConversationIDListFromCache(ctx context.Context, userID string) (con
|
||||
|
||||
func DelUserConversationIDListFromCache(ctx context.Context, userID string) (err error) {
|
||||
defer func() {
|
||||
trace_log.SetContextInfo(ctx, utils.GetFuncName(1), err, "userID", userID)
|
||||
trace_log.SetCtxDebug(ctx, utils.GetFuncName(1), err, "userID", userID)
|
||||
}()
|
||||
return utils.Wrap(db.DB.Rc.TagAsDeleted(conversationIDListCache+userID), "DelUserConversationIDListFromCache err")
|
||||
}
|
||||
@@ -604,7 +604,7 @@ func GetConversationFromCache(ctx context.Context, ownerUserID, conversationID s
|
||||
return string(bytes), nil
|
||||
}
|
||||
defer func() {
|
||||
trace_log.SetContextInfo(ctx, utils.GetFuncName(1), err, "ownerUserID", ownerUserID, "conversationID", conversationID, "conversation", *conversation)
|
||||
trace_log.SetCtxDebug(ctx, utils.GetFuncName(1), err, "ownerUserID", ownerUserID, "conversationID", conversationID, "conversation", *conversation)
|
||||
}()
|
||||
conversationStr, err := db.DB.Rc.Fetch(conversationCache+ownerUserID+":"+conversationID, time.Second*30*60, getConversation)
|
||||
if err != nil {
|
||||
@@ -617,7 +617,7 @@ func GetConversationFromCache(ctx context.Context, ownerUserID, conversationID s
|
||||
|
||||
func GetConversationsFromCache(ctx context.Context, ownerUserID string, conversationIDs []string) (conversations []imdb.Conversation, err error) {
|
||||
defer func() {
|
||||
trace_log.SetContextInfo(ctx, utils.GetFuncName(1), err, "ownerUserID", ownerUserID, "conversationIDs", conversationIDs, "conversations", conversations)
|
||||
trace_log.SetCtxDebug(ctx, utils.GetFuncName(1), err, "ownerUserID", ownerUserID, "conversationIDs", conversationIDs, "conversations", conversations)
|
||||
}()
|
||||
for _, conversationID := range conversationIDs {
|
||||
conversation, err := GetConversationFromCache(ctx, ownerUserID, conversationID)
|
||||
@@ -631,7 +631,7 @@ func GetConversationsFromCache(ctx context.Context, ownerUserID string, conversa
|
||||
|
||||
func GetUserAllConversationList(ctx context.Context, ownerUserID string) (conversations []imdb.Conversation, err error) {
|
||||
defer func() {
|
||||
trace_log.SetContextInfo(ctx, utils.GetFuncName(1), err, "ownerUserID", ownerUserID, "conversations", conversations)
|
||||
trace_log.SetCtxDebug(ctx, utils.GetFuncName(1), err, "ownerUserID", ownerUserID, "conversations", conversations)
|
||||
}()
|
||||
IDList, err := GetUserConversationIDListFromCache(ctx, ownerUserID)
|
||||
if err != nil {
|
||||
@@ -651,7 +651,7 @@ func GetUserAllConversationList(ctx context.Context, ownerUserID string) (conver
|
||||
|
||||
func DelConversationFromCache(ctx context.Context, ownerUserID, conversationID string) (err error) {
|
||||
defer func() {
|
||||
trace_log.SetContextInfo(ctx, utils.GetFuncName(1), err, "ownerUserID", ownerUserID, "conversationID", conversationID)
|
||||
trace_log.SetCtxDebug(ctx, utils.GetFuncName(1), err, "ownerUserID", ownerUserID, "conversationID", conversationID)
|
||||
}()
|
||||
return utils.Wrap(db.DB.Rc.TagAsDeleted(conversationCache+ownerUserID+":"+conversationID), "DelConversationFromCache err")
|
||||
}
|
||||
@@ -669,7 +669,7 @@ func GetExtendMsg(ctx context.Context, sourceID string, sessionType int32, clien
|
||||
return string(bytes), nil
|
||||
}
|
||||
defer func() {
|
||||
trace_log.SetContextInfo(ctx, utils.GetFuncName(1), err, "sourceID", sourceID, "sessionType",
|
||||
trace_log.SetCtxDebug(ctx, utils.GetFuncName(1), err, "sourceID", sourceID, "sessionType",
|
||||
sessionType, "clientMsgID", clientMsgID, "firstModifyTime", firstModifyTime, "extendMsg", extendMsg)
|
||||
}()
|
||||
extendMsgStr, err := db.DB.Rc.Fetch(extendMsgCache+clientMsgID, time.Second*30*60, getExtendMsg)
|
||||
@@ -683,7 +683,7 @@ func GetExtendMsg(ctx context.Context, sourceID string, sessionType int32, clien
|
||||
|
||||
func DelExtendMsg(ctx context.Context, clientMsgID string) (err error) {
|
||||
defer func() {
|
||||
trace_log.SetContextInfo(ctx, utils.GetFuncName(1), err, "clientMsgID", clientMsgID)
|
||||
trace_log.SetCtxDebug(ctx, utils.GetFuncName(1), err, "clientMsgID", clientMsgID)
|
||||
}()
|
||||
return utils.Wrap(db.DB.Rc.TagAsDeleted(extendMsgCache+clientMsgID), "DelExtendMsg err")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user