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.Main1
{
    [Area("Api")]
    [Route("/v1/QrCodePlateMain/[controller]/[action]")]
    public class MerchantDepositOrderController : BaseController
    {
        public MerchantDepositOrderController(IHttpContextAccessor accessor) : base(accessor)
        {
        }

        #region 商户激活-直连激活商户记录
        [Authorize]
        public JsonResult DirectActRecord(string value)
        {
            value = PublicFunction.DesDecrypt(value); ;
            JsonData data = JsonMapper.ToObject(value);
            List<Dictionary<string, object>> dataList = DirectActRecordDo(value);
            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
        }
        private List<Dictionary<string, object>> DirectActRecordDo(string value)
        {
            JsonData data = JsonMapper.ToObject(value);
            string MerchantName = data["MerchantName"].ToString(); //商户名称
            string MctNo = data["MctNo"].ToString(); //商户号
            string UpdateDate = data["UpdateDate"].ToString(); //激活时间
            string PayMode = data["PayMode"].ToString(); //支付方式(1 支付宝 2 微信)
            int pageSize = int.Parse(function.CheckInt(data["page_size"].ToString()));
            int pageNum = int.Parse(function.CheckInt(data["page_num"].ToString()));
            string condition = "";
            List<RelationData> relationData = new List<RelationData>();
            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
            List<Dictionary<string, object>> source = MerchantDepositOrderService.List(relationData, condition, pageNum, pageSize);
            foreach (Dictionary<string, object> subdata in source)
            {
                Dictionary<string, object> curData = new Dictionary<string, object>();
                curData.Add("", subdata[""].ToString()); //
                curData.Add("MerchantName", ""); //商户名称
                curData.Add("MctNo", ""); //商户号
                curData.Add("UpdateDate", ""); //激活时间
                curData.Add("PayMode", ""); //支付方式(1 支付宝 2 微信)
                curData.Add("ActPayPrice", ""); //支付金额

                dataList.Add(curData);
            }
            return dataList;
        }
        #endregion



    }
}
