AppVersionController.cs 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. using System.Collections.Generic;
  2. using System.Threading.Tasks;
  3. using GxPress.Entity;
  4. using GxPress.Repository.Interface;
  5. using GxPress.Request.AppVersion;
  6. using Microsoft.AspNetCore.Authorization;
  7. using Microsoft.AspNetCore.Mvc;
  8. using Microsoft.Extensions.Logging;
  9. namespace GxPress.Api.AppControllers
  10. {
  11. /// <summary>
  12. /// APP版本管理
  13. /// </summary>
  14. [Route("api/app/app-version")]
  15. [ApiController]
  16. [Authorize]
  17. public class AppVersionController : ControllerBase
  18. {
  19. private readonly ILogger<AppVersionController> _logger;
  20. private readonly IAppVersionRepository _appVersionRepository;
  21. public AppVersionController(ILogger<AppVersionController> logger, IAppVersionRepository appVersionRepository)
  22. {
  23. _logger = logger;
  24. _appVersionRepository = appVersionRepository;
  25. }
  26. /// <summary>
  27. /// app检查是否更新
  28. /// </summary>
  29. /// <param name="request"></param>
  30. /// <returns></returns>
  31. [HttpPost("get-version")]
  32. [AllowAnonymous]
  33. public async Task<AppVersion> GetAppVersion(AppVersionSearchRequest request)
  34. {
  35. return await _appVersionRepository.GetAppVersionAsync(request);
  36. }
  37. /// <summary>
  38. /// 查询
  39. /// </summary>
  40. /// <returns></returns>
  41. [HttpPost("app-list")]
  42. [AllowAnonymous]
  43. public async Task<IEnumerable<AppVersion>> GetAppVersionsAll()
  44. {
  45. return await _appVersionRepository.GetAppVersionsAsync();
  46. }
  47. }
  48. }