Forráskód Böngészése

按照中国时间进行数据更新

DevYK 2 éve
szülő
commit
c8c785864a
3 módosított fájl, 32 hozzáadás és 28 törlés
  1. 23 23
      config/dev_config.js
  2. 0 1
      model/moralis_sdk.js
  3. 9 4
      model/server_data_statistics.js

+ 23 - 23
config/dev_config.js

@@ -47,26 +47,6 @@ const http_log_report_config = {
 // 设置数据库配置文件
 const db_config = {
     // 数据库配置
-    mysql: {
-        DATABASE: 'denet_chain',   //数据库名称
-        DATABASE_MY_NODE: 'bnb_block_sync',   //自建 node 存储
-        TABLENAME: 'user_key_manage',   //表名
-        USERNAME: 'denet',   //用户名
-        PASSWORD: 'cyber#Together_2022', //密码
-        PORT: '3306', //连接的端口
-        HOST: 'denet-test.csi2lctklqzg.us-east-1.rds.amazonaws.com', //host
-        OPEN_POOL: true,
-        POOL_SIZE: 5,
-    },
-
-    redis: {
-        PORT: 6379, // Redis port
-        HOST: "denet-test.y2slbl.clustercfg.memorydb.us-east-1.amazonaws.com", // Redis host
-        USERNAME: null, // needs Redis >= 6
-        PASSWORD: null,
-    },
-
-    // 线上数据库配置
     // mysql: {
     //     DATABASE: 'denet_chain',   //数据库名称
     //     DATABASE_MY_NODE: 'bnb_block_sync',   //自建 node 存储
@@ -74,17 +54,37 @@ const db_config = {
     //     USERNAME: 'denet',   //用户名
     //     PASSWORD: 'cyber#Together_2022', //密码
     //     PORT: '3306', //连接的端口
-    //     HOST: 'denet-chain-prod.csi2lctklqzg.us-east-1.rds.amazonaws.com', //host
+    //     HOST: 'denet-test.csi2lctklqzg.us-east-1.rds.amazonaws.com', //host
     //     OPEN_POOL: true,
     //     POOL_SIZE: 5,
     // },
 
     // redis: {
     //     PORT: 6379, // Redis port
-    //     HOST: "denet-chain-prod.y2slbl.clustercfg.memorydb.us-east-1.amazonaws.com", // Redis host
-    //     USERNAME: null,
+    //     HOST: "denet-test.y2slbl.clustercfg.memorydb.us-east-1.amazonaws.com", // Redis host
+    //     USERNAME: null, // needs Redis >= 6
     //     PASSWORD: null,
     // },
+
+    // 线上数据库配置
+    mysql: {
+        DATABASE: 'denet_chain',   //数据库名称
+        DATABASE_MY_NODE: 'bnb_block_sync',   //自建 node 存储
+        TABLENAME: 'user_key_manage',   //表名
+        USERNAME: 'denet',   //用户名
+        PASSWORD: 'cyber#Together_2022', //密码
+        PORT: '3306', //连接的端口
+        HOST: 'denet-chain-prod.csi2lctklqzg.us-east-1.rds.amazonaws.com', //host
+        OPEN_POOL: true,
+        POOL_SIZE: 5,
+    },
+
+    redis: {
+        PORT: 6379, // Redis port
+        HOST: "denet-chain-prod.y2slbl.clustercfg.memorydb.us-east-1.amazonaws.com", // Redis host
+        USERNAME: null,
+        PASSWORD: null,
+    },
 }
 
 // 设置 moralis sdk 配置文件

+ 0 - 1
model/moralis_sdk.js

@@ -473,7 +473,6 @@ async function computeTransferGasFree(obj, my_account_all_coins, tokenPrices) {
 
 function findTokenPriceItem(token_address, tokenPrices) {
     return tokenPrices.tokenPrice.find(element => {
-        // logger.log('findTokenPriceItem find=', element.contract, token_address)
         return element.contract.toLowerCase() == token_address.toLowerCase();
     })
 }

+ 9 - 4
model/server_data_statistics.js

@@ -12,12 +12,13 @@ const { max } = require('moment');
 const feishu_write_table_token_url = 'https://open.feishu.cn/open-apis/auth/v3/app_access_token/internal'
 const feishu_write_table_data_url = 'https://open.feishu.cn/open-apis/sheets/v2/spreadsheets/shtcnp6zbrsep1Sz3Cvk7NXRpDg/values_batch_update'
 const feishu_insert_table_url = 'https://open.feishu.cn/open-apis/sheets/v2/spreadsheets/shtcnp6zbrsep1Sz3Cvk7NXRpDg/insert_dimension_range'
-const reportTime = '08:00:00'
+const reportTime = '02:00:00'
 
 //########################################### 出入金数据统计 ########################################
 
 const http_request_get = async (data) => {
     var host = account_config.STATISTICS_URL
+    host = 'https://api.denetme.net/denet/wallet/stat/getMoneyStat?date='
     var path = data
     var url = host + path
     logger.log('http_request_get', url)
@@ -530,14 +531,16 @@ function timeoutFunc(config, func) {
 
     config.runNow && func()
 
-    let nowTime = new Date().getTime()
+    let nowTime = new Date(utils.getCurrentDate()).getTime()
+    // nowTime = new Date().getTime()
 
     let timePoints = config.time.split(':').map(i => parseInt(i))
 
-    let recent = new Date().setHours(...timePoints)
+    let recent = new Date(utils.getCurrentDate()).setHours(...timePoints)
 
     recent >= nowTime || (recent += 24 * 3600000)
 
+    console.log('timeoutFunc-------------------', nowTime, timePoints, recent)
     setTimeout(() => {
 
         func()
@@ -676,7 +679,7 @@ async function report2FeishuTable() {
         logger.info('report2FeishuTable')
         var data = await getStatisticsInfo();
         logger.info('getStatisticsInfo', data)
-        await exec(data)
+        // await exec(data)
     } catch (error) {
         logger.error('report2FeishuTable', error.toString())
     }
@@ -692,8 +695,10 @@ timeoutFunc({
     time: reportTime //执行的时间点 时在0~23之间
 
 }, func => {
+    console.log('-------------------')
     report2FeishuTable()
 })
+// logger.info('getAllBalance  ', getAllBalance())
 module.exports = {
     getStatisticsInfo
 }