|
|
@@ -12,7 +12,7 @@ class CreateTables
|
|
|
public function onWorkerStart(): void
|
|
|
{
|
|
|
// 每天的0点10执行,注意这里省略了秒位
|
|
|
- new Crontab('18 * * * *', function(){
|
|
|
+ new Crontab('5 * * * *', function(){
|
|
|
$this->initStart();
|
|
|
});
|
|
|
}
|
|
|
@@ -24,8 +24,8 @@ class CreateTables
|
|
|
$centerTablesSqlList = [
|
|
|
$this->base_total_day,
|
|
|
$this->base_total_hour,
|
|
|
- $this->basic_login_total,
|
|
|
- $this->game_active_day,
|
|
|
+ $this->basic_active_day,
|
|
|
+ $this->game_reg_pay_day
|
|
|
];
|
|
|
|
|
|
foreach ($centerTablesSqlList as $sql){
|
|
|
@@ -156,26 +156,51 @@ class CreateTables
|
|
|
KEY `site_id` (`site_id`) USING BTREE,
|
|
|
KEY `game_id` (`game_id`) USING BTREE
|
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;";
|
|
|
- protected string $basic_login_total = "CREATE TABLE IF NOT EXISTS `basic_login_total_{{YEAR}}` (
|
|
|
+
|
|
|
+ protected string $game_reg_pay_day = "CREATE TABLE IF NOT EXISTS `game_reg_pay_day_{{YEAR}}` (
|
|
|
+ `id` bigint(20) NOT NULL AUTO_INCREMENT,
|
|
|
+ `reg_date` varchar(10) NOT NULL COMMENT '注册月份',
|
|
|
+ `pay_date` varchar(10) NOT NULL COMMENT '充值月份',
|
|
|
+ `game_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '游戏ID',
|
|
|
+ `media_id` int(11) NOT NULL DEFAULT '0' COMMENT '媒体ID',
|
|
|
+ `agent_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '渠道ID',
|
|
|
+ `site_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '广告位ID',
|
|
|
+ `auth_id` int(10) NOT NULL DEFAULT '0' COMMENT '负责人ID',
|
|
|
+ `pay_num` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '充值人数',
|
|
|
+ `pay_total` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '充值金额',
|
|
|
+ `pay_amount` float unsigned NOT NULL DEFAULT '0' COMMENT '付费金额(分成)',
|
|
|
+ `addup_pay_num` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '注册累计付费',
|
|
|
+ `addup_pay_total` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '注册累计付费金额',
|
|
|
+ `addup_pay_amount` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '注册总充值(扣除分成)',
|
|
|
+ PRIMARY KEY (`id`) USING BTREE,
|
|
|
+ UNIQUE KEY `select_index` (`reg_date`,`pay_date`,`agent_id`,`site_id`,`game_id`) USING BTREE,
|
|
|
+ KEY `reg_date` (`reg_date`) USING BTREE,
|
|
|
+ KEY `pay_date` (`pay_date`) USING BTREE,
|
|
|
+ KEY `agent_id` (`agent_id`) USING BTREE,
|
|
|
+ KEY `site_id` (`site_id`) USING BTREE,
|
|
|
+ KEY `media_id` (`media_id`) USING BTREE,
|
|
|
+ KEY `auth_id` (`auth_id`) USING BTREE,
|
|
|
+ KEY `game_id` (`game_id`) USING BTREE
|
|
|
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='注册充值统计';";
|
|
|
+
|
|
|
+ protected string $basic_active_day = "CREATE TABLE IF NOT EXISTS `basic_active_day_{{YEAR}}` (
|
|
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
|
|
- `tdate` date NOT NULL COMMENT '登录时间',
|
|
|
- `agent_id` int(11) NOT NULL COMMENT '渠道ID',
|
|
|
- `site_id` int(11) NOT NULL DEFAULT '0' COMMENT '广告位ID',
|
|
|
- `cplaceid` varchar(50) DEFAULT NULL COMMENT '子ID',
|
|
|
- `adid` varchar(20) DEFAULT NULL COMMENT '创意ID',
|
|
|
- `game_id` int(10) unsigned NOT NULL COMMENT '游戏ID',
|
|
|
- `turn` int(10) unsigned NOT NULL COMMENT '轮数ID',
|
|
|
- `login_count` int(11) NOT NULL COMMENT '账号数',
|
|
|
+ `tdate` date NOT NULL COMMENT '登录日期',
|
|
|
+ `game_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '游戏ID',
|
|
|
+ `media_id` int(11) NOT NULL DEFAULT '0' COMMENT '媒体ID',
|
|
|
+ `agent_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '渠道ID',
|
|
|
+ `site_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '广告位ID',
|
|
|
+ `auth_id` int(10) NOT NULL DEFAULT '0' COMMENT '负责人ID',
|
|
|
+ `reg_date` date NOT NULL COMMENT '日期',
|
|
|
`active` int(10) unsigned NOT NULL COMMENT '活跃天数(0:当天)',
|
|
|
- `plat_id` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '平台ID',
|
|
|
+ `login_count` int(11) NOT NULL COMMENT '登录账号数',
|
|
|
PRIMARY KEY (`id`) USING BTREE,
|
|
|
KEY `tdate` (`tdate`) USING BTREE,
|
|
|
KEY `agent_id` (`agent_id`) USING BTREE,
|
|
|
KEY `site_id` (`site_id`) USING BTREE,
|
|
|
KEY `game_id` (`game_id`) USING BTREE,
|
|
|
- KEY `plat_id` (`plat_id`) USING BTREE,
|
|
|
KEY `active` (`active`) USING BTREE
|
|
|
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;";
|
|
|
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='用户活跃统计';";
|
|
|
|
|
|
protected string $sdk_active_info = "CREATE TABLE IF NOT EXISTS `sdk_active_log_{{MONTH}}` (
|
|
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
|
|
@@ -201,26 +226,6 @@ class CreateTables
|
|
|
KEY `active` (`active`)
|
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='用户活跃表';";
|
|
|
|
|
|
- protected string $game_active_day = "CREATE TABLE IF NOT EXISTS `game_active_day_{{YEAR}}` (
|
|
|
- `id` int(11) NOT NULL AUTO_INCREMENT,
|
|
|
- `game_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '游戏ID',
|
|
|
- `media_id` int(11) NOT NULL DEFAULT '0' COMMENT '媒体ID',
|
|
|
- `agent_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '渠道ID',
|
|
|
- `site_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '广告位ID',
|
|
|
- `auth_id` int(10) NOT NULL DEFAULT '0' COMMENT '负责人ID',
|
|
|
- `reg_date` date NOT NULL COMMENT '日期',
|
|
|
- `days` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '活跃天数(0当天登陆)',
|
|
|
- `active_total` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '活跃数',
|
|
|
- PRIMARY KEY (`id`) USING BTREE,
|
|
|
- UNIQUE KEY `select_index` (`reg_date`, `days`,`agent_id`,`site_id`,`game_id`) USING BTREE,
|
|
|
- KEY `reg_date` (`reg_date`) USING BTREE,
|
|
|
- KEY `agent_id` (`agent_id`) USING BTREE,
|
|
|
- KEY `site_id` (`site_id`) USING BTREE,
|
|
|
- KEY `media_id` (`media_id`) USING BTREE,
|
|
|
- KEY `auth_id` (`auth_id`) USING BTREE,
|
|
|
- KEY `game_id` (`game_id`) USING BTREE
|
|
|
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='活跃表';";
|
|
|
-
|
|
|
|
|
|
protected string $sdk_activate_log = "CREATE TABLE IF NOT EXISTS `sdk_activate_log_{{MONTH}}` (
|
|
|
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
|
|
@@ -335,7 +340,7 @@ class CreateTables
|
|
|
`trade_id` varchar(60) DEFAULT '' COMMENT '交易流水号',
|
|
|
`cp_order_id` varchar(60) NOT NULL COMMENT '研发订单号',
|
|
|
`ext` varchar(200) DEFAULT NULL COMMENT 'CP扩展参数',
|
|
|
- `pay_channel_id` smallint(6) NOT NULL COMMENT '支付渠道ID',
|
|
|
+ `pay_channel_id` smallint(6) DEFAULT '0' COMMENT '支付渠道ID',
|
|
|
`money` float NOT NULL COMMENT '面额(元)',
|
|
|
`paid_amount` float unsigned NOT NULL COMMENT '净额(元)',
|
|
|
`game_id` int(11) NOT NULL DEFAULT '0',
|
|
|
@@ -350,6 +355,7 @@ class CreateTables
|
|
|
`server_name` varchar(20) DEFAULT '',
|
|
|
`role_id` varchar(32) DEFAULT '',
|
|
|
`role_name` varchar(32) DEFAULT '',
|
|
|
+ `reg_date` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '注册时间',
|
|
|
`pay_date` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '添加时间',
|
|
|
`sync_date` datetime DEFAULT NULL COMMENT '支付通知时间',
|
|
|
`sync_data` text COMMENT '支付回调信息',
|
|
|
@@ -366,6 +372,8 @@ class CreateTables
|
|
|
`product_id` varchar(64) DEFAULT NULL COMMENT '充值商品ID',
|
|
|
`product_name` varchar(64) DEFAULT NULL COMMENT '充值商品名',
|
|
|
`package_name` varchar(64) DEFAULT NULL COMMENT '包名',
|
|
|
+ `reg_time` int(10) unsigned NOT NULL COMMENT '注册时间',
|
|
|
+ `login_time` int(10) unsigned NOT NULL COMMENT '登录时间',
|
|
|
PRIMARY KEY (`id`),
|
|
|
UNIQUE KEY `order_id` (`order_id`),
|
|
|
KEY `uid` (`uid`),
|