AdminVerifyController.cs 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. using System.Collections.Generic;
  2. using System.Threading.Tasks;
  3. using GxPress.Auth;
  4. using GxPress.Request._AdminVerify;
  5. using GxPress.Request.App.AdminVerify;
  6. using GxPress.Result.App.AdminVerify;
  7. using GxPress.Service.Interface.AdminVerify;
  8. using Microsoft.AspNetCore.Authorization;
  9. using Microsoft.AspNetCore.Mvc;
  10. namespace GxPress.Api.AppControllers
  11. {
  12. /// <summary>
  13. /// 验证信息
  14. /// </summary>
  15. [Route("api/app/admin-verify")]
  16. [ApiController]
  17. [Authorize]
  18. public class AdminVerifyController : ControllerBase
  19. {
  20. private readonly IAdminVerifyService _adminVerifyService;
  21. private readonly ILoginContext _loginContext;
  22. public AdminVerifyController(IAdminVerifyService adminVerifyService, ILoginContext loginContext)
  23. {
  24. _adminVerifyService = adminVerifyService;
  25. _loginContext = loginContext;
  26. }
  27. /// <summary>
  28. /// 清空
  29. /// </summary>
  30. /// <returns></returns>
  31. [HttpDelete("delete")]
  32. public async Task<bool> DeleteAllAsync()
  33. {
  34. return await _adminVerifyService.DeleteAllAsync(_loginContext.AccountId);
  35. }
  36. /// <summary>
  37. /// 修改
  38. /// </summary>
  39. /// <param name="request"></param>
  40. /// <returns></returns>
  41. [HttpPut("update")]
  42. public async Task<bool> UpdateAsync(AdminVerifyUpdateRequest request)
  43. {
  44. return await _adminVerifyService.UpdateAsync(request.Id, request.AdminVerifyTypeConst);
  45. }
  46. /// <summary>
  47. /// 根据用户查询
  48. /// </summary>
  49. /// <returns></returns>
  50. [HttpPost("search")]
  51. public async Task<IEnumerable<AdminVerifySearchResult>> GetAllAsync()
  52. {
  53. return await _adminVerifyService.GetAllAsync(_loginContext.AccountId);
  54. }
  55. /// <summary>
  56. /// 查询未处理条数
  57. /// </summary>
  58. /// <returns></returns>
  59. [HttpPost("count")]
  60. public async Task<int> GetUDisposeCount()
  61. {
  62. return await _adminVerifyService.GetUDisposeCount(_loginContext.AccountId);
  63. }
  64. /// <summary>
  65. /// 添加好友
  66. /// </summary>
  67. /// <param name="request"></param>
  68. /// <returns></returns>
  69. [HttpPost("add-friend")]
  70. public async Task<bool> AddFriendAsync(AdminVerifyInFriendsRequest request)
  71. {
  72. request.UserId = _loginContext.AccountId;
  73. return await _adminVerifyService.AddFriendAsync(request);
  74. }
  75. }
  76. }