diff --git a/modules/entry/back/methods/entry/cloneEntry.js b/modules/entry/back/methods/entry/cloneEntry.js index 24a2f7a75c..fa4b479060 100644 --- a/modules/entry/back/methods/entry/cloneEntry.js +++ b/modules/entry/back/methods/entry/cloneEntry.js @@ -24,7 +24,6 @@ module.exports = Self => { const userId = ctx.req.accessToken.userId; const myOptions = {userId}; let tx; - let result; if (typeof options == 'object') Object.assign(myOptions, options); @@ -32,12 +31,13 @@ module.exports = Self => { tx = await Self.beginTransaction({}); myOptions.transaction = tx; } - try { - result = await Self.rawSql('CALL entry_clone(?)', [id], myOptions); + await Self.rawSql('CALL entry_clone(?, @newEntryId)', [id], myOptions); + const result = await Self.rawSql('SELECT @newEntryId', [], myOptions); + const newEntryId = result[0]['@newEntryId']; if (tx) await tx.commit(); - return result[0]; + return newEntryId; } catch (e) { if (tx) await tx.rollback(); throw e;