From 81c0ef5e07f05ec457f8c450cfc2e02811c480ba Mon Sep 17 00:00:00 2001 From: yulixing Date: Tue, 20 Aug 2019 15:09:41 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=8D=A2=E6=88=90=E5=B0=B1=E9=85=8D?= =?UTF-8?q?=E7=BD=AEredis=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controllers/games/reward.js | 1 + src/controllers/games/settings.js | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/controllers/games/reward.js b/src/controllers/games/reward.js index ba6350c..8d624c1 100644 --- a/src/controllers/games/reward.js +++ b/src/controllers/games/reward.js @@ -252,6 +252,7 @@ router.post('/kefu-cfg', async (req, res, next) => { if (kefuStatus === 200) { const key = `kefu:${body.game_id}:6001` + // TODO: 迁移至正式服redis await redisDao.updateOneKey( key, JSON.stringify({msg_key: body.msg_key, img_url: body.img_url}) diff --git a/src/controllers/games/settings.js b/src/controllers/games/settings.js index 972516e..019379b 100644 --- a/src/controllers/games/settings.js +++ b/src/controllers/games/settings.js @@ -110,7 +110,6 @@ router.get('/one_game_cfg', async (req, res, next) => { /* 还原配置(获取正式配置) */ router.get('/reset_one_game_cfg', async (req, res, next) => { - // logger.db(req, '游戏管理', '配置管理', '获取单个游戏正式服配置信息'); // 权限判断 const hasPerm = @@ -394,7 +393,12 @@ router.get('/ac-conds', async (req, res, next) => { const key = `config:${query.game_id}:ac-conds` try { - const result = await redisDao.getByKey(key) + const client = redis.createClient({ + host: config.redisPublish.host, + port: config.redisPublish.port, + password: config.redisPublish.password, + }) + const result = await client.getAsync(key) res.send({ errcode: 0, result: JSON.parse(result) || {}, @@ -424,7 +428,12 @@ router.post('/ac-conds', async (req, res, next) => { const acConds = JSON.stringify(body.acConds) try { - const result = await redisDao.updateOneKey(key, acConds) + const client = redis.createClient({ + host: config.redisPublish.host, + port: config.redisPublish.port, + password: config.redisPublish.password, + }) + const result = await client.setAsync(key, acConds) res.send({ errcode: 0, })