#region Apache License Version 2.0
/*----------------------------------------------------------------
Copyright 2019 Jeffrey Su & Suzhou Senparc Network Technology Co.,Ltd.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the
License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
either express or implied. See the License for the specific language governing permissions
and limitations under the License.
Detail: https://github.com/JeffreySu/WeiXinMPSDK/blob/master/license.md
----------------------------------------------------------------*/
#endregion Apache License Version 2.0
/*----------------------------------------------------------------
Copyright (C) 2019 Senparc
文件名:ApiHandlerWapperFactory.cs
文件功能描述:针对AccessToken无效或过期的自动处理方法的工厂
创建标识:Senparc - 20170327
----------------------------------------------------------------*/
using Senparc.Weixin.Entities;
using Senparc.Weixin.Utilities.WeixinUtility;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Senparc.Weixin.CommonAPIs
{
/////
///// ApiHandlerWapperFactory的当前平台
/////
//public enum ApiHandlerWapperPlatform
//{
// ///
// /// 公众号
// ///
// MP,
// ///
// /// 开放平台
// ///
// OPEN
//}
/////
///// 针对AccessToken无效或过期的自动处理类(基类)
/////
//public static class ApiHandlerWapperFactory
//{
// ///
// /// 同步方法集合
// ///
// public static Dictionary> Collection = new Dictionary>();
// ///
// /// 异步方法集合
// ///
// public static Dictionary>> CollectionAsync = new Dictionary>>();
// /////
// ///// 平台凭证队列
// /////
// //public static Dictionary PlatformQueue = new Dictionary();
// ///
// /// ApiHandlerWapperFactory锁
// ///
// public static object ApiHandlerWapperFactoryLock = new object();
// private static ApiHandlerWapperPlatform _currentPlatform = ApiHandlerWapperPlatform.MP;
// ///
// /// 当前平台,值:
// ///
// public static ApiHandlerWapperPlatform CurrentPlatform
// {
// get
// {
// return _currentPlatform;
// }
// set
// {
// _currentPlatform = value;
// }
// }
// #region 同步方法
// public static Func GetWapperFunc(ApiHandlerWapperPlatform platform) where T : WxJsonResult
// {
// if (!Collection.ContainsKey(platform))
// {
// return null;//也可以抛出异常
// }
// var funWapper = Collection[platform];
// return funWapper as Func;
// }
// ///
// /// 提供给ApiHandlerWapper使用的全局统一的基础调用方法,兼容公众号、开放平台在不同情况下对接口的统一调用
// ///
// ///
// ///
// ///
// public static WxJsonResult RunWapper(ApiHandlerWapperPlatform platform) where T : WxJsonResult
// {
// if (!Collection.ContainsKey(platform))
// {
// return null;//也可以抛出异常
// }
// var funWapper = Collection[platform];
// return funWapper();
// }
// #endregion
// #region 异步方法
// ///
// /// 【异步方法】提供给ApiHandlerWapper使用的全局统一的基础调用方法,兼容公众号、开放平台在不同情况下对接口的统一调用
// ///
// ///
// ///
// ///
// public static async Task RunWapperAsync(Func> funWapper) where T : WxJsonResult
// {
// if (funWapper == null)
// {
// return null;
// }
// return await funWapper();
// }
// #endregion
//}
}