VerCodeController.cs 673 B

1234567891011121314151617181920212223242526
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Threading.Tasks;
  5. using Bowin.Common;
  6. using Bowin.Common.Cache;
  7. using Microsoft.AspNetCore.Http;
  8. using Microsoft.AspNetCore.Mvc;
  9. namespace YLShipBuildLandMap.Web.Controllers.SystemSetting
  10. {
  11. [Route("api/[controller]")]
  12. [ApiController]
  13. public class VerCodeController : ControllerBase
  14. {
  15. [HttpGet]
  16. public ActionResult Get(string key)
  17. {
  18. var code = VerifyCodeHelper.GetCode(4);
  19. CacheHelper.Add(key, code.Code, DateTime.Now.AddMinutes(5));
  20. return Content("data:image/png;base64," + code.CodeBase64);
  21. }
  22. }
  23. }