This commit is contained in:
withchao
2023-01-17 17:31:22 +08:00
parent 58866c1b41
commit 6ab9cff3c3
8 changed files with 265 additions and 143 deletions
+8 -1
View File
@@ -61,13 +61,20 @@ func (f *Friend) UpdateRemark(ctx context.Context, ownerUserID, friendUserID, re
return utils.Wrap(f.DB.Model(f).Where("owner_user_id = ? and friend_user_id = ?", ownerUserID, friendUserID).Update("remark", remark).Error, "")
}
func (f *Friend) Find(ctx context.Context, ownerUserID string) (friends []*Friend, err error) {
func (f *Friend) FindOwnerUserID(ctx context.Context, ownerUserID string) (friends []*Friend, err error) {
defer func() {
trace_log.SetCtxDebug(ctx, utils.GetSelfFuncName(), err, "ownerUserID", ownerUserID, "friends", friends)
}()
return friends, utils.Wrap(f.DB.Where("owner_user_id = ?", ownerUserID).Find(&friends).Error, "")
}
func (f *Friend) FindFriendUserID(ctx context.Context, friendUserID string) (friends []*Friend, err error) {
defer func() {
trace_log.SetCtxDebug(ctx, utils.GetSelfFuncName(), err, "friendUserID", friendUserID, "friends", friends)
}()
return friends, utils.Wrap(f.DB.Where("friend_user_id = ?", friendUserID).Find(&friends).Error, "")
}
func (f *Friend) Take(ctx context.Context, ownerUserID, friendUserID string) (friend *Friend, err error) {
friend = &Friend{}
defer trace_log.SetCtxDebug(ctx, utils.GetSelfFuncName(), err, "ownerUserID", ownerUserID, "friendUserID", friendUserID, "friend", friend)