# 扣量功能
ALTER TABLE `h_game`
ADD COLUMN `order_switch` tinyint(2) unsigned NOT NULL DEFAULT '1' COMMENT '是否开启订单切量 1否 2是' AFTER `pay_switch`;

CREATE TABLE `h_game_order_switch` (
  `app_id` int(11) NOT NULL DEFAULT '0' COMMENT '游戏id',
  `start_time` time NOT NULL DEFAULT '00:00:00' COMMENT '时间段开始',
  `end_time` time NOT NULL DEFAULT '23:59:59' COMMENT '时间段结束',
  `price` decimal(12,2) NOT NULL DEFAULT '0.00' COMMENT '最低切量金额',
  `agent_white` text COMMENT '渠道白名单',
  PRIMARY KEY (`app_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='游戏订单切量条件表';

ALTER TABLE `h_agent_game_rate`
ADD COLUMN `switch_rate` float(5,4) unsigned NOT NULL DEFAULT '0.0000' COMMENT '渠道CPA切量比例' AFTER `update_time`,
ADD COLUMN `cpsa_rebate` float(5,4) unsigned NOT NULL DEFAULT '0.0000' COMMENT 'cpsa返点' AFTER `switch_rate`,
ADD COLUMN `gp_agent_rebate` float(5,4) NOT NULL DEFAULT '0.0000' COMMENT '三级渠道返点比例' AFTER `cpsa_rebate`,
ADD COLUMN `gp_agent_rate` float(5,4) NOT NULL DEFAULT '1.0000' COMMENT '三级渠道分成比例' AFTER `gp_agent_rebate`,
ADD COLUMN `promote_switch` tinyint(4) unsigned NOT NULL DEFAULT '1' COMMENT '是否可推广游戏  1 审核  2  可推广  3 不可推广' AFTER `gp_agent_rate`;


ALTER TABLE `h_agent_game`
ADD COLUMN `is_switch` tinyint(4) unsigned NOT NULL DEFAULT '2' COMMENT '是否切量1 切 2不切' AFTER `mobile_icon`;


CREATE TABLE `h_agent_game_switch` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
  `app_id` int(11) NOT NULL DEFAULT '0' COMMENT '游戏id',
  `agent_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '渠道id',
  `start_time` time NOT NULL DEFAULT '00:00:00' COMMENT '切换时间段开始',
  `end_time` time NOT NULL DEFAULT '23:59:59' COMMENT '切换时间段结束',
  `start_ip` varchar(32) NOT NULL DEFAULT '' COMMENT '切换ip段开始',
  `end_ip` varchar(32) NOT NULL DEFAULT '' COMMENT '切换ip段结束',
  `is_first` tinyint(1) NOT NULL DEFAULT '1' COMMENT '是否首冲不切换 1切换 2不切换 ',
  `price` double(12,2) NOT NULL DEFAULT '0.00' COMMENT '最低切换金额',
  `system` varchar(32) NOT NULL DEFAULT '3,4' COMMENT '切换的操作系统',
  `combat_num_mini` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '战力区间最小值',
  `combat_num_max` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '战力区间最大值',
  `ip_white` text NOT NULL COMMENT 'IP白名单',
  `area` text NOT NULL COMMENT '地区切换',
  `money` decimal(20,2) NOT NULL DEFAULT '0.00' COMMENT '累计充值最小值',
  `mem_id` text COMMENT '玩家白名单',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE KEY `ags_app_agent_index` (`app_id`,`agent_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='渠道游戏切量条件表';


ALTER TABLE `h_game_pay_switch`
ADD COLUMN `money` decimal(20,2) NOT NULL DEFAULT '0.00' COMMENT '累计充值最小值' AFTER `mem_id`,
ADD COLUMN `active_days` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '活跃天数' AFTER `money`,
ADD COLUMN `sum_money` double(12,2) NOT NULL DEFAULT '0.00' COMMENT '累计充值金额' AFTER `active_days`;

