获取链上信息兼容
This commit is contained in:
1 parent
ceb8807273
commit
2601bc898a
8 files changed
+412
-103
No files matched your search
@@ -1,6 +1,5 @@
|
||||
package com.ruoyi.task;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
@@ -8,13 +7,13 @@ import com.ruoyi.system.domain.UsdtOrdersPlus;
|
||||
import com.ruoyi.system.service.ITronService;
|
||||
import com.ruoyi.system.service.IUsdtOrdersService;
|
||||
import com.ruoyi.system.service.TronServiceProvider;
|
||||
import com.ruoyi.system.service.TronChainDataClient;
|
||||
import com.ruoyi.system.service.WalletLedgerPostingService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
@@ -36,7 +35,8 @@ public class TronPaymentTask {
|
||||
private TronServiceProvider tronServiceProvider;
|
||||
@Autowired
|
||||
private WalletLedgerPostingService ledgerPostingService;
|
||||
private final RestTemplate http = new RestTemplate();
|
||||
@Autowired
|
||||
private TronChainDataClient chainDataClient;
|
||||
|
||||
@Scheduled(fixedDelay = 10000L)
|
||||
public void scan() {
|
||||
@@ -53,10 +53,8 @@ public class TronPaymentTask {
|
||||
.or().eq(UsdtOrdersPlus::getBlockTransactionId, "")))) {
|
||||
if (order.getToken() == null || order.getActualAmount() == null) continue;
|
||||
try {
|
||||
String url = tron.tronscanApiUrl() + "/v1/accounts/" + order.getToken() + "/transactions/trc20?limit=200&only_confirmed=true&contract_address=" + tron.contractAddress();
|
||||
JSONObject root = JSON.parseObject(http.getForObject(url, String.class));
|
||||
JSONArray data = root == null ? null : root.getJSONArray("data");
|
||||
if (data == null) continue;
|
||||
JSONArray data = chainDataClient.queryConfirmedTrc20Transactions(
|
||||
tron, order.getToken(), 200);
|
||||
for (int i = 0; i < data.size(); i++) {
|
||||
JSONObject tx = data.getJSONObject(i);
|
||||
if (!order.getToken().equals(tx.getString("to"))) continue;
|
||||
|
||||
Reference in new issue
Block a user