1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- 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;
- 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);
- }
- }
- }
|