using System;
using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Http;
using LitJson;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;

namespace MySystem.Areas.Api.Controllers
{
    [Area("Api")]
    [Route("Api/[controller]/[action]")]
    public class PubController : BaseController
    {
        public PubController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
        {
        }
        
        #region OCR识别-营业执照
        public JsonResult BusinessLicenseOcr(string value)
        {
            value = DesDecrypt(value);
            Dictionary<string, object> Obj = BusinessLicenseOcrDo(value);
            return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
        }
        public Dictionary<string, object> BusinessLicenseOcrDo(string value)
        {
            JsonData data = JsonMapper.ToObject(value);
            string Url = data["Url"].ToString();
            Dictionary<string, object> Obj = new Dictionary<string, object>();
            Obj.Add("OcrData", AliyunOcr.Check(Url));
            return Obj;
        }
        #endregion
    }
}