xiaoyong931011
2021-05-12 f1ad6e801cc68cfe90efb620df3484293044aea3
Merge branch 'yunding' of http://120.27.238.55:7000/r/exchange into yunding
2 files modified
13 ■■■■ changed files
src/main/java/com/xcong/excoin/quartz/job/XchBaseDataUpdateJob.java 9 ●●●●● patch | view | raw | blame | history
src/main/resources/application.yml 4 ●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/quartz/job/XchBaseDataUpdateJob.java
@@ -41,8 +41,11 @@
        String result = getUrlResponse("https://api2.chiaexplorer.com/blockchainSummary");
        // 每t预计收益
        String profitPerT = getUrlResponse("https://api2.chiaexplorer.com/chart/xchTibDay?period=2w");
        String xchPrice24HStr = getUrlResponse("https://api2.chiaexplorer.com/chart/xchPriceChart?period=24h");
        JSONObject jsonObject = (JSONObject) JSONObject.parse(result);
        JSONObject perTObject = (JSONObject) JSONObject.parse(profitPerT);
        JSONObject xchPrice24HObj = (JSONObject) JSONObject.parse(xchPrice24HStr);
        List<YdBasicSettingEntity> list = ydBasicSettingDao.selectList(null);
        if (CollUtil.isNotEmpty(list)) {
            YdBasicSettingEntity settingEntity = list.get(0);
@@ -54,6 +57,12 @@
            BigDecimal newPrice = new BigDecimal(jsonObject.getString("price"));
            redisUtils.set("XCH_NEW_PRICE", newPrice);
            settingEntity.setCurrentPrice(newPrice);
            List<String> xchPrice24H = JSONObject.parseArray(xchPrice24HObj.getString("data"), String.class);
            BigDecimal newestPrice = new BigDecimal(xchPrice24H.get(xchPrice24H.size() - 1));
            BigDecimal lastPrice = new BigDecimal(xchPrice24H.get(xchPrice24H.size() - 1 -24));
            BigDecimal upOrDown = newestPrice.subtract(lastPrice).multiply(BigDecimal.valueOf(100)).divide(lastPrice, 2, BigDecimal.ROUND_HALF_UP);
            redisUtils.set("XCH_UP_DOWN", upOrDown);
            List<String> data = JSONObject.parseArray(perTObject.getString("data"), String.class);
            settingEntity.setPrifitT(new BigDecimal(data.get(0)));
            settingEntity.setProfitDay(new BigDecimal(data.get(0)).multiply(BigDecimal.valueOf(1024)));
src/main/resources/application.yml
@@ -51,7 +51,7 @@
  ## redis配置
  redis:
    ## Redis数据库索引(默认为0)
    database: 0
    database: 3
    ## Redis服务器地址
    host: 121.37.162.173
    ## Redis服务器连接端口
@@ -107,7 +107,7 @@
  loop-job: false
  rabbit-consumer: false
  block-job: false
  xch-job: false
  xch-job: true
aliyun:
  oss: