1
This commit is contained in:
parent
7b9823531c
commit
4d2538531f
@ -407,8 +407,6 @@ DROP TABLE IF EXISTS `t_webhook_event`;
|
|||||||
/*!40101 SET character_set_client = utf8 */;
|
/*!40101 SET character_set_client = utf8 */;
|
||||||
CREATE TABLE `t_webhook_event` (
|
CREATE TABLE `t_webhook_event` (
|
||||||
`idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
`idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
||||||
`message_type` varchar(255) NOT NULL DEFAULT '' COMMENT 'message_type',
|
|
||||||
`message_id` varchar(255) NOT NULL DEFAULT '' COMMENT 'message_id',
|
|
||||||
`event_name` varchar(255) NOT NULL DEFAULT '' COMMENT 'event_name',
|
`event_name` varchar(255) NOT NULL DEFAULT '' COMMENT 'event_name',
|
||||||
`event_id` varchar(255) NOT NULL DEFAULT '' COMMENT 'event_id',
|
`event_id` varchar(255) NOT NULL DEFAULT '' COMMENT 'event_id',
|
||||||
`chain` varchar(255) NOT NULL DEFAULT '' COMMENT 'chain',
|
`chain` varchar(255) NOT NULL DEFAULT '' COMMENT 'chain',
|
||||||
@ -419,8 +417,6 @@ CREATE TABLE `t_webhook_event` (
|
|||||||
UNIQUE KEY `event_id` (`event_id`),
|
UNIQUE KEY `event_id` (`event_id`),
|
||||||
KEY `idx_event_name` (`event_name`),
|
KEY `idx_event_name` (`event_name`),
|
||||||
KEY `idx_chain` (`chain`),
|
KEY `idx_chain` (`chain`),
|
||||||
KEY `idx_message_id` (`message_id`),
|
|
||||||
KEY `idx_message_type` (`message_type`),
|
|
||||||
KEY `idx_event_name_chain` (`event_name`, `chain`)
|
KEY `idx_event_name_chain` (`event_name`, `chain`)
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||||
|
@ -12,18 +12,17 @@ async function procEvent(req, rsp) {
|
|||||||
async function webhooks(req, rsp) {
|
async function webhooks(req, rsp) {
|
||||||
console.log(req.body);
|
console.log(req.body);
|
||||||
|
|
||||||
|
const events = [];
|
||||||
await webhook.handle( // this method will handle the subscription confirmation and signature & sender verification
|
await webhook.handle( // this method will handle the subscription confirmation and signature & sender verification
|
||||||
req.body,
|
req.body,
|
||||||
config.Environment.SANDBOX, // or config.Environment.PRODUCTION
|
config.Environment.SANDBOX, // or config.Environment.PRODUCTION
|
||||||
{
|
{
|
||||||
all: (event) => { // all events will trigger this handler, even if they have a specific handler already.
|
all: (event) => { // all events will trigger this handler, even if they have a specific handler already.
|
||||||
console.log(111111, event);
|
events.push(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
rsp.send(utils.jsonEncode({"status": "ok"}));
|
|
||||||
/*
|
|
||||||
const idx = 0;
|
const idx = 0;
|
||||||
const dbKey = 'BcEventDb' + idx;
|
const dbKey = 'BcEventDb' + idx;
|
||||||
const {err, conn} = await app.getDbConn(dbKey);
|
const {err, conn} = await app.getDbConn(dbKey);
|
||||||
@ -34,8 +33,6 @@ async function webhooks(req, rsp) {
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
const body = req.body;
|
const body = req.body;
|
||||||
const messageType = body.Type;
|
|
||||||
const messageId = body.MessageId;
|
|
||||||
const eventName = body.Message.event_name;
|
const eventName = body.Message.event_name;
|
||||||
const eventId = body.Message.event_id;
|
const eventId = body.Message.event_id;
|
||||||
const chain = body.Message.chain;
|
const chain = body.Message.chain;
|
||||||
@ -46,8 +43,6 @@ async function webhooks(req, rsp) {
|
|||||||
],
|
],
|
||||||
[],
|
[],
|
||||||
[
|
[
|
||||||
['message_type', messageType],
|
|
||||||
['message_id', messageId],
|
|
||||||
['event_name', eventName],
|
['event_name', eventName],
|
||||||
['event_id', eventId],
|
['event_id', eventId],
|
||||||
['chain', chain],
|
['chain', chain],
|
||||||
@ -61,7 +56,6 @@ async function webhooks(req, rsp) {
|
|||||||
} finally {
|
} finally {
|
||||||
conn.release();
|
conn.release();
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user