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 () => { const doSync = async () => {
let result = null; let result = null;
try { 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( result = await bc.mallInstance.methods.payForBoxWithSignature(
this.orderDb['order_id'], this.orderDb['order_id'],
this.orderDb['type'], this.orderDb['type'],
@ -127,12 +131,19 @@ class BoxOrder {
this.orderDb['payment_token_address'], this.orderDb['payment_token_address'],
this.orderDb['nonce'], this.orderDb['nonce'],
this.orderDb['signature']).send({gas: 1000000}); this.orderDb['signature']).send({gas: 1000000});
dblog.addLog('order.sync', 'success', dblog.addLog(
this.getOrderId(), 'order.sync',
utils.jsonEncode(this.getOrderDb()), 'success',
utils.jsonEncode(result)); this.getOrderId(),
utils.jsonEncode(this.getOrderDb()),
utils.jsonEncode(result));
} catch (err) { } 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( await this.updateDbMustBeSuccess(
logClass, 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); const {err, rows} = await execQuery(sql, params);
return { return {
'err': err, 'err': err,
@ -71,5 +71,5 @@ async function execScript(sql, params) {
} }
exports.execQuery = execQuery; exports.execQuery = execQuery;
exports.execOneQuery = execOneQuery; exports.execQueryOne = execQueryOne;
exports.execScript = execScript; exports.execScript = execScript;

View File

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