update
This commit is contained in:
parent
5a8c4aeecc
commit
6cd1e4fc69
16
config.py
16
config.py
@ -1,4 +1,5 @@
|
||||
import os
|
||||
import sys
|
||||
|
||||
from loguru import logger
|
||||
|
||||
@ -458,4 +459,17 @@ class ProductionConfig(Config):
|
||||
}
|
||||
|
||||
|
||||
settings = ProductionConfig()
|
||||
class DebugConfig(Config):
|
||||
GAME_MANA_MYSQLDB = {
|
||||
"host": "127.0.0.1",
|
||||
"port": 3306,
|
||||
"user": "root",
|
||||
"password": "root",
|
||||
"db": "gamemana"
|
||||
}
|
||||
|
||||
|
||||
if sys.platform == 'linux':
|
||||
settings = ProductionConfig()
|
||||
else:
|
||||
settings = DebugConfig()
|
||||
|
@ -39,8 +39,11 @@ class LoadData(metaclass=abc.ABCMeta):
|
||||
sql = 'replace into gm_kv set k=%s,v=%s'
|
||||
async with self.gm_db_pool.acquire() as conn:
|
||||
async with conn.cursor() as cur:
|
||||
try:
|
||||
await cur.execute(sql, (key, value))
|
||||
await conn.commit()
|
||||
except Exception as e:
|
||||
logger.error(e)
|
||||
|
||||
@abc.abstractmethod
|
||||
async def get_data(self):
|
||||
|
@ -28,7 +28,7 @@ class LoadUserData(LoadData):
|
||||
self.last_act_time = await self.get_kv(self.gm_key)
|
||||
|
||||
where = {
|
||||
'logintime': {'$gte': self.last_act_time, '$lt': self.act_time}
|
||||
'logintime': {'$gte': self.last_act_time-600, '$lt': self.act_time}
|
||||
}
|
||||
projection = {
|
||||
'_id': False,
|
||||
|
Loading…
Reference in New Issue
Block a user