From d4a0e5dcfc43e9899f8bda39147e84fc782c7c76 Mon Sep 17 00:00:00 2001 From: wuaho Date: Tue, 6 Jul 2021 10:14:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=89=E9=9C=B8=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- create_database.sql | 1 + settings.py | 6 +++--- single_process.py | 2 +- user_view.sql | 4 ++-- v2/consumer.py | 2 ++ 初始化事件表.sql | 2 +- 初始化用户表.sql | 2 +- 7 files changed, 11 insertions(+), 8 deletions(-) create mode 100644 create_database.sql diff --git a/create_database.sql b/create_database.sql new file mode 100644 index 0000000..6dcbef4 --- /dev/null +++ b/create_database.sql @@ -0,0 +1 @@ +create database zhengba; \ No newline at end of file diff --git a/settings.py b/settings.py index 7c4df1c..71ebd58 100644 --- a/settings.py +++ b/settings.py @@ -6,7 +6,7 @@ class Config: 'send_receive_timeout': 30} # 每个游戏不一样 游戏上报 kafka 主题 - SUBSCRIBE_TOPIC = 'test2' + SUBSCRIBE_TOPIC = 'zhengba_test' KAFKA_CONSUMER_CONF = { 'bootstrap_servers': ["192.168.0.30:9092", "192.168.0.71:9092", "192.168.0.229:9092"], @@ -14,10 +14,10 @@ class Config: 'auto_offset_reset': 'earliest', # 每个游戏不一样 - 'group_id': 'legu_group3' + 'group_id': 'zhengba_consumer_group' } # 游戏数据库名 - GAME = 'shjy' + GAME = 'zhengba' REDIS_CONF = { 'host': '192.168.0.161', diff --git a/single_process.py b/single_process.py index a2a042a..10ac4ed 100644 --- a/single_process.py +++ b/single_process.py @@ -31,7 +31,7 @@ def run(): for topic, msg in consumer(): # print(msg) type_ = msg['#type'] - if msg['#app_id']!='c3e0409ac18341149877b08f087db640': + if msg['#app_id']!='e903ab24ad8f4bfca8a3ce7e122cd102': print(msg) del msg['#type'] ts = int(time.time()) diff --git a/user_view.sql b/user_view.sql index 791cba2..c05d164 100644 --- a/user_view.sql +++ b/user_view.sql @@ -1,4 +1,4 @@ -create view shjy.user_view as select * - from shjy.user +create view zhengba.user_view as select * + from zhengba.user order by `#reg_time` desc LIMIT 1 by `#account_id` \ No newline at end of file diff --git a/v2/consumer.py b/v2/consumer.py index 897ac58..25e993c 100644 --- a/v2/consumer.py +++ b/v2/consumer.py @@ -17,6 +17,8 @@ def create_consumer(partition=-1): # print(msg) topic = msg.topic val = msg.value + if val.get('owner_name') not in ('gmhdgdt', 'gmhdtt'): + continue yield topic, val return consumer diff --git a/初始化事件表.sql b/初始化事件表.sql index e4e1d13..ff5ca85 100644 --- a/初始化事件表.sql +++ b/初始化事件表.sql @@ -1,4 +1,4 @@ -create table shjy.event +create table zhengba.event ( `#ip` Nullable(IPv4), `#country` Nullable(String), diff --git a/初始化用户表.sql b/初始化用户表.sql index fb58433..0bf1998 100644 --- a/初始化用户表.sql +++ b/初始化用户表.sql @@ -1,4 +1,4 @@ -create table shjy.user +create table zhengba.user ( `#reg_time` DateTime('UTC'),