当前位置:网站首页>小程序消息推送配置 Token校验失败,请检查确认
小程序消息推送配置 Token校验失败,请检查确认
2022-07-27 06:56:00 【天马3798】
一、小程序消息推送配置 Token校验失败,请检查确认
添加配置失败,原因
只要是没有echostr原样返回,就会报错;
注意,返回的事echostr的内容,而不是key=value格式
示例如下:
return Content(reqData.echostr);二、小程序消息推送配置 校验强调
1.保证自己的代码没有bug
2.微信服务器校验请求
请求参数:请求报文内容是空字符串
3. 获取微信请求后的响应
响应参数:请原样返回 echostr 参数内容,则接入生效,成为开发者成功,否则接入失败
示例代码:
public IActionResult Callback()
{
try
{
using (StreamReader sr = new StreamReader(Request.Body, Encoding.UTF8))
{
//LogHelper.Info("接受事件回调处理");
string content = sr.ReadToEndAsync().Result;//验证请求发送的内容围攻
LogHelper.Info(content);
//解密处理
EventManage.ReqData reqData = new EventManage.ReqData();
reqData.signature = Request.Query["signature"];
reqData.timestamp = Request.Query["timestamp"];
reqData.nonce = Request.Query["nonce"];
reqData.echostr = Request.Query["echostr"];
EventManage _event = new EventManage();
_event.reqData = reqData;
var eventOrder = _event.LoadData(content);
if (string.IsNullOrEmpty(reqData.postdata))
return Content(reqData.echostr);
LogHelper.Info("处理的单号:"+eventOrder.Order_Info.Trade_No);
//逻辑处理,修改订单状态,充值到账,发奖处理
RechargeRecordOperate _rechange = new RechargeRecordOperate();
_rechange.CallBack(eventOrder.Order_Info.Trade_No);
return Json(_event.Success());
}
}
catch (Exception ex)
{
LogHelper.Debug("小程序消息回调,报错:", ex);
return Error(ex);
}
}注意这几个基本就没问题了。
更多:
微信小程序保存视频到相册wx.saveVideoToPhotosAlbum()
wx.scanCode(Object object)使用详解
微信小程序录音接口使用整理-RecorderManager
边栏推荐
- 网络入门——vlan及trunk概述
- C language implementation of guessing numbers Games project practice (based on srand function, rand function, switch statement, while loop, if condition criterion, etc.)
- Basic functions and collections of guava
- Regular expression foundation sorting
- yhb_ sysbench
- Using docker in MAC to build Oracle database server
- C语言实现猜数字小游戏项目实战(基于srand函数、rand函数,Switch语句、while循环、if条件判据等)
- 在mac中使用docker来搭建oracle数据库服务器
- 单片机多级菜单
- 安装tensorflow
猜你喜欢

Bash: create a function that returns a Boolean value

单臂路由(讲解+实验)

Graylog 日志服务器单节点部署

闭散列和开散列解决哈希冲突

Properties类和properties配置文件的理解学习

(2022 Hangdian multi school III) 1011.taxi (Manhattan maximum + 2 points)

(2022 Niuke multi school III) j-journey (Dijkstra)

Codeforces Round #810 (Div.2) A-C

C common function integration-2

Record a pit dug by yourself~
随机推荐
帮忙发一份招聘,base全国,有兴趣的可以过来看看
Regular expression foundation sorting
functools模块
Am I delayed by the code... Unfortunately, I became a programmer
Error when connecting to MySQL: public key retrieval is not allowed [solution]
VLAN trunk experiment
Use the PIP command to switch between different mirror sources
漏风的小棉袄……
Oracle cleans up the Database disk space of tables with referenced partitions
C common function integration-3
Perl: split the external command to be executed into multiple lines
Routing between VLANs (explanation + verification)
SQLite common function integration
2022 0726 Gu Yujia's study notes
C common function integration-2
Chapter 6 Shell Logic and Arithmetic
【WSL2】配置连接 USB 设备并使用主机的 USB 摄像头
vlan间路由(讲解+验证)
Help send a recruitment, base all over the country. If you are interested, you can come and have a look
Okaleido tiger is about to log in to binance NFT in the second round, which has aroused heated discussion in the community