1
This commit is contained in:
parent
9bd1a9c446
commit
b760238c2f
@ -184,6 +184,10 @@ class BoxOrder {
|
||||
return err;
|
||||
}
|
||||
|
||||
getOrderDb() {
|
||||
return this.orderDb;
|
||||
}
|
||||
|
||||
getOrderId() {
|
||||
return this.orderDb['order_id'];
|
||||
}
|
||||
|
@ -9,12 +9,11 @@ class BoxRepairer {
|
||||
|
||||
constructor(boxOrder) {
|
||||
this.boxOrder = boxOrder;
|
||||
this.orderDb = boxOrder.orderDb;
|
||||
}
|
||||
|
||||
async repairPaidOrder() {
|
||||
await this.internalRepairPaidOrder();
|
||||
ordermgr.removePendingOrder(this.getOrderId());
|
||||
ordermgr.removePendingOrder(this.boxOrder.getOrderId());
|
||||
}
|
||||
|
||||
async internalRepairPaidOrder() {
|
||||
@ -23,7 +22,7 @@ class BoxRepairer {
|
||||
if (err || !boxDb) {
|
||||
utils.throwError(util.format('%s box not found orderDb:%s err:%s',
|
||||
logClass,
|
||||
JSON.stringify(this.orderDb),
|
||||
JSON.stringify(this.boxOrder.getOrderDb()),
|
||||
err
|
||||
)
|
||||
);
|
||||
@ -32,21 +31,21 @@ class BoxRepairer {
|
||||
|
||||
log.info(util.format('%s begin orderDb:%s boxDb:%s',
|
||||
logClass,
|
||||
JSON.stringify(this.orderDb),
|
||||
JSON.stringify(this.boxOrder.getOrderDb()),
|
||||
JSON.stringify(boxDb)
|
||||
)
|
||||
);
|
||||
if (boxDb['state'] == C.BOX_STATE_PAID) {
|
||||
await this.setDone(logClass);
|
||||
await this.boxOrder.setDone(logClass);
|
||||
} else {
|
||||
let err = await this.setBoxPaidState(logClass, boxDb);
|
||||
let err = await this.boxOrder.setBoxPaidState(logClass, boxDb);
|
||||
if (!err) {
|
||||
await this.setDone(logClass);
|
||||
await this.boxOrder.setDone(logClass);
|
||||
}
|
||||
}
|
||||
log.info(util.format('%s end orderDb:%s boxDb:%s',
|
||||
logClass,
|
||||
JSON.stringify(this.orderDb),
|
||||
JSON.stringify(this.boxOrder.getOrderDb()),
|
||||
JSON.stringify(boxDb)
|
||||
)
|
||||
);
|
||||
@ -54,7 +53,7 @@ class BoxRepairer {
|
||||
|
||||
async repairExpiredOrder() {
|
||||
await this.internalRepairExpiredOrder();
|
||||
ordermgr.removePendingOrder(this.getOrderId());
|
||||
ordermgr.removePendingOrder(this.boxOrder.getOrderId());
|
||||
}
|
||||
|
||||
async internalRepairExpiredOrder() {
|
||||
@ -63,7 +62,7 @@ class BoxRepairer {
|
||||
if (err || !boxDb) {
|
||||
log.warning(util.format('%s box not found orderDb:%s err:%s',
|
||||
logClass,
|
||||
JSON.stringify(this.orderDb),
|
||||
JSON.stringify(this.boxOrder.getOrderDb()),
|
||||
err
|
||||
)
|
||||
);
|
||||
@ -72,20 +71,20 @@ class BoxRepairer {
|
||||
|
||||
log.info(util.format('%s begin orderDb:%s boxDb:%s',
|
||||
logClass,
|
||||
JSON.stringify(this.orderDb),
|
||||
JSON.stringify(this.boxOrder.getOrderDb()),
|
||||
JSON.stringify(boxDb)
|
||||
));
|
||||
if (!boxDb['order_valid']) {
|
||||
await this.setDone(logClass);
|
||||
await this.boxOrder.setDone(logClass);
|
||||
} else {
|
||||
let err = await this.setBoxOrderInvalid(logClass, boxDb);
|
||||
let err = await this.boxOrder.setBoxOrderInvalid(logClass, boxDb);
|
||||
if (!err) {
|
||||
await this.setDone(logClass);
|
||||
await this.boxOrder.setDone(logClass);
|
||||
}
|
||||
}
|
||||
log.info(util.format('%s end orderDb:%s boxDb:%s',
|
||||
logClass,
|
||||
JSON.stringify(this.orderDb),
|
||||
JSON.stringify(this.boxOrder.getOrderDb()),
|
||||
JSON.stringify(boxDb)
|
||||
)
|
||||
);
|
||||
@ -93,7 +92,7 @@ class BoxRepairer {
|
||||
|
||||
async repairFailOrder() {
|
||||
await this.internalRepairFailOrder();
|
||||
ordermgr.removePendingOrder(this.getOrderId());
|
||||
ordermgr.removePendingOrder(this.boxOrder.getOrderId());
|
||||
}
|
||||
|
||||
async internalRepairFailOrder() {
|
||||
@ -102,7 +101,7 @@ class BoxRepairer {
|
||||
if (err || !boxDb) {
|
||||
log.warning(util.format('%s box not found orderDb:%s err:%s',
|
||||
logClass,
|
||||
JSON.stringify(this.orderDb),
|
||||
JSON.stringify(this.boxOrder.getOrderDb()),
|
||||
err
|
||||
));
|
||||
return;
|
||||
@ -110,21 +109,21 @@ class BoxRepairer {
|
||||
|
||||
log.info(util.format('%s begin orderDb:%s boxDb:%s',
|
||||
logClass,
|
||||
JSON.stringify(this.orderDb),
|
||||
JSON.stringify(this.boxOrder.getOrderDb()),
|
||||
JSON.stringify(boxDb)
|
||||
)
|
||||
);
|
||||
if (!boxDb['order_valid']) {
|
||||
await this.setDone(logClass);
|
||||
await this.boxOrder.setDone(logClass);
|
||||
} else {
|
||||
let err = await this.setBoxOrderInvalid(logClass, boxDb);
|
||||
let err = await this.boxOrder.setBoxOrderInvalid(logClass, boxDb);
|
||||
if (!err) {
|
||||
await this.setDone(logClass);
|
||||
await this.boxOrder.setDone(logClass);
|
||||
}
|
||||
}
|
||||
log.info(util.format('%s end orderDb:%s boxDb:%s',
|
||||
logClass,
|
||||
JSON.stringify(this.orderDb),
|
||||
JSON.stringify(this.boxOrder.getOrderDb()),
|
||||
JSON.stringify(boxDb)
|
||||
)
|
||||
);
|
||||
|
Loading…
x
Reference in New Issue
Block a user