Skip to content

Commit

Permalink
Sample v5.600.4 优化错误模板消息发送的验证,终止白名单异常继续发送 #2116
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffreySu committed Oct 13, 2020
1 parent 109e562 commit 0de744b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
//DPBMARK MP
using Senparc.Weixin.MP.Entities;
using Senparc.Weixin.MP.Helpers;
using Senparc.CO2NET.Trace;
//DPBMARK_END
#if NET45
using System.Web;
Expand Down Expand Up @@ -136,6 +137,7 @@ public async Task ConfigOnWeixinExceptionFunc(WeixinException ex)
ReturnCode.获取access_token时AppSecret错误或者access_token无效,
ReturnCode.access_token超时,
ReturnCode.template_id不正确,
ReturnCode.调用接口的IP地址不在白名单中,//比较容易出现,需要注意!
ReturnCode.缺少access_token参数,
ReturnCode.回复时间超过限制,
ReturnCode.api功能未授权,
Expand All @@ -149,6 +151,11 @@ public async Task ConfigOnWeixinExceptionFunc(WeixinException ex)
};
if (ignoreErrorCodes.Contains(jsonEx.JsonResult.errcode))
{
if (jsonEx.JsonResult.errcode == ReturnCode.调用接口的IP地址不在白名单中)
{
SenparcTrace.SendCustomLog("无法发送模板消息", "IP 未设置到白名单");
}

sendTemplateMessage = false;//防止无限递归,这种请款那个下不发送消息
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<Version>5.600.3</Version>
<Version>5.600.4</Version>
</PropertyGroup>

<ItemGroup>
Expand Down

0 comments on commit 0de744b

Please sign in to comment.