This commit is contained in:
aozhiwei 2022-02-09 17:16:46 +08:00
parent c494e2fa64
commit 7ea7e6154b
3 changed files with 20 additions and 9 deletions

View File

@ -118,7 +118,11 @@ class BoxOrder {
const doSync = async () => {
let result = null;
try {
dblog.addLog('order.sync', 'prepare', this.getOrderId(), utils.jsonEncode(this.getOrderDb()));
dblog.addLog(
'order.sync',
'prepare',
this.getOrderId(),
utils.jsonEncode(this.getOrderDb()));
result = await bc.mallInstance.methods.payForBoxWithSignature(
this.orderDb['order_id'],
this.orderDb['type'],
@ -127,12 +131,19 @@ class BoxOrder {
this.orderDb['payment_token_address'],
this.orderDb['nonce'],
this.orderDb['signature']).send({gas: 1000000});
dblog.addLog('order.sync', 'success',
this.getOrderId(),
utils.jsonEncode(this.getOrderDb()),
utils.jsonEncode(result));
dblog.addLog(
'order.sync',
'success',
this.getOrderId(),
utils.jsonEncode(this.getOrderDb()),
utils.jsonEncode(result));
} catch (err) {
dblog.addLog('order.sync', 'failed', this.getOrderId(), utils.jsonEncode(this.getOrderDb()), err);
dblog.addLog(
'order.sync',
'failed',
this.getOrderId(),
utils.jsonEncode(this.getOrderDb()),
err);
await this.updateDbMustBeSuccess(
logClass,
[

View File

@ -57,7 +57,7 @@ function execQuery(sql, params) {
});
}
async function execOneQuery(sql, params) {
async function execQueryOne(sql, params) {
const {err, rows} = await execQuery(sql, params);
return {
'err': err,
@ -71,5 +71,5 @@ async function execScript(sql, params) {
}
exports.execQuery = execQuery;
exports.execOneQuery = execOneQuery;
exports.execQueryOne = execQueryOne;
exports.execScript = execScript;

View File

@ -24,7 +24,7 @@ class OrderMgr {
}
async start() {
const {err, row} = await db.execOneQuery(
const {err, row} = await db.execQueryOne(
'SELECT max(idx) max_idx FROM t_box_order', []);
if (err) {
throw err;