forked from cherish-chat/xxim-server
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
50 changed files
with
3,455 additions
and
742 deletions.
There are no files selected for viewing
6 changes: 6 additions & 0 deletions
6
app/conversation/client/conversationservice/conversationService.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
app/conversation/internal/logic/friendservice/countFriendLogic.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package friendservicelogic | ||
|
||
import ( | ||
"context" | ||
"go.mongodb.org/mongo-driver/bson" | ||
|
||
"github.com/cherish-chat/xxim-server/app/conversation/internal/svc" | ||
"github.com/cherish-chat/xxim-server/common/pb" | ||
|
||
"github.com/zeromicro/go-zero/core/logx" | ||
) | ||
|
||
type CountFriendLogic struct { | ||
ctx context.Context | ||
svcCtx *svc.ServiceContext | ||
logx.Logger | ||
} | ||
|
||
func NewCountFriendLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CountFriendLogic { | ||
return &CountFriendLogic{ | ||
ctx: ctx, | ||
svcCtx: svcCtx, | ||
Logger: logx.WithContext(ctx), | ||
} | ||
} | ||
|
||
// CountFriend 统计好友数量 | ||
func (l *CountFriendLogic) CountFriend(in *pb.CountFriendReq) (*pb.CountFriendResp, error) { | ||
count, err := l.svcCtx.FriendCollection.Find(l.ctx, bson.M{ | ||
"userId": in.Header.UserId, | ||
}).Count() | ||
if err != nil { | ||
l.Errorf("find friend error: %v", err) | ||
return &pb.CountFriendResp{}, err | ||
} | ||
return &pb.CountFriendResp{Count: count}, nil | ||
} |
Oops, something went wrong.