using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Microsoft.AspNetCore.Authorization;
using System.Web;
using MySystem.Models.Main1;
using MySystem.Service.Main1;
using LitJson;
using Library;

namespace MySystem.Areas.Api.Controllers.v1
{
    [Area("Api")]
    [Route("/v1/QrCodePlateMain/[controller]/[action]")]
    public class UserSwapWhiteController : BaseController
    {
        public UserSwapWhiteController(IHttpContextAccessor accessor) : base(accessor)
        {
        }


        #region 风险管理-风险创客列表
        // [Authorize]
        public JsonResult QueryUserRiskFlag(string value)
        {
            value = PublicFunction.DesDecrypt(value);
            JsonData data = JsonMapper.ToObject(value);
            Dictionary<string, object> Obj = QueryUserRiskFlagDo(value);
            return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
        }
        private Dictionary<string, object> QueryUserRiskFlagDo(string value)
        {
            JsonData data = JsonMapper.ToObject(value);
            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //风控创客Id
            var RiskFlag = 0;
            var Remark = "";
            var info = UserSwapWhiteService.QueryByUserId(UserId);
            if (info.Id > 0)
            {
                RiskFlag = 1;
                Remark = info.Remark;
            }
            Dictionary<string, object> Obj = new Dictionary<string, object>();
            Obj.Add("RiskFlag", RiskFlag);
            Obj.Add("Remark", Remark);
            return Obj;
        }
        #endregion

    }
}
