This commit is contained in:
wuaho 2021-08-03 17:51:21 +08:00
parent 009d5f0560
commit 79b47321c5
9 changed files with 24 additions and 24 deletions

View File

@ -1 +1 @@
create database zhengba;
create database xiangsu;

View File

@ -8,7 +8,7 @@ class Config:
'send_receive_timeout': 30}
# 每个游戏不一样 游戏上报 kafka 主题
SUBSCRIBE_TOPIC = 'zhengba_test'
SUBSCRIBE_TOPIC = 'xiangsu_test'
KAFKA_CONSUMER_CONF = {
'bootstrap_servers': ["192.168.0.30:9092", "192.168.0.71:9092", "192.168.0.229:9092"],
@ -18,14 +18,14 @@ class Config:
'auto_commit_interval_ms': 10000,
# 每个游戏不一样
'group_id': 'zhengba_consumer_group'
'group_id': 'xiangsu_consumer_group'
}
KAFKA_PRODUCER_CONF = {
'bootstrap_servers': ["192.168.0.30:9092", "192.168.0.71:9092", "192.168.0.229:9092"],
'value_serializer': lambda v: json.dumps(v).encode('utf-8'),
}
# 游戏数据库名
GAME = 'zhengba'
GAME = 'xiangsu'
STOP_SIGNAL = 'stop_MntxuXMc'

View File

@ -1,5 +1,5 @@
drop table if exists zhengba.user_view;
create view zhengba.user_view as select *
from zhengba.user
drop table if exists xiangsu.user_view;
create view xiangsu.user_view as select *
from xiangsu.user
order by `#reg_time` desc
LIMIT 1 by `#account_id`

View File

@ -1,5 +1,5 @@
drop table if exists zhengba.recharge_game;
create view zhengba.recharge_game as
drop table if exists xiangsu.recharge_game;
create view xiangsu.recharge_game as
select toDate(addHours(`#event_time`, `#zone_offset`)) as date,
`#os`,
`#bundle_id`,
@ -8,6 +8,6 @@ select toDate(addHours(`#event_time`, `#zone_offset`)) as date,
arrayDistinct(groupArray(binduid)) as account,
length(account) as account_num,
sum(money) as money
from zhengba.event
from xiangsu.event
where `#event_name` = 'rechargeGame'
group by toDate(addHours(`#event_time`, `#zone_offset`)), `#os`, `#bundle_id`, owner_name, channel

View File

@ -1,5 +1,5 @@
drop table if exists zhengba.event;
create table zhengba.event
drop table if exists xiangsu.event;
create table xiangsu.event
(
`#ip` Nullable(IPv4),
`#country` Nullable(String),

View File

@ -1,5 +1,5 @@
drop table if exists zhengba.user;
create table zhengba.user
drop table if exists xiangsu.user;
create table xiangsu.user
(
`#reg_time` DateTime('UTC'),

View File

@ -1,5 +1,5 @@
drop table if exists zhengba.new_account;
create view zhengba.new_account as
drop table if exists xiangsu.new_account;
create view xiangsu.new_account as
select toDate(addHours(`#event_time`, `#zone_offset`)) as date,
`#os`,
`#bundle_id`,
@ -7,6 +7,6 @@ select toDate(addHours(`#event_time`, `#zone_offset`)) as date,
channel,
groupArray(`binduid`) as account,
length(account) as num
from zhengba.event
from xiangsu.event
where role_idx = 1
group by toDate(addHours(`#event_time`, `#zone_offset`)), `#os`, `#bundle_id`, owner_name, channel

View File

@ -1,5 +1,5 @@
drop table if exists zhengba.new_account_recharge;
create view zhengba.new_account_recharge as (select date,
drop table if exists xiangsu.new_account_recharge;
create view xiangsu.new_account_recharge as (select date,
`#os`,
`#bundle_id`,
owner_name,
@ -13,11 +13,11 @@ from (select toDate(addHours(`#event_time`, `#zone_offset`)) as date,
channel,
binduid,
money
from zhengba.event
from xiangsu.event
where `#event_name` = 'rechargeGame') as tb1
right join (select toDate(addHours(`#event_time`, `#zone_offset`)) as date,
binduid
from zhengba.event
from xiangsu.event
where role_idx = 1) as tb2
on tb1.date = tb2.date and tb2.binduid = tb1.binduid
group by date, `#os`, `#bundle_id`, owner_name, channel)

View File

@ -1,5 +1,5 @@
drop table if exists zhengba.active_account;
create view zhengba.active_account as
drop table if exists xiangsu.active_account;
create view xiangsu.active_account as
select toDate(addHours(`#event_time`, `#zone_offset`)) as date,
`#os`,
`#bundle_id`,
@ -7,5 +7,5 @@ select toDate(addHours(`#event_time`, `#zone_offset`)) as date,
channel,
uniqCombined(binduid) as num,
arrayDistinct(groupArray(binduid)) as account
from zhengba.event
from xiangsu.event
group by toDate(addHours(`#event_time`, `#zone_offset`)), `#os`, `#bundle_id`, owner_name, channel