| 
					
				 | 
			
			
				@@ -53,7 +53,7 @@ async function getTransfers(ctx) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         redis.redis_set(reids_token_config.LAST_TOTAL_BNB_FREE, tr.totalGasFree.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         redis.redis_set(reids_token_config.LAST_TOTAL_TOKEN_FREE, (parseInt(tr.gas_price) * parseInt(account_config.TOKEN_GAS_LIMIT)).toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     //提交归集任务 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     if (temp_obj.address) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         logger.log('pushCollectConisObj>>>', temp_obj.address) 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -92,6 +92,67 @@ async function getAllTokenWithdrawInfoLists(ctx) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     ctx.body = await moralis.getAllTokenWithdrawInfoLists(ctx); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+/** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ *  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * @param {鉴权版本} ctx  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+async function withdrawV2(ctx) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    if (ctx.request == null || ctx.request.body == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        ctx.body = utils.toJson(-1, null, "request error. "); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    const obj = ctx.request.body; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    var log_obj = { ...obj } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    // const encryptText = utils.encrypt(log_obj); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    const encryptText = log_obj.content; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    console.log("加密", encryptText); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    let decryptObj = utils.decrypt(encryptText); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        console.log("解密 before", decryptObj); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        decryptObj = JSON.parse(decryptObj); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        console.log("解密 json parse", decryptObj); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        await withdraw_(decryptObj).then(result => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            ctx.body = result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } catch (error) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        console.log("json error:", error); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        ctx.body = utils.toJson(-1,null,error.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+async function withdraw_(obj) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    console.log("withdraw_", obj); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    var log_obj = { ...obj } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    var info = await moralis.queryCompanyInfoFromId(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    log_obj.company_address_total_balance_before = await moralis.queryCollectBalance(info.user_address, obj.chain) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    log_obj.company_public_key = info.user_address 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    logger.log('withdraw log', log_obj); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    return new Promise((resolve) => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        moralis.withdraw(obj).then((result) => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (moralis.isTransferSucceed(result)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                //提币日志上报 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                log_obj.results = result 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                log_obj.type = report.REPORT_TYPE.withdraw 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                //缓存当前交易的 gas 费用 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (result && log_obj.contractAddress) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    var tr = moralis.getTransferGasFree('token', result) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    log_obj.withdrawTotalGasFee = tr.totalGasFree.toString() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    var tr = moralis.getTransferGasFree('native', ret) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    log_obj.withdrawTotalGasFee = tr.totalGasFree.toString() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                // log_obj.receiver_address_total_balance_after = await queryCollectBalance(info.user_address, utils.getChainName(obj.chain)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                //日志上报 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                report.logReport(log_obj) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            resolve(result) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 //出金 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 async function withdraw(ctx) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     if (ctx.request == null || ctx.request.body == null) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -103,7 +164,7 @@ async function withdraw(ctx) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     var info = await moralis.queryCompanyInfoFromId(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     log_obj.company_address_total_balance_before = await moralis.queryCollectBalance(info.user_address, obj.chain) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     log_obj.company_public_key = info.user_address 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    logger.log('withdraw log', log_obj); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    logger.log('withdraw log', log_obj,obj); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     await moralis.withdraw(obj).then((result) => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         ctx.body = result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (moralis.isTransferSucceed(result)) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -124,7 +185,6 @@ async function withdraw(ctx) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //日志上报 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             report.logReport(log_obj) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -139,6 +199,8 @@ router.post('/getAllTotkenPrice', getAllTotkenPrice) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 // router.post('/transfer', transfer) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 //提现 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 router.post('/withdraw', withdraw); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//提现 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+router.post('/withdrawV2', withdrawV2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 //获取所有地址的所要消耗的最低提取费 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 router.post('/getAllTokenWithdrawInfoLists', getAllTokenWithdrawInfoLists) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 |