1
This commit is contained in:
parent
196609930d
commit
0fe917bf6e
@ -5,6 +5,7 @@ const utils = require('j7/utils');
|
|||||||
const http = require('j7/http');
|
const http = require('j7/http');
|
||||||
const config = require('j7/config');
|
const config = require('j7/config');
|
||||||
const constant = require('common/constant');
|
const constant = require('common/constant');
|
||||||
|
const dbpool = require('common/dbpool');
|
||||||
const metaFactory = require('../../../metadata/factory');
|
const metaFactory = require('../../../metadata/factory');
|
||||||
|
|
||||||
class BaseEventProcess {
|
class BaseEventProcess {
|
||||||
@ -102,16 +103,45 @@ class BaseEventProcess {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
genCbUuid() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
async callGameApi(params, checkCb) {
|
async callGameApi(params, checkCb) {
|
||||||
while (true) {
|
while (true) {
|
||||||
try {
|
try {
|
||||||
const nowTime = utils.getUtcTime();
|
const nowTime = utils.getUtcTime();
|
||||||
|
const cbUuid = this.genCbUuid();
|
||||||
|
const secretKey = '';
|
||||||
|
{
|
||||||
|
params['_cb_uuid'] = cbUuid;
|
||||||
params['_timestamp'] = nowTime;
|
params['_timestamp'] = nowTime;
|
||||||
delete params['_sign'];
|
delete params['_sign'];
|
||||||
params['_sign'] = utils.normalMd5UrlSign(params, config('cb_secret_key'));
|
}
|
||||||
|
const sign = utils.normalMd5UrlSign(params, secretKey);
|
||||||
|
params['_sign'] = sign;
|
||||||
|
{
|
||||||
|
const {err} = await dbpool.execBcNftConn
|
||||||
|
(
|
||||||
|
app,
|
||||||
|
'insert',
|
||||||
|
[
|
||||||
|
['cb_uuid', cbUuid],
|
||||||
|
['params', utils.jsonEncode(params)],
|
||||||
|
['signature', sign],
|
||||||
|
['secret_key', secretKey],
|
||||||
|
['createtime', nowTime],
|
||||||
|
['modifytime', nowTime]
|
||||||
|
]
|
||||||
|
);
|
||||||
|
if (err) {
|
||||||
|
await utils.sleep(5000 + utils.randRange(500, 1500));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
const {err, data} = await http.get(config('gameapi_url'), params);
|
const {err, data} = await http.get(config('gameapi_url'), params);
|
||||||
if (err) {
|
if (err) {
|
||||||
await utils.sleep(3000 + utils.randRange(500, 1500));
|
await utils.sleep(5000 + utils.randRange(500, 1500));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
const ret = await checkCb(data);
|
const ret = await checkCb(data);
|
||||||
@ -122,7 +152,7 @@ class BaseEventProcess {
|
|||||||
utils.safeDumpErrStack(e);
|
utils.safeDumpErrStack(e);
|
||||||
log.error(e);
|
log.error(e);
|
||||||
}
|
}
|
||||||
await utils.sleep(3000 + utils.randRange(500, 1500));
|
await utils.sleep(5000 + utils.randRange(500, 1500));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user