|
@@ -7,6 +7,7 @@ using GxPress.Repository.Interface;
|
|
|
using GxPress.Repository.Interface.Friends;
|
|
|
using GxPress.Request.AddressBookGroupUser;
|
|
|
using GxPress.Result.AddressBookGroupUser;
|
|
|
+using GxPress.Service.Interface.AddressBookGroup;
|
|
|
using Microsoft.AspNetCore.Authorization;
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
using Microsoft.Extensions.Logging;
|
|
@@ -25,12 +26,16 @@ namespace GxPress.Api.AppControllers
|
|
|
private readonly IAddressBookGroupUserRepository _addressBookGroupUserRepository;
|
|
|
private readonly ILoginContext _loginContext;
|
|
|
private readonly IFriendsRepository friendsRepository;
|
|
|
- public AddressBookGroupUserController(ILogger<AppVersionController> logger, IAddressBookGroupUserRepository addressBookGroupUserRepository, ILoginContext loginContext, IFriendsRepository friendsRepository)
|
|
|
+ private readonly IAddressBookGroupService addressBookGroupService;
|
|
|
+ public AddressBookGroupUserController(ILogger<AppVersionController> logger,
|
|
|
+ IAddressBookGroupUserRepository addressBookGroupUserRepository,
|
|
|
+ ILoginContext loginContext, IFriendsRepository friendsRepository,IAddressBookGroupService addressBookGroupService)
|
|
|
{
|
|
|
_logger = logger;
|
|
|
_addressBookGroupUserRepository = addressBookGroupUserRepository;
|
|
|
_loginContext = loginContext;
|
|
|
this.friendsRepository = friendsRepository;
|
|
|
+ this.addressBookGroupService=addressBookGroupService;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -50,12 +55,8 @@ namespace GxPress.Api.AppControllers
|
|
|
[HttpPost("delete")]
|
|
|
public async Task<bool> Deletes(AddressBookGroupUserDeleteRequest request)
|
|
|
{
|
|
|
- var model = await _addressBookGroupUserRepository.GetAllAsync(Q.WhereIn(nameof(Entity.AddressBookGroupUser.Id), request.Ids));
|
|
|
- if (await _addressBookGroupUserRepository.DeletesAsync(request.Ids))
|
|
|
- {
|
|
|
- return await friendsRepository.DeleteAsync(model.Select(n => n.UserId), _loginContext.AccountId);
|
|
|
- }
|
|
|
- return false;
|
|
|
+ request.UserId = _loginContext.AccountId;
|
|
|
+ return await addressBookGroupService.DeleteAddressBookGroupUserAsync(request);
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// 获取
|