1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- const router = require('koa-router')()
- const redis = require("../model/db/redis_db")
- const mysql = require("../model/db/mysql_db")
- const logger = require('../model/logger')
- var remote_config_db = require("../model/db/remote_config_db");
- router.prefix('/test');
- router.post('/set', async (ctx) => {
-
-
-
-
-
- for (let index = 0; index < 10; index++) {
- redis.redis_push('WITHDRAW_QUEUE_KEY', JSON.stringify({ code: index }))
- }
- while (true) {
- var item = await redis.redis_pop('WITHDRAW_QUEUE_KEY')
- logger.log('item', typeof item, JSON.parse(item));
- if (!item) {
- break
- }
- }
- logger.log('exit');
- })
- router.post('/get', async (ctx) => {
- const obj = ctx.request.body;
- console.log("get:", obj)
- await redis.redis_get(obj.key).then((result) => {
-
- console.error('>>>>>>>>>>>>redis_get' + "key:" + obj.key + "-" + "value:" + result)
- });
- await redis.readRedis(obj.key).then((result) => {
- ctx.body = "readRedis key:" + obj.key + " \n" + "value:" + result
- });
- })
- router.post('/queryUserPrivateKey', async (ctx) => {
- const obj = ctx.request.body;
- console.log("queryUserPrivateKey:", obj)
-
-
-
-
- await mysql.queryCompanyInfoFromId(0).then(e => {
- ctx.body = "results:" + JSON.stringify(e)
- })
- })
- async function query() {
- console.log('collect_coins', await remote_config_db.isPause('collect_coins'))
- console.log('withdraw', await remote_config_db.isPause('withdraw'))
- console.log('isBlackList', await remote_config_db.isBlackList('collect_coins', 'bsc', '0x003D33E1eD599a92aaacF9a710E10fC62143B9e0'))
- }
- module.exports = router
|