添加项目文件。
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
using ContactService.WebApi.Application.Friend;
|
||||
using Grpc.Core;
|
||||
using IM.Protocols.Grpc.Contact;
|
||||
|
||||
namespace ContactService.WebApi.Services
|
||||
{
|
||||
public class ContactintegrationService: ContactInternal.ContactInternalBase
|
||||
{
|
||||
private readonly Application.Friend.FriendService friendService;
|
||||
|
||||
public ContactintegrationService(FriendService friendService)
|
||||
{
|
||||
this.friendService = friendService;
|
||||
}
|
||||
|
||||
public override async Task<CheckFriendshipResponse> CheckFriendship(CheckFriendshipRequest request, ServerCallContext context)
|
||||
{
|
||||
var response = new CheckFriendshipResponse();
|
||||
var res = await friendService.CheckFriendAsync(
|
||||
Guid.Parse(request.OwnerId),
|
||||
Guid.Parse(request.TargetId)
|
||||
);
|
||||
|
||||
if(res.Succeeded && res.Data)
|
||||
{
|
||||
response.Checked = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
response.Checked = false;
|
||||
}
|
||||
return response;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user