PubController.cs 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. using System;
  2. using System.Collections.Generic;
  3. using Microsoft.AspNetCore.Mvc;
  4. using Microsoft.AspNetCore.Http;
  5. using System.DrawingCore.Imaging;
  6. using System.IO;
  7. using Library;
  8. using System.Collections;
  9. using LitJson;
  10. using System.Globalization;
  11. using System.Web;
  12. using System.Security.Cryptography;
  13. using System.Text;
  14. using Aliyun.OSS;
  15. namespace MySystem.Areas.Api.Controllers
  16. {
  17. [Area("Api")]
  18. [Route("Api/[controller]/[action]")]
  19. public class PubController : BaseController
  20. {
  21. public PubController(IHttpContextAccessor accessor) : base(accessor)
  22. {
  23. }
  24. #region OCR识别-营业执照
  25. public JsonResult BusinessLicenseOcr(string value)
  26. {
  27. value = DesDecrypt(value);
  28. JsonData data = JsonMapper.ToObject(value);
  29. string Url = data["Url"].ToString();
  30. if(string.IsNullOrEmpty(Url))
  31. {
  32. return Json(new AppResultJson() { Status = "-1", Info = "营业执照识别异常,请手动填写" });
  33. }
  34. string content = AliyunOcr.Check(Url);
  35. if(string.IsNullOrEmpty(content))
  36. {
  37. return Json(new AppResultJson() { Status = "-1", Info = "营业执照识别异常,请手动填写" });
  38. }
  39. Dictionary<string, object> Obj = new Dictionary<string, object>();
  40. Obj.Add("OcrData", content);
  41. return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
  42. }
  43. #endregion
  44. }
  45. }