123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- using System.Threading.Tasks;
- using GxPress.Auth;
- using GxPress.Repository.Interface;
- using GxPress.Request.App.OftenContact;
- using GxPress.Result.App.OftenContact;
- using Microsoft.AspNetCore.Authorization;
- using Microsoft.AspNetCore.Mvc;
- using Microsoft.Extensions.Logging;
- using GxPress.Service.Interface.OftenContact;
- using System.Collections.Generic;
- namespace GxPress.Api.AppControllers
- {
- /// <summary>
- /// 好友
- /// </summary>
- [Route("api/app/often-contact")]
- [ApiController]
- [Authorize]
- public partial class OftenContactController : ControllerBase
- {
- private readonly ILogger<OftenContactController> _logger;
- private readonly IOftenContactRepository _repository;
- private readonly ILoginContext _loginContext;
- private readonly IOftenContactService _oftenContactService;
- public OftenContactController(ILogger<OftenContactController> logger, IOftenContactRepository repository, ILoginContext loginContext, IOftenContactService oftenContactService)
- {
- _logger = logger;
- _repository = repository;
- _loginContext = loginContext;
- _oftenContactService = oftenContactService;
- }
- /// <summary>
- /// 根据文件ID获取用户和下面的数据
- /// </summary>
- /// <param name="request"></param>
- /// <returns></returns>
- [HttpPost("list")]
- public async Task<System.Collections.Generic.IEnumerable<OftenContactInfo>> GetOftenContactsAsync(OftenContactSearchRequest request)
- {
- request.UserId = _loginContext.AccountId;
- return await _oftenContactService.GetOftenContacts(request);
- }
- /// <summary>
- /// 添加
- /// </summary>
- /// <param name="request"></param>
- /// <returns></returns>
- [HttpPost("add")]
- public async Task<OftenContactDto> Insert(OftenContactInRequest request)
- {
- var result = new OftenContactDto();
- result = await _oftenContactService.InsertAsync(request, _loginContext.AccountId);
- return result;
- }
- /// <summary>
- /// /// 移除文件夹关系
- /// </summary>
- /// <param name="request"></param>
- /// <returns></returns>
- [HttpPost("remove")]
- public async Task<bool> RemoveOftenContact(OftenContactDeRequest request)
- {
- return await _repository.RemoveOftenContactAsync(request);
- }
- /// <summary>
- /// 设置置顶
- /// </summary>
- /// <param name="request"></param>
- /// <returns></returns>
- [HttpPost("is-top")]
- public async Task<bool> SetOftenContactIsTop(OftenContactDeRequest request)
- {
- return await _repository.SetOftenContactIsTopAsync(request);
- }
- /// <summary>
- /// 移动到文件夹
- /// </summary>
- /// <param name="request"></param>
- /// <returns></returns>
- [HttpPost("move")]
- public async Task<bool> MoveOftenContactToIndividualGroup(OftenContactUpRequest request)
- {
- return await _repository.MoveOftenContactToIndividualGroupAsync(request);
- }
- /// <summary>
- /// 删除聊天界面
- /// </summary>
- /// <param name="oftenContactIds"></param>
- /// <returns></returns>
- [HttpPost("delete")]
- public async Task<bool> DeleteAsync(OftenContactsDeRequest oftenContactIds)
- {
- return await _repository.DeleteAsync(oftenContactIds.OftenContactIds);
- }
- /// <summary>
- /// 根据文件ID获取用户和下面的数据
- /// </summary>
- /// <param name="request"></param>
- /// <returns></returns>
- [HttpPost("all-list")]
- public async Task<IEnumerable<OftenContactInfo>> GetOftenContactAllAsync(OftenContactSearchRequest request)
- {
- request.UserId = _loginContext.AccountId;
- return await _oftenContactService.GetOftenContactsAll(request);
- }
- }
- }
|