sequelize事务失败并引发错误

时间:2018-09-08 08:41:52

标签: node.js sequelize.js

我的代码如下所示:

DowngradeModule

但是以某种方式给我错误:

const testMethod = (x, y, isZ) => { return new Promise((resolve, reject) => { return db.sequelize.transaction((t) => { db.wallet.find({where: {id: x}}).then((info) => { if (isZ) { info.test_balance = (parseFloat(info.test_balance) - parseFloat(y)).toFixed(2); } else { info.test_balance = (parseFloat(info.test_balance) + parseFloat(y)).toFixed(2); } info.save({transaction: t, autocommit: false}).then((updatedInfo) => { t.commit(); resolve(); } ).catch((err) => { t.rollback(); reject(); }); }).catch((err) => { reject(); }); }); }); };

0 个答案:

没有答案
相关问题