KKSU
2024-05-20 6c5b26120aad4fce252929b9ea7833acce90824c
滑点监控
1 files renamed
1 files copied
7 files modified
1 files added
146 ■■■■ changed files
src/main/java/cc/mrbird/febs/job/ChainHuaDianJob.java 32 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/job/ChainHuadianRunner.java 2 ●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/job/ChainJob.java 29 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/job/GiveMeMoneyJob.java 2 ●●● patch | view | raw | blame | history
src/main/resources/application-dev-chain.yml 6 ●●●● patch | view | raw | blame | history
src/main/resources/application-dev.yml 4 ●●●● patch | view | raw | blame | history
src/main/resources/application-prod-chain.yml 3 ●●●● patch | view | raw | blame | history
src/main/resources/application-prod-huadian.yml 64 ●●●●● patch | view | raw | blame | history
src/main/resources/application-prod.yml 2 ●●●●● patch | view | raw | blame | history
src/main/resources/application.yml 2 ●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/job/ChainHuaDianJob.java
copy from src/main/java/cc/mrbird/febs/job/ChainListenerJob.java copy to src/main/java/cc/mrbird/febs/job/ChainHuaDianJob.java
File was copied from src/main/java/cc/mrbird/febs/job/ChainListenerJob.java
@@ -15,9 +15,9 @@
@Slf4j
@Component
@ConditionalOnProperty(prefix = "system", name = "chain-listener", havingValue = "true")
@ConditionalOnProperty(prefix = "system", name = "huadian-transfer", havingValue = "true")
//public class ChainListenerJob implements ApplicationRunner {
public class ChainListenerJob{
public class ChainHuaDianJob {
    @Autowired
    private ContractEventService bscCoinContractEvent;
@@ -33,35 +33,7 @@
        log.info("最新区块更新");
        BigInteger blockNumber = ChainService.getInstance(ChainEnum.BSC_GFA.name()).blockNumber();
        redisUtils.set(AppContants.REDIS_KEY_BLOCK_ETH_NEWEST_NUM, blockNumber);
        redisUtils.set(AppContants.REDIS_KEY_BLOCK_ETH_NEWEST_NUM_HUA_DIAN, blockNumber);
    }
    @Scheduled(cron = "0/2 * * * * ? ")
    public void chainIncrementBlock() {
        Object newestBlockObj = redisUtils.get(AppContants.REDIS_KEY_BLOCK_ETH_NEWEST_NUM);
        BigInteger newestBlock;
        if (newestBlockObj == null) {
            newestBlock = ChainService.getInstance(ChainEnum.BSC_GFA.name()).blockNumber();
        } else {
            newestBlock = (BigInteger) newestBlockObj;
        }
        Object incrementObj = redisUtils.get(AppContants.REDIS_KEY_BLOCK_ETH_INCREMENT_NUM);
        BigInteger toIncrement;
        if (incrementObj == null) {
            toIncrement = newestBlock;
        } else {
            BigInteger incrementBlock = (BigInteger) incrementObj;
            // 最新区块小于增加区块
            if (newestBlock.compareTo(incrementBlock) <= 0) {
                return;
            }
            toIncrement = incrementBlock.add(BigInteger.ONE);
        }
        redisUtils.set(AppContants.REDIS_KEY_BLOCK_ETH_INCREMENT_NUM, toIncrement);
    }
    @Scheduled(cron = "0/2 * * * * ? ")
src/main/java/cc/mrbird/febs/job/ChainHuadianRunner.java
@@ -16,7 +16,7 @@
@Slf4j
@Component
@ConditionalOnProperty(prefix = "system", name = "chain-listener", havingValue = "true")
@ConditionalOnProperty(prefix = "system", name = "huadian-transfer", havingValue = "true")
public class ChainHuadianRunner implements ApplicationRunner {
src/main/java/cc/mrbird/febs/job/ChainJob.java
File was renamed from src/main/java/cc/mrbird/febs/job/ChainListenerJob.java
@@ -17,7 +17,7 @@
@Component
@ConditionalOnProperty(prefix = "system", name = "chain-listener", havingValue = "true")
//public class ChainListenerJob implements ApplicationRunner {
public class ChainListenerJob{
public class ChainJob {
    @Autowired
    private ContractEventService bscCoinContractEvent;
@@ -34,7 +34,6 @@
        BigInteger blockNumber = ChainService.getInstance(ChainEnum.BSC_GFA.name()).blockNumber();
        redisUtils.set(AppContants.REDIS_KEY_BLOCK_ETH_NEWEST_NUM, blockNumber);
        redisUtils.set(AppContants.REDIS_KEY_BLOCK_ETH_NEWEST_NUM_HUA_DIAN, blockNumber);
    }
    @Scheduled(cron = "0/2 * * * * ? ")
@@ -64,32 +63,6 @@
        redisUtils.set(AppContants.REDIS_KEY_BLOCK_ETH_INCREMENT_NUM, toIncrement);
    }
    @Scheduled(cron = "0/2 * * * * ? ")
    public void chainIncrementBlockHuaDian() {
        Object newestBlockObj = redisUtils.get(AppContants.REDIS_KEY_BLOCK_ETH_NEWEST_NUM_HUA_DIAN);
        BigInteger newestBlock;
        if (newestBlockObj == null) {
            newestBlock = ChainService.getInstance(ChainEnum.BSC_GFA.name()).blockNumber();
        } else {
            newestBlock = (BigInteger) newestBlockObj;
        }
        Object incrementObj = redisUtils.get(AppContants.REDIS_KEY_BLOCK_ETH_INCREMENT_NUM_HUA_DIAN);
        BigInteger toIncrement;
        if (incrementObj == null) {
            toIncrement = newestBlock;
        } else {
            BigInteger incrementBlock = (BigInteger) incrementObj;
            // 最新区块小于增加区块
            if (newestBlock.compareTo(incrementBlock) <= 0) {
                return;
            }
            toIncrement = incrementBlock.add(BigInteger.ONE);
        }
        redisUtils.set(AppContants.REDIS_KEY_BLOCK_ETH_INCREMENT_NUM_HUA_DIAN, toIncrement);
    }
//    @Override
//    public void run(ApplicationArguments args) throws Exception {
src/main/java/cc/mrbird/febs/job/GiveMeMoneyJob.java
@@ -24,7 +24,7 @@
 **/
@Slf4j
@Component
@ConditionalOnProperty(prefix = "system", name = "chain-listener", havingValue = "true")
@ConditionalOnProperty(prefix = "system", name = "trade-job", havingValue = "true")
public class GiveMeMoneyJob {
    @Autowired
src/main/resources/application-dev-chain.yml
@@ -2,7 +2,7 @@
  datasource:
    dynamic:
      # 是否开启 SQL日志输出,生产环境建议关闭,有性能损耗
      p6spy: true
      p6spy: false
      hikari:
        connection-timeout: 30000
        max-lifetime: 1800000
@@ -49,8 +49,8 @@
    publisher-confirm-type: correlated
system:
  online-transfer: false
  chain-listener: true
  huadian-transfer: true
  chain-listener: false
  trade-job: false
src/main/resources/application-dev.yml
@@ -2,7 +2,7 @@
  datasource:
    dynamic:
      # 是否开启 SQL日志输出,生产环境建议关闭,有性能损耗
      p6spy: true
      p6spy: false
      hikari:
        connection-timeout: 30000
        max-lifetime: 1800000
@@ -49,7 +49,7 @@
    publisher-confirm-type: correlated
system:
  online-transfer: false
  huadian-transfer: true
  chain-listener: false
  trade-job: false
src/main/resources/application-prod-chain.yml
@@ -52,9 +52,10 @@
    date-format: yyyy-MM-dd HH:mm:ss
    time-zone: GMT+9
system:
  huadian-transfer: false
  chain-listener: true
  trade-job: false
static:
  resource:
src/main/resources/application-prod-huadian.yml
New file
@@ -0,0 +1,64 @@
spring:
  datasource:
    dynamic:
      # 是否开启 SQL日志输出,生产环境建议关闭,有性能损耗
      p6spy: false
      hikari:
        connection-timeout: 30000
        max-lifetime: 1800000
        max-pool-size: 15
        min-idle: 5
        connection-test-query: select 1
        pool-name: FebsHikariCP
      # 配置默认数据源
      primary: base
      datasource:
        # 数据源-1,名称为 base
        base:
          username: db_tfc_meiao
          password: db_tfc_meiao!@#123
          driver-class-name: com.mysql.cj.jdbc.Driver
          url: jdbc:mysql://127.0.0.1:3306/db_tfc_meiao?useUnicode=true&characterEncoding=UTF-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2b9
  redis:
    # Redis数据库索引(默认为 0)
    database: 2
    # Redis服务器地址
    host: 127.0.0.1
    # Redis服务器连接端口
    port: 6379
    # Redis 密码
    password: 1234!@#$!QAZ
    lettuce:
      pool:
        # 连接池中的最小空闲连接
        min-idle: 8
        # 连接池中的最大空闲连接
        max-idle: 500
        # 连接池最大连接数(使用负值表示没有限制)
        max-active: 2000
        # 连接池最大阻塞等待时间(使用负值表示没有限制)
        max-wait: 10000
    # 连接超时时间(毫秒)
    timeout: 5000
  rabbitmq:
    host: 127.0.0.1
    port: 5672
    username: xc_rabbit
    password: xuncong123
    publisher-confirm-type: correlated
  jackson:
    date-format: yyyy-MM-dd HH:mm:ss
    time-zone: GMT+9
system:
  huadian-transfer: true
  chain-listener: false
  trade-job: false
static:
  resource:
    url: https://gfaindex.gfaweb3.com/uploadeFile/
    path: /home/javaweb/webresource/gfa/h5/uploadeFile/
src/main/resources/application-prod.yml
@@ -54,7 +54,9 @@
system:
  huadian-transfer: false
  chain-listener: false
  trade-job: true
static:
  resource:
src/main/resources/application.yml
@@ -5,7 +5,7 @@
spring:
  profiles:
    active: dev
    active: dev-chain
  thymeleaf:
    cache: false