using BPA.SAAS.Manage.Application.AExternalPlatform.BaseDto;
using BPA.SAAS.Manage.Application.AExternalPlatform.Service.ThirdpartyPush.Dtos;
using BPA.SAAS.Manage.Application.AExternalPlatform.Service.ThirdpartyPush.Services;
using BPA.SAAS.Manage.Core.System;
using Newtonsoft.Json;
using NPOI.SS.Formula.Eval;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.ThirdpartyPush
{
    [ApiDescriptionSettings("开放平台", Tag = "aaaa")]
    public class ThirdpartyPushServices: IDynamicApiController
    {
        IThirdpartyPushService _thirdpartyPushService;
        public ThirdpartyPushServices(IThirdpartyPushService thirdpartyPushService)
        {
            _thirdpartyPushService = thirdpartyPushService;
        }

        #region 设备 回调级下发数据和记录

        /// <summary>
        /// 添加 三方 回调设备记录
        /// </summary>
        /// <param name="inputDto"></param>
        /// <returns></returns>
        public async Task<bool> AddThirdpartyPushRecord(BPA_ThirdpartyPushRecord inputDto)
        {
            return await _thirdpartyPushService.AddThirdpartyPushRecord(inputDto);

        }


        /// <summary>
        /// 修改 第三方订单的回调
        /// </summary>
        /// <param name="inputDto"></param>
        /// <returns></returns>
        [HttpPost("/api/hirdpartypush/updatethirdpartypushrecord"), AllowAnonymous]
        public async Task<bool> UpdateThirdpartyPushRecord(ThirdpartyPushRecordDto inputDto)
        {
            return await _thirdpartyPushService.UpdateThirdpartyPushRecord(inputDto);

        }

        /// <summary>
        /// 更具店铺获取设备
        /// </summary>
        /// <param name="inputDto"></param>
        /// <returns></returns>
        public async Task<List<string>> GetDeviceByStoreId(List<string> inputDto)
        {
            return await _thirdpartyPushService.GetDeviceByStoreId(inputDto);
        }

        [ AllowAnonymous, NonUnify]
        public async Task<bool> aaaaa()
        {
            var data = new aaaaaaaaaaaa()
            {
                a= "你好",
                b=1,
                c=2,
                d= 3.3f,
                e=true,
                t=new aaaaaaaaaaaa()
                {
                    a = "你好aaa",
                    b = 10,
                    c = 20,
                    d = 30.3f,
                    e=false,
                }

            };



            var thisSign = DtoValidator.GetSign(data);

            thisSign = thisSign + "&key=" + "64059261-1599-472c-b418-3c18b4e3883e";


            var vvv11 = thisSign.ToUpper();
            var vvv = MD5Encryption.Encrypt(thisSign.ToUpper()).ToUpper();
            var vvv1 =
                "A=你好&B=1&C=2&D=3.3&E=TRUE&T={\"A\":\"你好AAA\",\"B\":10,\"C\":20,\"D\":30.3,\"E\":FALSE}&KEY=64059261-1599-472C-B418-3C18B4E3883E";
            var vvvv2 = MD5Encryption.Encrypt(vvv1.ToUpper()).ToUpper();
            return true;
        }

        #endregion
    }


    public class aaaaaaaaaaaa
    {
        public string a{ get; set; }

        public byte b{ get; set; }

        public int c{ get; set; }

        public float d{ get; set; }

        public bool e{ get; set; }

        public aaaaaaaaaaaa t{ get; set; }

    }

   
}
