|
@@ -122,7 +122,14 @@ async function withdraw_task() {
|
|
|
} else {
|
|
|
var update_obj = {}
|
|
|
update_obj.withdraw_status = 3
|
|
|
- update_obj.errorMsg = result
|
|
|
+ if (typeof result === 'string') {
|
|
|
+ try {
|
|
|
+ result = JSON.parse(result)
|
|
|
+ update_obj.errorMsg = result.errMsg
|
|
|
+ } catch (error) {
|
|
|
+ logger.error('withdraw_task=', result)
|
|
|
+ }
|
|
|
+ }
|
|
|
await withdraw_db.update_withdraw_task(exec_obj.withdraw_id, update_obj)
|
|
|
}
|
|
|
} catch (error) {
|
|
@@ -213,26 +220,6 @@ async function withdrawV2(ctx) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-function loop_test() {
|
|
|
- var obj = {
|
|
|
- type: "erc20",
|
|
|
- contractAddress: "0x03716F32f72c692a0B355fa04639669E3341B94e",
|
|
|
- amount: "112000000000000000000",
|
|
|
- chain: "bsc_testnet",
|
|
|
- receiver: "0x7C7401fcc82D1e53C4090561c3e6fde80d74e317"
|
|
|
- }
|
|
|
-
|
|
|
- var obj2 = {
|
|
|
- type: "erc20",
|
|
|
- contractAddress: "0x03716F32f72c692a0B355fa04639669E3341B94e",
|
|
|
- amount: "113000000000000000000",
|
|
|
- chain: "bsc_testnet",
|
|
|
- receiver: "0x741050F44196Ad4b427AC5E97beB7715FD0127E7"
|
|
|
- }
|
|
|
- withdraw_(obj)
|
|
|
- withdraw_(obj2)
|
|
|
-}
|
|
|
-
|
|
|
async function withdraw_(obj) {
|
|
|
console.log("withdraw_", obj);
|
|
|
var log_obj = { ...obj }
|
|
@@ -285,7 +272,7 @@ async function getWithdrawStatus(ctx) {
|
|
|
return
|
|
|
}
|
|
|
const obj = ctx.request.body;
|
|
|
- var info = await withdraw_db.queryWithdrawInfoFromWithdrawId(obj.withdraw_id)
|
|
|
+ var info = await withdraw_db.queryWithdrawInfoFromWithdrawId(obj.withdrawId)
|
|
|
logger.log('getWithdrawStatus info', JSON.stringify(info))
|
|
|
if (info) {
|
|
|
// try {
|
|
@@ -304,13 +291,17 @@ async function getWithdrawStatus(ctx) {
|
|
|
// } catch (error) {
|
|
|
// logger.error('getWithdrawStatus getTokenTransfers error', error)
|
|
|
// }
|
|
|
- ctx.body = utils.toJson(0, {
|
|
|
- withdrawId: info.withdraw_id,
|
|
|
- withdrawStatus: info.withdraw_status,
|
|
|
- withdrawHash: info.withdraw_hash,
|
|
|
- chainId: info.chain_id,
|
|
|
- transferTimestamp: info.update_time,
|
|
|
- }, null)
|
|
|
+ if (info.withdraw_status != 3) {
|
|
|
+ ctx.body = utils.toJson(0, {
|
|
|
+ withdrawId: info.withdraw_id,
|
|
|
+ withdrawStatus: info.withdraw_status,
|
|
|
+ withdrawHash: info.withdraw_hash,
|
|
|
+ chainId: info.chain_id,
|
|
|
+ transferTimestamp: info.update_time,
|
|
|
+ }, null)
|
|
|
+ } else {
|
|
|
+ ctx.body = utils.toJson(-1, null, info.errorMsg)
|
|
|
+ }
|
|
|
} else {
|
|
|
ctx.body = utils.toJson(-1, null, obj.withdraw_id + ' id does not exist.')
|
|
|
}
|