Compare commits

..

No commits in common. "12f80d3ef29c08d428af25ef6a0a4454775ebb8a" and "9198ca18f44443cdc41807d5d2b03375c491bc93" have entirely different histories.

6 changed files with 7 additions and 39 deletions

1
.gitignore vendored
View File

@ -130,5 +130,4 @@ dmypy.json
.pyre/
.idea
Pipfile.lock

15
Pipfile
View File

@ -1,15 +0,0 @@
[[source]]
url = "https://pypi.douban.com/simple"
verify_ssl = true
name = "pypi"
[packages]
kafka-python = "*"
arrow = "*"
pymongo = "*"
loguru = "*"
[dev-packages]
[requires]
python_version = "3.8"

View File

@ -11,9 +11,3 @@ export xlegudata_env="production"
```
### 创建python环境
```shell
pipenv Pipfile
```

View File

@ -1,5 +1,3 @@
from loguru import logger
from .handle_event import HandlerEvent
from .handle_paylist import HandlerPaylist
from .handle_user import HandlerUser
@ -13,8 +11,5 @@ HANDLER_DICT = {
def handle_factory(data):
type_ = data['type']
obj = HANDLER_DICT.get(type_)
if not obj:
logger.warning(f'未知类型{type_}')
return
return obj(data)
obj = HANDLER_DICT[type_](data)
return obj

View File

@ -36,8 +36,6 @@ def main():
st = time.time() * 1000
data = msg.value
obj = handle_factory(data)
if not obj:
continue
obj.run()
logger.debug(time.time() * 1000 - st)

View File

@ -3,6 +3,9 @@ import os
import pymongo
from loguru import logger
logger.add('log.log', format="{time} {level} {name}:{line} {message}", level="INFO",
rotation="100 MB", retention='7 days',
enqueue=True)
class Config:
@ -14,7 +17,8 @@ class Config:
'consumer_id': 'geshouccs_consumer'
}
local_mongo_uri = os.environ["local_mongo_uri"]
# local_mongo_uri = os.environ["local_mongo_uri"]
local_mongo_uri = 'mongodb://root:iamciniao@127.0.0.1:27017/?authSource=admin&readPreference=primary&ssl=false'
mdb_clint = pymongo.MongoClient(local_mongo_uri)
mydb = mdb_clint["admin_game"]
admin_game_coll = mydb['game']
@ -23,16 +27,9 @@ class Config:
class Production(Config):
DB_PREFIX = 'game'
logger.add('log.log', format="{time} {level} {name}:{line} {message}", level="INFO",
rotation="100 MB", retention='7 days',
enqueue=True)
class Debug(Config):
DB_PREFIX = 'debug'
logger.add('log.log', format="{time} {level} {name}:{line} {message}", level="DEBUG",
rotation="100 MB", retention='7 days',
enqueue=True)
settings = Production if os.environ.get('xlegudata_env') == 'production' else Debug