Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修正项目tencent引用空间命名 #734

Merged
merged 9 commits into from
Aug 10, 2017
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ and limitations under the License.
using Senparc.Weixin.MP.Entities;
using Senparc.Weixin.MP.Entities.Request;
using Senparc.Weixin.MP.Helpers;
using Tencent;
using Senparc.Weixin.MP.Tencent;

namespace Senparc.Weixin.MP.MessageHandlers
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
using System.Xml.Linq;
using Senparc.Weixin.Exceptions;
using Senparc.Weixin.Open.Entities.Request;
using Tencent;
using Senparc.Weixin.Open.Tencent;

namespace Senparc.Weixin.Open.MessageHandlers
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public static ModifyDomainResultJson ModifyDomain(string accessToken, ModifyDoma
List<string> downloaddomain,
int timeOut = Config.TIME_OUT)
{
var url = string.Format("https://api.weixin.qq.com/wxa/modify_domain?access_token={0}&media_id={1}", accessToken.AsUrlData());
var url = string.Format("https://api.weixin.qq.com/wxa/modify_domain?access_token={0}", accessToken.AsUrlData());

object data;

Expand Down Expand Up @@ -111,7 +111,7 @@ public static async Task<ModifyDomainResultJson> ModifyDomainAsync(string access
List<string> downloaddomain,
int timeOut = Config.TIME_OUT)
{
var url = string.Format("https://api.weixin.qq.com/wxa/modify_domain?access_token={0}&media_id={1}", accessToken.AsUrlData());
var url = string.Format("https://api.weixin.qq.com/wxa/modify_domain?access_token={0}", accessToken.AsUrlData());

object data;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
using Senparc.Weixin.MessageHandlers;
using Senparc.Weixin.QY.Entities;
using Senparc.Weixin.QY.Helpers;
using Tencent;
using Senparc.Weixin.QY.Tencent;

namespace Senparc.Weixin.QY.MessageHandlers
{
Expand Down
2 changes: 1 addition & 1 deletion src/Senparc.Weixin.QY/Senparc.Weixin.QY/Signature.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
修改描述:整理接口
----------------------------------------------------------------*/

using Tencent;
using Senparc.Weixin.QY.Tencent;

namespace Senparc.Weixin.QY
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
using Senparc.Weixin.MessageHandlers;
using Senparc.Weixin.Work.Entities;
using Senparc.Weixin.Work.Helpers;
using Tencent;
using Senparc.Weixin.Work.Tencent;

namespace Senparc.Weixin.Work.MessageHandlers
{
Expand Down
2 changes: 1 addition & 1 deletion src/Senparc.Weixin.Work/Senparc.Weixin.Work/Signature.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
修改描述:整理接口
----------------------------------------------------------------*/

using Tencent;
using Senparc.Weixin.Work.Tencent;

namespace Senparc.Weixin.Work
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ and limitations under the License.
using Senparc.Weixin.MessageHandlers;
using Senparc.Weixin.WxOpen.Entities;
using Senparc.Weixin.WxOpen.Entities.Request;
using Tencent;
using Senparc.Weixin.WxOpen.Tencent;
//using IRequestMessageBase = Senparc.Weixin.WxOpen.Entities.IRequestMessageBase;

namespace Senparc.Weixin.WxOpen.MessageHandlers
Expand Down
Original file line number Diff line number Diff line change
@@ -1,93 +1,93 @@
#region Apache License Version 2.0
/*----------------------------------------------------------------
Copyright 2017 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) 2017 Senparc
文件名:StreamUtility.cs
文件功能描述:微信对象公共类
创建标识:Senparc - 20150703
修改标识:Senparc - 20170730
修改描述:v4.13.4 修改企业微信APPId判断标准错误(使用新规则)
----------------------------------------------------------------*/
using System;
namespace Senparc.Weixin.Utilities.WeixinUtility
{
/// <summary>
/// 微信 API 工具类
/// </summary>
public static class ApiUtility
{
/// <summary>
/// 判断accessTokenOrAppId参数是否是AppId(或对应企业微信的AppKey)
/// </summary>
/// <param name="accessTokenOrAppId">AccessToken或AppId(推荐使用AppId,需要先注册)</param>
/// <returns></returns>
public static bool IsAppId(string accessTokenOrAppId, PlatformType platFormType)
{
if (platFormType == PlatformType.QY || platFormType == PlatformType.Work)
{
/*
* 企业号(企业微信)AppKey:wx7618c00000000222@044ZI5s6-ACxpAuOcm4md410pZ460pQUmxO9hIoMd09kRaJ1iSqhPfmg3-aBFF7q
* 企业号(企业微信)AccessToken(length=300):MGelzm_P0N-41qH3PwHsNxp70rdVuB0SMEN7dE4E8eKpb0OpNQSp8jPUfgwIL_P9jcz-qGIOLbLEy3d8XQEJFfZtOLgTJqyg0rJbj6WyQJxdRVjbLnHr0-pg7oN9dD1NFI7-T7GLuJER3Pun-5cSiSmZgAegTDhXKZC8XfgjQAPPYLjZl7StBnO7dVcZStdyivZ92zq4PrDdNif9fa2p9lPSLqkur2PpDB9P7MsR8PDJWsKghEcmjB41OXohHGnqPWd5lUZaV1Y8p35BVz6PqjF-90UgAjI9IohVKVRClks
*/
return accessTokenOrAppId != null && accessTokenOrAppId.Length < 256;
}
else
{
/*
* 公众号AppId:wxe273c3a02e09ff8c
* 公众号AccessToken:ga0wJ5ZmdB1Ef1gMMxmps6Uz1a9TXoutQtRqgYTbIqHfTm4Ssfoj0DjMLp1_KkG7FkaqS7m7f9rrYbqBQMBizRBQjHFG5ZIov8Wb0FBnHDq5fGpCu0S2H2j2aM8c6KDqGGEiAIAJJH
*/
return accessTokenOrAppId != null && accessTokenOrAppId.Length <= 32 /*wxc3c90837b0e76080*/
;
}
}
/// <summary>
/// 获取过期时间
/// </summary>
/// <param name="expireInSeconds">有效时间(秒)</param>
/// <returns></returns>
public static DateTime GetExpireTime(int expireInSeconds)
{
if (expireInSeconds > 3600)
{
expireInSeconds -= 600;//提前10分钟过期
}
else if (expireInSeconds > 1800)
{
expireInSeconds -= 300;//提前5分钟过期
}
else if (expireInSeconds > 300)
{
expireInSeconds -= 30;//提前1分钟过期
}
return DateTime.Now.AddSeconds(expireInSeconds);//提前2分钟重新获取
}
}
}
#region Apache License Version 2.0
/*----------------------------------------------------------------

Copyright 2017 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) 2017 Senparc

文件名:StreamUtility.cs
文件功能描述:微信对象公共类


创建标识:Senparc - 20150703

修改标识:Senparc - 20170730
修改描述:v4.13.4 修改企业微信APPId判断标准错误(使用新规则)
----------------------------------------------------------------*/

using System;

namespace Senparc.Weixin.Utilities.WeixinUtility
{
/// <summary>
/// 微信 API 工具类
/// </summary>
public static class ApiUtility
{
/// <summary>
/// 判断accessTokenOrAppId参数是否是AppId(或对应企业微信的AppKey)
/// </summary>
/// <param name="accessTokenOrAppId">AccessToken或AppId(推荐使用AppId,需要先注册)</param>
/// <returns></returns>
public static bool IsAppId(string accessTokenOrAppId, PlatformType platFormType)
{
if (platFormType == PlatformType.QY || platFormType == PlatformType.Work)
{
/*
* 企业号(企业微信)AppKey:wx7618c00000000222@044ZI5s6-ACxpAuOcm4md410pZ460pQUmxO9hIoMd09kRaJ1iSqhPfmg3-aBFF7q
* 企业号(企业微信)AccessToken(length=300):MGelzm_P0N-41qH3PwHsNxp70rdVuB0SMEN7dE4E8eKpb0OpNQSp8jPUfgwIL_P9jcz-qGIOLbLEy3d8XQEJFfZtOLgTJqyg0rJbj6WyQJxdRVjbLnHr0-pg7oN9dD1NFI7-T7GLuJER3Pun-5cSiSmZgAegTDhXKZC8XfgjQAPPYLjZl7StBnO7dVcZStdyivZ92zq4PrDdNif9fa2p9lPSLqkur2PpDB9P7MsR8PDJWsKghEcmjB41OXohHGnqPWd5lUZaV1Y8p35BVz6PqjF-90UgAjI9IohVKVRClks
*/
return accessTokenOrAppId != null && accessTokenOrAppId.Length < 256;
}
else
{
/*
* 公众号AppId:wxe273c3a02e09ff8c
* 公众号AccessToken:ga0wJ5ZmdB1Ef1gMMxmps6Uz1a9TXoutQtRqgYTbIqHfTm4Ssfoj0DjMLp1_KkG7FkaqS7m7f9rrYbqBQMBizRBQjHFG5ZIov8Wb0FBnHDq5fGpCu0S2H2j2aM8c6KDqGGEiAIAJJH
*/
return accessTokenOrAppId != null && accessTokenOrAppId.Length <= 32 /*wxc3c90837b0e76080*/
;
}

}

/// <summary>
/// 获取过期时间
/// </summary>
/// <param name="expireInSeconds">有效时间(秒)</param>
/// <returns></returns>
public static DateTime GetExpireTime(int expireInSeconds)
{
if (expireInSeconds > 3600)
{
expireInSeconds -= 600;//提前10分钟过期
}
else if (expireInSeconds > 1800)
{
expireInSeconds -= 300;//提前5分钟过期
}
else if (expireInSeconds > 300)
{
expireInSeconds -= 30;//提前1分钟过期
}

return DateTime.Now.AddSeconds(expireInSeconds);//提前2分钟重新获取
}
}
}