We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
公众号管理 第一次编辑后,会执行一次全局注册。
如果是重启netcore 后, 再问一次公众号 就会出现, Unhandled exception. Senparc.Weixin.Exceptions.UnRegisterAppIdException: 此appId(wx09c4a176ef1ec44d)尚未注册,请先使用AccessTokenContainer.Register完成注册(全局执行一次即可)!
需要增加判断 或者,每次启动的时候 自动注册公众号列表的内容,否则就要重新编辑保存一次 公众号。 在 protected virtual async Task AfterRunBotAsync(IServiceProvider serviceProvider, RequestMessageText requestMessage, MpAccountDto mpAccountDto, SenparcAiResult senparcAiResult, DateTimeOffset startTime) { Console.WriteLine("MpAccountDTO:" + mpAccountDto.ToJson(indented: true)); string resultMsg = $"{senparcAiResult.OutputString}\r\n -- AI 计算耗时:{SystemTime.DiffTotalMS(startTime)}毫秒"; Console.WriteLine("公众号客服消息2:" + resultMsg); WxJsonResult result = await CustomApi.SendTextAsync(mpAccountDto.AppId, requestMessage.FromUserName, resultMsg); await Console.Out.WriteLineAsync(result.ToJson()); } 的 await CustomApi.SendTextAsync(mpAccountDto.AppId, requestMessage.FromUserName, resultMsg);
protected virtual async Task AfterRunBotAsync(IServiceProvider serviceProvider, RequestMessageText requestMessage, MpAccountDto mpAccountDto, SenparcAiResult senparcAiResult, DateTimeOffset startTime) { Console.WriteLine("MpAccountDTO:" + mpAccountDto.ToJson(indented: true)); string resultMsg = $"{senparcAiResult.OutputString}\r\n -- AI 计算耗时:{SystemTime.DiffTotalMS(startTime)}毫秒"; Console.WriteLine("公众号客服消息2:" + resultMsg); WxJsonResult result = await CustomApi.SendTextAsync(mpAccountDto.AppId, requestMessage.FromUserName, resultMsg); await Console.Out.WriteLineAsync(result.ToJson()); }
我现在是放在 [MpMessageHandler("JeffreyMp")] 的构造函数中 // 检查 appId 是否已注册 if (!AccessTokenContainer.CheckRegistered(_mpAccountDto.AppId)) { // 如果未注册,进行注册 AccessTokenContainer.Register(_mpAccountDto.AppId, _mpAccountDto.AppSecret); }
The text was updated successfully, but these errors were encountered:
感谢反馈!
目前的规则应该是在启动的时候就会注册,您可以看一下,重启之后,是否有对应的日志可以看到:
https://github.com/NeuCharFramework/Senparc.Xncf.WeixinManager/blob/4ebe4f537b0ca6d9010cb18a90c9a869e68e5139/src/Senparc.Xncf.WeixinManager/Register.Middleware.cs#L107-L107
Sorry, something went wrong.
No branches or pull requests
公众号管理 第一次编辑后,会执行一次全局注册。
如果是重启netcore 后, 再问一次公众号 就会出现,
Unhandled exception. Senparc.Weixin.Exceptions.UnRegisterAppIdException: 此appId(wx09c4a176ef1ec44d)尚未注册,请先使用AccessTokenContainer.Register完成注册(全局执行一次即可)!
需要增加判断 或者,每次启动的时候 自动注册公众号列表的内容,否则就要重新编辑保存一次 公众号。
在
protected virtual async Task AfterRunBotAsync(IServiceProvider serviceProvider, RequestMessageText requestMessage, MpAccountDto mpAccountDto, SenparcAiResult senparcAiResult, DateTimeOffset startTime) { Console.WriteLine("MpAccountDTO:" + mpAccountDto.ToJson(indented: true)); string resultMsg = $"{senparcAiResult.OutputString}\r\n -- AI 计算耗时:{SystemTime.DiffTotalMS(startTime)}毫秒"; Console.WriteLine("公众号客服消息2:" + resultMsg); WxJsonResult result = await CustomApi.SendTextAsync(mpAccountDto.AppId, requestMessage.FromUserName, resultMsg); await Console.Out.WriteLineAsync(result.ToJson()); }
的
await CustomApi.SendTextAsync(mpAccountDto.AppId, requestMessage.FromUserName, resultMsg);
我现在是放在 [MpMessageHandler("JeffreyMp")] 的构造函数中
// 检查 appId 是否已注册
if (!AccessTokenContainer.CheckRegistered(_mpAccountDto.AppId)) {
// 如果未注册,进行注册
AccessTokenContainer.Register(_mpAccountDto.AppId, _mpAccountDto.AppSecret);
}
The text was updated successfully, but these errors were encountered: