|
@@ -8,6 +8,8 @@ using GxPress.Entity;
|
|
|
using GxPress.EnumConst;
|
|
|
using GxPress.Repository.Interface;
|
|
|
using GxPress.Repository.Interface.AdminVerify;
|
|
|
+using GxPress.Repository.Interface.Friends;
|
|
|
+using GxPress.Request.AddressBookGroupUser;
|
|
|
using GxPress.Request.App.GroupUser;
|
|
|
using GxPress.Result.App.AdminVerify;
|
|
|
using GxPress.Service.Interface;
|
|
@@ -17,7 +19,7 @@ using GxPress.Service.Interface.Middle;
|
|
|
|
|
|
namespace GxPress.Service.Implement.AdminVerify
|
|
|
{
|
|
|
- public class AdminVerifyService : IAdminVerifyService
|
|
|
+ public partial class AdminVerifyService : IAdminVerifyService
|
|
|
{
|
|
|
private readonly IAdminVerifyRepository _adminVerifyRepository;
|
|
|
private readonly IUserRepository _userRepository;
|
|
@@ -30,11 +32,12 @@ namespace GxPress.Service.Implement.AdminVerify
|
|
|
private readonly IGroupUserRepository _groupUserRepository;
|
|
|
private readonly IGroupChatUserRepository _groupChatUserRepository;
|
|
|
private readonly IMapper _mapper;
|
|
|
-
|
|
|
+ private readonly IFriendsRepository friendsRepository;
|
|
|
+ private readonly IAddressBookGroupUserRepository addressBookGroupUserRepository;
|
|
|
public AdminVerifyService(IAdminVerifyRepository adminVerifyRepository, IUserRepository userRepository,
|
|
|
IDepartmentRepository departmentRepository, IGroupChatRepository groupChatRepository,
|
|
|
IGroupService groupService, IMiddleService middleService, IGroupChatUserService groupChatUserService,
|
|
|
- IGroupRepository groupRepository, IMapper mapper, IGroupUserRepository groupUserRepository, IGroupChatUserRepository groupChatUserRepository)
|
|
|
+ IGroupRepository groupRepository, IMapper mapper, IGroupUserRepository groupUserRepository, IGroupChatUserRepository groupChatUserRepository, IFriendsRepository friendsRepository, IAddressBookGroupUserRepository addressBookGroupUserRepository)
|
|
|
{
|
|
|
_adminVerifyRepository = adminVerifyRepository;
|
|
|
_userRepository = userRepository;
|
|
@@ -47,6 +50,8 @@ namespace GxPress.Service.Implement.AdminVerify
|
|
|
_mapper = mapper;
|
|
|
_groupUserRepository = groupUserRepository;
|
|
|
_groupChatUserRepository = groupChatUserRepository;
|
|
|
+ this.friendsRepository = friendsRepository;
|
|
|
+ this.addressBookGroupUserRepository = addressBookGroupUserRepository;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -82,9 +87,29 @@ namespace GxPress.Service.Implement.AdminVerify
|
|
|
request.UserIds.Add(adminVerify.UserId);
|
|
|
await _groupService.AddUsersAsync(request);
|
|
|
}
|
|
|
+ //好友
|
|
|
+ if (adminVerify.VerifyType == GroupTypeConst.Friends)
|
|
|
+ {
|
|
|
+ //加入好友
|
|
|
+ await friendsRepository.AddAsync(new Friends
|
|
|
+ {
|
|
|
+ UserId = adminVerify.UserId,
|
|
|
+ FriendsUserId = adminVerify.AdminId,
|
|
|
+ AddressBookGroupId = adminVerify.AddressBookGroupId
|
|
|
+ });
|
|
|
+ //添加自建分组
|
|
|
+ if (adminVerify.AddressBookGroupId > 0)
|
|
|
+ {
|
|
|
+ await addressBookGroupUserRepository.InsertAsync(new AddressBookGroupUserInRequest
|
|
|
+ {
|
|
|
+ AddressBookGroupId = adminVerify.AddressBookGroupId,
|
|
|
+ UserId = adminVerify.AdminId
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
//修改状态
|
|
|
- await _adminVerifyRepository.UpdateAsync(Q.Where(nameof(Entity.AdminVerify.AdminId), adminVerify.AdminId).Where(nameof(Entity.AdminVerify.UserId), adminVerify.UserId).Where(nameof(Entity.AdminVerify.SourceType), adminVerify.SourceType).Where(nameof(Entity.AdminVerify.SourceId), adminVerify.SourceId).Set(nameof(Entity.AdminVerify.DisposeType), AdminVerifyTypeConst.Approve.GetHashCode()));
|
|
|
+ // await _adminVerifyRepository.UpdateAsync(Q.Where(nameof(Entity.AdminVerify.AdminId), adminVerify.AdminId).Where(nameof(Entity.AdminVerify.UserId), adminVerify.UserId).Where(nameof(Entity.AdminVerify.SourceType), adminVerify.SourceType).Where(nameof(Entity.AdminVerify.SourceId), adminVerify.SourceId).Set(nameof(Entity.AdminVerify.DisposeType), AdminVerifyTypeConst.Approve.GetHashCode()));
|
|
|
await _adminVerifyRepository.UpdateAsync(Q.Where(nameof(Entity.AdminVerify.AdminId), adminVerify.UserId).Where(nameof(Entity.AdminVerify.UserId), adminVerify.AdminId).Where(nameof(Entity.AdminVerify.SourceType), adminVerify.SourceType).Where(nameof(Entity.AdminVerify.SourceId), adminVerify.SourceId).Set(nameof(Entity.AdminVerify.DisposeType), disposeTyeConst.GetHashCode()));
|
|
|
return true;
|
|
|
}
|