11407 lines
562 KiB
SQL
11407 lines
562 KiB
SQL
/*
|
||
Navicat Premium Dump SQL
|
||
|
||
Source Server : agent
|
||
Source Server Type : MySQL
|
||
Source Server Version : 80036 (8.0.36)
|
||
Source Host : rm-bp1btyuwq77591x0jpo.mysql.rds.aliyuncs.com:3306
|
||
Source Schema : agent_db
|
||
|
||
Target Server Type : MySQL
|
||
Target Server Version : 80036 (8.0.36)
|
||
File Encoding : 65001
|
||
|
||
Date: 15/03/2026 19:30:11
|
||
*/
|
||
|
||
SET NAMES utf8mb4;
|
||
SET FOREIGN_KEY_CHECKS = 0;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_agent_commission
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_agent_commission`;
|
||
CREATE TABLE `ct_agent_commission` (
|
||
`id` int UNSIGNED NOT NULL AUTO_INCREMENT,
|
||
`agent_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '代理号',
|
||
`channel_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '渠道号',
|
||
`type_id` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '分成类型编号(001:普通金币房,002:短号金币房)',
|
||
`type_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '分成类型名称',
|
||
`system_commission_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '系统平台分成比例(百分比)(0-1)',
|
||
`user_commission_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '代理用户分成比例(百分比)(0-1)',
|
||
`parent_user_commission_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '代理用户绑定的上级代理用户分成比例(百分比)(0-1)',
|
||
`owner_commission_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '房主分成比例(百分比)(0-1)',
|
||
`create_time` datetime NULL DEFAULT NULL,
|
||
`update_time` datetime NULL DEFAULT NULL,
|
||
`status` int NULL DEFAULT 1 COMMENT '状态',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `uk_agent_commission`(`agent_id` ASC, `channel_id` ASC, `type_id` ASC) USING BTREE,
|
||
UNIQUE INDEX `pk_agent_commission`(`id` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 6 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_agent_commission_user
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_agent_commission_user`;
|
||
CREATE TABLE `ct_agent_commission_user` (
|
||
`id` int UNSIGNED NOT NULL AUTO_INCREMENT,
|
||
`agent_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '代理',
|
||
`channel_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '渠道',
|
||
`user_id` int NOT NULL COMMENT '用户、代理编号',
|
||
`type_id` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '分成比例id',
|
||
`commission_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '分成比例(百分比)(0~1)',
|
||
`parent_commission_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '邦定的上级代理用户分成比例(百分比)(0-1)',
|
||
`owner_commission_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '房主分成比例(百分比)(0-1)',
|
||
`create_time` datetime NULL DEFAULT NULL,
|
||
`update_time` datetime NULL DEFAULT NULL,
|
||
`is_custom` int NULL DEFAULT 1 COMMENT '是否使用自定义比例',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `uk_agent_commission_user`(`agent_id` ASC, `channel_id` ASC, `user_id` ASC, `type_id` ASC) USING BTREE,
|
||
UNIQUE INDEX `pk_agent_commission_user`(`id` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 5 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_agent_list
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_agent_list`;
|
||
CREATE TABLE `ct_agent_list` (
|
||
`id` smallint UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||
`agent_id` char(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '' COMMENT '代理商id',
|
||
`nickname` char(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '' COMMENT '名称',
|
||
`max_sales_id` int UNSIGNED NOT NULL DEFAULT 10000000 COMMENT '现有最大的代理id',
|
||
`default_sales_power` char(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '0000' COMMENT 'a-代理转卡,b-玩家转卡,c-玩家转星 ,d-代理转星',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `agent_id`(`agent_id` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 43 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci COMMENT = '代理商列表' ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_agent_notice
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_agent_notice`;
|
||
CREATE TABLE `ct_agent_notice` (
|
||
`id` int NOT NULL AUTO_INCREMENT,
|
||
`agent_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
||
`channel_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
||
`notice_info` varchar(2000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '公告内容',
|
||
`status` tinyint(1) NOT NULL DEFAULT 0 COMMENT '0、失效,1、有效, -1 del',
|
||
`global_notice` tinyint(1) NOT NULL DEFAULT 0 COMMENT '0、普通公告,1、全服公告',
|
||
`create_time` datetime NULL DEFAULT NULL,
|
||
`type` tinyint UNSIGNED NOT NULL DEFAULT 0 COMMENT '类型 0-代理后台的公告 1-代理抽成的公告',
|
||
PRIMARY KEY (`id`) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 29 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_agent_service
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_agent_service`;
|
||
CREATE TABLE `ct_agent_service` (
|
||
`id` int UNSIGNED NOT NULL AUTO_INCREMENT,
|
||
`agent_id` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '代理商id',
|
||
`channel_id` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '渠道id',
|
||
`min_value` int NOT NULL DEFAULT -1 COMMENT '区间最小值(-1为无限小)',
|
||
`max_value` int NOT NULL DEFAULT -1 COMMENT '区间最大值(-1为无限大)',
|
||
`type` int NOT NULL DEFAULT 0 COMMENT '计算方式(0:无效;1:按比例;2:按固定值)',
|
||
`value` decimal(18, 4) UNSIGNED NOT NULL DEFAULT 0.0000 COMMENT '要计算的值,具体参照value',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `pk_agent_service`(`id` ASC) USING BTREE,
|
||
UNIQUE INDEX `uk_agent_service`(`agent_id` ASC, `channel_id` ASC, `min_value` ASC, `max_value` ASC) USING BTREE,
|
||
INDEX `nk_agent_service`(`agent_id` ASC, `channel_id` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_business_income
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_business_income`;
|
||
CREATE TABLE `ct_business_income` (
|
||
`id` int UNSIGNED NOT NULL AUTO_INCREMENT,
|
||
`agent_id` char(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '代理商id',
|
||
`channel_id` char(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '渠道id',
|
||
`channel_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '渠道名称',
|
||
`account_period` char(6) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '账期',
|
||
`card_count_total` decimal(18, 4) NOT NULL DEFAULT 0.0000 COMMENT '总计出售房卡数',
|
||
`card_count_free` decimal(18, 4) NOT NULL DEFAULT 0.0000 COMMENT '赠送卡数',
|
||
`card_count_settle` decimal(18, 4) NOT NULL DEFAULT 0.0000 COMMENT '结算卡数',
|
||
`card_price_settle` decimal(18, 4) NOT NULL DEFAULT 0.0000 COMMENT '房卡结算单价',
|
||
`card_price_real` decimal(18, 4) NOT NULL DEFAULT 0.0000 COMMENT '房卡实际单价',
|
||
`card_money_settle` decimal(18, 4) NOT NULL DEFAULT 0.0000 COMMENT '房卡结算金额',
|
||
`card_money_proportions` decimal(18, 4) NOT NULL DEFAULT 0.0000 COMMENT '房卡渠道分成金额',
|
||
`card_money_income` decimal(18, 4) NOT NULL DEFAULT 0.0000 COMMENT '房卡营业收入',
|
||
`gold_count_total` decimal(18, 4) NOT NULL DEFAULT 0.0000 COMMENT '总计出售金币数',
|
||
`gold_count_free` decimal(18, 4) NOT NULL DEFAULT 0.0000 COMMENT '赠送金币数',
|
||
`gold_count_settle` decimal(18, 4) NOT NULL DEFAULT 0.0000 COMMENT '结算金币数',
|
||
`gold_price_settle` decimal(18, 4) NOT NULL DEFAULT 0.0000 COMMENT '金币结算单价',
|
||
`gold_price_real` decimal(18, 4) NOT NULL DEFAULT 0.0000 COMMENT '金币实际单价',
|
||
`gold_money_settle` decimal(18, 4) NOT NULL DEFAULT 0.0000 COMMENT '金币结算金额',
|
||
`gold_money_proportions` decimal(18, 4) NOT NULL DEFAULT 0.0000 COMMENT '金币渠道分成金额',
|
||
`gold_money_income` decimal(18, 4) NOT NULL DEFAULT 0.0000 COMMENT '金币营业收入',
|
||
`pay_money` decimal(18, 4) NOT NULL DEFAULT 0.0000 COMMENT '渠道转款实收款项',
|
||
`card_count_sell` decimal(18, 4) NOT NULL DEFAULT 0.0000 COMMENT '自助购买房卡数',
|
||
`card_money_sell` decimal(18, 4) NOT NULL DEFAULT 0.0000 COMMENT '自助购买房卡金额',
|
||
`card_money_income_sell` decimal(18, 4) NOT NULL DEFAULT 0.0000 COMMENT '自助购买房卡营业收入',
|
||
`gold_count_sell` decimal(18, 4) NOT NULL DEFAULT 0.0000 COMMENT '自助购买金币数',
|
||
`gold_money_sell` decimal(18, 4) NOT NULL DEFAULT 0.0000 COMMENT '自助购买金币金额',
|
||
`gold_money_income_sell` decimal(18, 4) NOT NULL DEFAULT 0.0000 COMMENT '自助购买金币营业收入',
|
||
`diamond_count_sell` decimal(18, 4) NOT NULL DEFAULT 0.0000 COMMENT '自助购买钻石数',
|
||
`diamond_money_sell` decimal(18, 4) NOT NULL DEFAULT 0.0000 COMMENT '自助购买钻石金额',
|
||
`diamond_money_income_sell` decimal(18, 4) NOT NULL DEFAULT 0.0000 COMMENT '自助购买钻石营业收入',
|
||
`pay_money_sell` decimal(18, 4) NOT NULL DEFAULT 0.0000 COMMENT '渠道自助购买实收款项',
|
||
`money_settle` decimal(18, 4) NOT NULL DEFAULT 0.0000 COMMENT '结算金额',
|
||
`money_total` decimal(18, 4) NOT NULL DEFAULT 0.0000 COMMENT '实际收款',
|
||
`money_receivable` decimal(18, 4) NOT NULL DEFAULT 0.0000 COMMENT '累计未收',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `uk_business_income`(`agent_id` ASC, `channel_id` ASC, `account_period` ASC) USING BTREE,
|
||
UNIQUE INDEX `pk_business_income`(`id` ASC) USING BTREE,
|
||
INDEX `nk_business_income_account_period`(`account_period` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 332 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_change_log
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_change_log`;
|
||
CREATE TABLE `ct_change_log` (
|
||
`id` int NOT NULL AUTO_INCREMENT,
|
||
`agentid` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '代理商id',
|
||
`channelid` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL,
|
||
`playerid` int NOT NULL COMMENT '玩家id',
|
||
`datatype` int NULL DEFAULT 1 COMMENT '变更类型(1:房卡;2:。。。)',
|
||
`changeamount` int NULL DEFAULT NULL COMMENT '变更数量(小于零表示减少)',
|
||
`changetime` int NULL DEFAULT NULL COMMENT '变更时间',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `pkChangeLog`(`id` ASC) USING BTREE,
|
||
INDEX `ukChangeLog`(`agentid` ASC, `channelid` ASC, `playerid` ASC) USING BTREE
|
||
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_channel_account_period
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_channel_account_period`;
|
||
CREATE TABLE `ct_channel_account_period` (
|
||
`id` int UNSIGNED NOT NULL AUTO_INCREMENT,
|
||
`agent_id` char(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '代理商id',
|
||
`channel_id` char(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '渠道id',
|
||
`account_period` char(6) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '账期',
|
||
`account_period_start_time` datetime NOT NULL COMMENT '账期起始时间',
|
||
`account_period_end_time` datetime NOT NULL COMMENT '账期结束时间',
|
||
`total_card` decimal(18, 4) NOT NULL DEFAULT 0.0000 COMMENT '房卡总数',
|
||
`total_gold` decimal(18, 4) NOT NULL DEFAULT 0.0000 COMMENT '金币总数',
|
||
`free_card` decimal(18, 4) NOT NULL DEFAULT 0.0000 COMMENT '赠送房卡数',
|
||
`free_gold` decimal(18, 4) NOT NULL DEFAULT 0.0000 COMMENT '赠送金币数',
|
||
`price_card` decimal(18, 4) NOT NULL DEFAULT 0.0000 COMMENT '房卡单价',
|
||
`price_gold` decimal(18, 4) NOT NULL DEFAULT 0.0000 COMMENT '金币单价',
|
||
`total` decimal(18, 4) NOT NULL DEFAULT 0.0000 COMMENT '总计金额',
|
||
`realtotal` decimal(18, 4) NOT NULL DEFAULT 0.0000 COMMENT '实际总计金额(总计*分成)',
|
||
`receivable` decimal(18, 4) NOT NULL DEFAULT 0.0000 COMMENT '应收金额',
|
||
`realincome` decimal(18, 4) NOT NULL DEFAULT 0.0000 COMMENT '实收金额',
|
||
`last_pay_time` datetime NULL DEFAULT NULL COMMENT '最后支付时间',
|
||
`is_enable` int NULL DEFAULT 1 COMMENT '是否有效(0:无效;1:有效)',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `pk_channel_account_period`(`id` ASC) USING BTREE,
|
||
UNIQUE INDEX `uk_channel_account_period`(`agent_id` ASC, `channel_id` ASC, `account_period` ASC) USING BTREE,
|
||
INDEX `nk_channel_account_period_agent_id`(`agent_id` ASC, `account_period` ASC) USING BTREE,
|
||
INDEX `nk_channel_account_period_agent_channel_id`(`agent_id` ASC, `channel_id` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 26 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_channel_account_period_log
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_channel_account_period_log`;
|
||
CREATE TABLE `ct_channel_account_period_log` (
|
||
`id` int UNSIGNED NOT NULL AUTO_INCREMENT,
|
||
`agent_id` char(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '代理商id',
|
||
`channel_id` char(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '渠道id',
|
||
`account_period` char(6) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '账期',
|
||
`free_card` decimal(18, 4) NOT NULL DEFAULT 0.0000 COMMENT '赠送房卡数',
|
||
`free_gold` decimal(18, 4) NOT NULL DEFAULT 0.0000 COMMENT '赠送金币数',
|
||
`price_card` decimal(18, 4) NOT NULL DEFAULT 0.0000 COMMENT '房卡单价',
|
||
`price_gold` decimal(18, 4) NOT NULL DEFAULT 0.0000 COMMENT '金币单价',
|
||
`user_id` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '操作员id',
|
||
`create_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP,
|
||
PRIMARY KEY (`id`) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 26 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_channel_account_period_online
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_channel_account_period_online`;
|
||
CREATE TABLE `ct_channel_account_period_online` (
|
||
`id` int UNSIGNED NOT NULL AUTO_INCREMENT,
|
||
`agent_id` char(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '代理商id',
|
||
`channel_id` char(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '渠道id',
|
||
`account_period` char(6) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '账期',
|
||
`account_period_start_time` datetime NOT NULL COMMENT '账期起始时间',
|
||
`account_period_end_time` datetime NOT NULL COMMENT '账期结束时间',
|
||
`total_card` decimal(18, 4) NOT NULL DEFAULT 0.0000 COMMENT '房卡总数',
|
||
`total_gold` decimal(18, 4) NOT NULL DEFAULT 0.0000 COMMENT '金币总数',
|
||
`free_card` decimal(18, 4) NOT NULL DEFAULT 0.0000 COMMENT '赠送房卡数',
|
||
`free_gold` decimal(18, 4) NOT NULL DEFAULT 0.0000 COMMENT '赠送金币数',
|
||
`price_card` decimal(18, 4) NOT NULL DEFAULT 0.0000 COMMENT '房卡单价',
|
||
`price_gold` decimal(18, 4) NOT NULL DEFAULT 0.0000 COMMENT '金币单价',
|
||
`total` decimal(18, 4) NOT NULL DEFAULT 0.0000 COMMENT '总计金额',
|
||
`realtotal` decimal(18, 4) NOT NULL DEFAULT 0.0000 COMMENT '实际总计金额(总计*分成)',
|
||
`receivable` decimal(18, 4) NOT NULL DEFAULT 0.0000 COMMENT '应收金额',
|
||
`realincome` decimal(18, 4) NOT NULL DEFAULT 0.0000 COMMENT '实收金额',
|
||
`last_pay_time` datetime NULL DEFAULT NULL COMMENT '最后支付时间',
|
||
`is_enable` int NULL DEFAULT 1 COMMENT '是否有效(0:无效;1:有效)',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `pk_channel_account_period_online`(`id` ASC) USING BTREE,
|
||
UNIQUE INDEX `uk_channel_account_period_online`(`agent_id` ASC, `channel_id` ASC, `account_period` ASC) USING BTREE,
|
||
INDEX `nk_channel_account_period_online_agent_channel_id`(`agent_id` ASC, `channel_id` ASC) USING BTREE,
|
||
INDEX `nk_channel_account_period_online_agent_id`(`agent_id` ASC, `account_period` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 9 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_channel_account_period_online_pay_log
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_channel_account_period_online_pay_log`;
|
||
CREATE TABLE `ct_channel_account_period_online_pay_log` (
|
||
`id` int UNSIGNED NOT NULL AUTO_INCREMENT,
|
||
`pay_log_id` int UNSIGNED NOT NULL COMMENT '支付流水id',
|
||
`agent_id` char(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '代理商id',
|
||
`channel_id` char(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '渠道id',
|
||
`account_period` char(6) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '账期',
|
||
`receivable` decimal(18, 4) NOT NULL DEFAULT 0.0000 COMMENT '账期应缴',
|
||
`realincome` decimal(18, 4) NOT NULL DEFAULT 0.0000 COMMENT '实际抵扣',
|
||
`realpay` decimal(18, 4) NOT NULL DEFAULT 0.0000 COMMENT '本期实付金额',
|
||
`carryover` decimal(18, 4) NOT NULL DEFAULT 0.0000 COMMENT '上期结转余额',
|
||
`total` decimal(18, 4) NOT NULL DEFAULT 0.0000 COMMENT '可用于支付的金额',
|
||
`surplus` decimal(18, 4) NOT NULL DEFAULT 0.0000 COMMENT '支付后的账户结余',
|
||
`pay_time` datetime NOT NULL COMMENT '支付时间',
|
||
`is_enable` int NULL DEFAULT 1 COMMENT '是否有效(0:无效;1:有效)',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `uk_channel_account_period_online_pay_log`(`pay_log_id` ASC, `agent_id` ASC, `channel_id` ASC, `account_period` ASC) USING BTREE,
|
||
UNIQUE INDEX `pk_channel_account_period_online_pay_log`(`id` ASC) USING BTREE,
|
||
INDEX `nk_channel_account_period_online_pay_log_agent_channel_id`(`agent_id` ASC, `channel_id` ASC) USING BTREE,
|
||
INDEX `nk_channel_account_period_online_pay_log_account_period`(`agent_id` ASC, `channel_id` ASC, `account_period` ASC, `is_enable` ASC) USING BTREE,
|
||
INDEX `nk_channel_account_period_online_pay_log_id`(`pay_log_id` ASC) USING BTREE
|
||
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_channel_account_period_pay_log
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_channel_account_period_pay_log`;
|
||
CREATE TABLE `ct_channel_account_period_pay_log` (
|
||
`id` int UNSIGNED NOT NULL AUTO_INCREMENT,
|
||
`pay_log_id` int UNSIGNED NOT NULL COMMENT '支付流水id',
|
||
`agent_id` char(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '代理商id',
|
||
`channel_id` char(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '渠道id',
|
||
`account_period` char(6) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '账期',
|
||
`receivable` decimal(18, 4) NOT NULL DEFAULT 0.0000 COMMENT '账期应缴',
|
||
`realincome` decimal(18, 4) NOT NULL DEFAULT 0.0000 COMMENT '实际抵扣',
|
||
`realpay` decimal(18, 4) NOT NULL DEFAULT 0.0000 COMMENT '本期实付金额',
|
||
`carryover` decimal(18, 4) NOT NULL DEFAULT 0.0000 COMMENT '上期结转余额',
|
||
`total` decimal(18, 4) NOT NULL DEFAULT 0.0000 COMMENT '可用于支付的金额',
|
||
`surplus` decimal(18, 4) NOT NULL DEFAULT 0.0000 COMMENT '支付后的账户结余',
|
||
`pay_time` datetime NOT NULL COMMENT '支付时间',
|
||
`is_enable` int NULL DEFAULT 1 COMMENT '是否有效(0:无效;1:有效)',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `pk_channel_account_period_pay_log`(`id` ASC) USING BTREE,
|
||
UNIQUE INDEX `uk_channel_account_period_pay_log`(`pay_log_id` ASC, `agent_id` ASC, `channel_id` ASC, `account_period` ASC) USING BTREE,
|
||
INDEX `nk_channel_account_period_pay_log_agent_channel_id`(`agent_id` ASC, `channel_id` ASC) USING BTREE,
|
||
INDEX `nk_channel_account_period_pay_log_id`(`pay_log_id` ASC) USING BTREE,
|
||
INDEX `nk_channel_account_period_pay_log_account_period`(`agent_id` ASC, `channel_id` ASC, `account_period` ASC, `is_enable` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 8 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_channel_list
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_channel_list`;
|
||
CREATE TABLE `ct_channel_list` (
|
||
`id` smallint UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||
`agent_id` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '' COMMENT '代理商id',
|
||
`channel_id` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '' COMMENT '渠道id',
|
||
`nickname` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '' COMMENT '名称',
|
||
`parent_agent_id` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '' COMMENT '父代理商id',
|
||
`logo` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '' COMMENT 'logo',
|
||
`qq` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '' COMMENT 'QQ',
|
||
`wechat` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '' COMMENT '微信',
|
||
`become_sales_mode` tinyint UNSIGNED NOT NULL DEFAULT 0 COMMENT '2-免费 0-收费',
|
||
`invitation_model` tinyint UNSIGNED NOT NULL DEFAULT 0 COMMENT '邀请码模式 2-开启 0-禁止',
|
||
`buy_card_mode` tinyint UNSIGNED NOT NULL DEFAULT 0 COMMENT '玩家购卡 2-可购买 0-不可购买',
|
||
`buy_star_mode` tinyint UNSIGNED NOT NULL DEFAULT 0 COMMENT '玩家购星星 2-可购买 0-不可购买',
|
||
`recharge_roomcard_to_sales` tinyint UNSIGNED NOT NULL DEFAULT 1 COMMENT '给代理充星星 0-禁用 1-启用',
|
||
`request_star` tinyint UNSIGNED NOT NULL DEFAULT 0 COMMENT '索要星星 1-开启 0-禁止',
|
||
`is_check_phone` tinyint NOT NULL DEFAULT 0 COMMENT '是否强制绑定手机 0-否 1-是',
|
||
`create_withdrawals_order_type` tinyint NOT NULL DEFAULT 0 COMMENT '申请提现的类型 0-默认流程 1-二维码',
|
||
`create_withdrawals_order_qcode` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '' COMMENT '申请提现的二维码链接',
|
||
`is_show_topsales_menu` tinyint NOT NULL DEFAULT 0 COMMENT '是否显示总代理的管理菜单 0-不显示 1-显示',
|
||
`is_show_recharge_star` tinyint NOT NULL DEFAULT 1 COMMENT '是否显示转星星的页面 0-不显示 1-显示',
|
||
`share_title` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '' COMMENT '分享的标题',
|
||
`share_desc` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '' COMMENT '分享的描述',
|
||
`share_img` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '' COMMENT '分享的图片',
|
||
`share_text` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '分享页面的自定义内容',
|
||
`pay_desc` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL,
|
||
`app_id` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '' COMMENT '微信登录用',
|
||
`devkey` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '' COMMENT '微信登录用',
|
||
`market_id` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '' COMMENT '微信登录用',
|
||
`app_id_pay` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '' COMMENT '微信支付用',
|
||
`devkey_pay` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '' COMMENT '微信支付用',
|
||
`market_id_pay` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '' COMMENT '微信支付用',
|
||
`is_open` tinyint UNSIGNED NOT NULL DEFAULT 0 COMMENT '是否对外开放 1-开放 0-关闭',
|
||
`sync_invitecode` int NULL DEFAULT 0 COMMENT '是否需要同步邀请码',
|
||
`withdraw_init` int NULL DEFAULT 10000 COMMENT '游戏币提现倍数设置',
|
||
`account` decimal(18, 4) NOT NULL DEFAULT 0.0000 COMMENT '账户余额',
|
||
`account_online` decimal(18, 4) NOT NULL DEFAULT 0.0000 COMMENT '账户余额(在线支付)',
|
||
`card_unit_price` int NOT NULL DEFAULT 0 COMMENT '房卡结算单价(单位:分)',
|
||
`proportions` decimal(10, 2) NOT NULL DEFAULT 0.00 COMMENT '渠道分成比例',
|
||
`service_type` tinyint NULL DEFAULT 0 COMMENT '服务费(茶水费)的计算方式:\r\n0: 当代理的上级代理为空或是总代理身份的时候统一由系统回收;\r\n1: 当代理的上级代理为空或是总代理身份的时候统一计算给当级代理;\r\n',
|
||
`service_index` int UNSIGNED NULL DEFAULT 0 COMMENT '服务费(茶水费)的计算序号',
|
||
`announcement` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '公告',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `uk_channel_list`(`agent_id` ASC, `channel_id` ASC) USING BTREE,
|
||
UNIQUE INDEX `agent_id`(`agent_id` ASC) USING BTREE,
|
||
UNIQUE INDEX `channel_id`(`channel_id` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 43 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci COMMENT = '渠道列表' ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_channel_pay_log
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_channel_pay_log`;
|
||
CREATE TABLE `ct_channel_pay_log` (
|
||
`id` int UNSIGNED NOT NULL AUTO_INCREMENT,
|
||
`order_id` char(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '订单号',
|
||
`agent_id` char(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '代理商id',
|
||
`channel_id` char(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '渠道id',
|
||
`account_period` char(6) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '账期',
|
||
`pay_time` datetime NULL DEFAULT NULL COMMENT '支付时间',
|
||
`pay_fee` decimal(18, 2) NULL DEFAULT 0.00 COMMENT '支付金额(渠道转款)',
|
||
`pay_fee_online` decimal(18, 2) NULL DEFAULT 0.00 COMMENT '支付金额(线上支付)',
|
||
`pay_user` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '支付操作员',
|
||
`account_before` decimal(18, 4) NULL DEFAULT 0.0000 COMMENT '支付前帐户余额',
|
||
`account_after` decimal(18, 4) NULL DEFAULT 0.0000 COMMENT '支付后帐户余额',
|
||
`account_online_before` decimal(18, 4) NULL DEFAULT 0.0000 COMMENT '支付前帐户余额(在线支付)',
|
||
`account_online_after` decimal(18, 4) NULL DEFAULT 0.0000 COMMENT '支付后账户余额(在线支付)',
|
||
`cancel_time` datetime NULL DEFAULT NULL COMMENT '撤销时间',
|
||
`cancel_user` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '撤销操作员',
|
||
`remark` varchar(2000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注',
|
||
`is_enable` int NULL DEFAULT 1 COMMENT '是否有效(0:无效;1:有效)',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `uk_channel_pay_log`(`order_id` ASC) USING BTREE,
|
||
UNIQUE INDEX `pk_channel_pay_log`(`id` ASC) USING BTREE,
|
||
INDEX `nk_channel_pay_log_agent_channel_id`(`agent_id` ASC, `channel_id` ASC) USING BTREE,
|
||
INDEX `nk_channel_pay_log_account_period`(`agent_id` ASC, `channel_id` ASC, `account_period` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 8 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_commision_chashui_user_detail
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_commision_chashui_user_detail`;
|
||
CREATE TABLE `ct_commision_chashui_user_detail` (
|
||
`id` int NOT NULL AUTO_INCREMENT,
|
||
`is_settle` int NULL DEFAULT NULL,
|
||
`agent_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
||
`channel_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
||
`player_id` int NULL DEFAULT NULL,
|
||
`target_id` int NULL DEFAULT NULL,
|
||
`user_id` int NULL DEFAULT NULL,
|
||
`parent_user_id` int NULL DEFAULT NULL,
|
||
`time` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
||
`create_time` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
|
||
`grade` decimal(18, 0) NULL DEFAULT NULL,
|
||
`commission_total` decimal(18, 0) NULL DEFAULT NULL,
|
||
`commission_system` decimal(18, 0) NULL DEFAULT NULL,
|
||
`commission_user` decimal(18, 0) NULL DEFAULT NULL,
|
||
`commission_parent_user` decimal(18, 0) NULL DEFAULT NULL,
|
||
`player_avatar` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
||
`player_nickname` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
||
`target_avatar` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
||
`target_nickname` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
||
`target_mode` tinyint(1) NULL DEFAULT NULL,
|
||
PRIMARY KEY (`id`) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 88532 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_commision_user_detail
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_commision_user_detail`;
|
||
CREATE TABLE `ct_commision_user_detail` (
|
||
`id` int NOT NULL AUTO_INCREMENT,
|
||
`is_settle` int NULL DEFAULT NULL,
|
||
`agent_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
||
`channel_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
||
`player_id` int NULL DEFAULT NULL,
|
||
`user_id` int NULL DEFAULT NULL,
|
||
`parent_user_id` int NULL DEFAULT NULL,
|
||
`time` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
||
`create_time` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
|
||
`grade` decimal(18, 0) NULL DEFAULT NULL,
|
||
`commission_total` decimal(18, 0) NULL DEFAULT NULL,
|
||
`commission_system` decimal(18, 0) NULL DEFAULT NULL,
|
||
`commission_user` decimal(18, 0) NULL DEFAULT NULL,
|
||
`commission_parent_user` decimal(18, 0) NULL DEFAULT NULL,
|
||
`avatar` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
||
`nickname` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
||
`target_mode` tinyint(1) NULL DEFAULT NULL,
|
||
PRIMARY KEY (`id`) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 229085 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_exec_log
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_exec_log`;
|
||
CREATE TABLE `ct_exec_log` (
|
||
`id` int UNSIGNED NOT NULL AUTO_INCREMENT,
|
||
`name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
|
||
`time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP,
|
||
`message` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
|
||
PRIMARY KEY (`id`) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 2241 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_game_list
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_game_list`;
|
||
CREATE TABLE `ct_game_list` (
|
||
`id` smallint UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||
`channel_id` char(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '' COMMENT '渠道id',
|
||
`game_id` char(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '' COMMENT '游戏id',
|
||
`game_name` char(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '' COMMENT '游戏名称',
|
||
`logo` char(75) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '' COMMENT 'logo',
|
||
`description` char(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '' COMMENT '描述',
|
||
`ios_download_url` char(120) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '' COMMENT '苹果下载地址',
|
||
`ios_download_url_2` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '' COMMENT 'ios备用下载地址',
|
||
`ios_market_type` tinyint UNSIGNED NOT NULL DEFAULT 0 COMMENT '苹果下载类型 0-普通 2-企业签',
|
||
`ios_app_size` char(7) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '' COMMENT '苹果app大小',
|
||
`android_download_url` char(60) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '' COMMENT '安卓下载地址',
|
||
`android_download_url_2` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '' COMMENT '安卓备用下载地址',
|
||
`android_app_size` char(7) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '' COMMENT '安卓app大小',
|
||
`is_open` tinyint UNSIGNED NOT NULL DEFAULT 0 COMMENT '是否对外开放 1-开放 0-关闭',
|
||
PRIMARY KEY (`id`) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 52 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci COMMENT = '游戏列表' ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_game_settle_info
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_game_settle_info`;
|
||
CREATE TABLE `ct_game_settle_info` (
|
||
`id` int NOT NULL AUTO_INCREMENT,
|
||
`agent_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '代理号',
|
||
`channel_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '渠道号',
|
||
`game_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '游戏号',
|
||
`winner_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '赢家编号',
|
||
`commission_type` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '结算类型(房间类型、对应ct_agent_commission表)(001:普通;002:金币;……)',
|
||
`win_points` int NULL DEFAULT NULL COMMENT '获胜积分数(获胜金币、星星数)',
|
||
`sales_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '玩家对应的代理号',
|
||
`system_commission_points` int NULL DEFAULT 0 COMMENT '系统平台分成的积分数(获胜金币、星星数)',
|
||
`user_commission_points` int NULL DEFAULT 0 COMMENT '代理用户分成的积分数(获胜金币、星星数)',
|
||
`settle_time` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '结算时间',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `pk_game_settle_info`(`id` ASC) USING BTREE,
|
||
INDEX `nk_game_settle_info_commission_type`(`agent_id` ASC, `channel_id` ASC, `commission_type` ASC) USING BTREE,
|
||
INDEX `nk_game_settle_info_winner`(`agent_id` ASC, `channel_id` ASC, `game_id` ASC, `winner_id` ASC) USING BTREE,
|
||
INDEX `nk_game_settle_info_sales`(`agent_id` ASC, `channel_id` ASC, `game_id` ASC, `sales_id` ASC) USING BTREE
|
||
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_gift_info
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_gift_info`;
|
||
CREATE TABLE `ct_gift_info` (
|
||
`id` int UNSIGNED NOT NULL AUTO_INCREMENT,
|
||
`agent_id` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '代理商id',
|
||
`channel_id` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '渠道商id',
|
||
`sales_id` int NULL DEFAULT NULL COMMENT '个人代理id',
|
||
`player_id` int NULL DEFAULT NULL COMMENT '玩家编号',
|
||
`type` int NOT NULL COMMENT '类型(1: 房卡-礼包; 2: 星星-礼包; 3: 房卡-充值卡密; 4: 星星-充值卡密)',
|
||
`amount` decimal(18, 4) NOT NULL DEFAULT 0.0000 COMMENT '数量',
|
||
`status` int NOT NULL DEFAULT 0 COMMENT '当前状态(-1: 已作废; 0: 等待领取; 1: 已领取;)',
|
||
`create_time` int UNSIGNED NOT NULL COMMENT '创建时间',
|
||
`receive_time` int UNSIGNED NULL DEFAULT NULL COMMENT '领取时间',
|
||
`order_id` int NULL DEFAULT NULL COMMENT '对应的订单记录表的id',
|
||
`card_number` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '充值卡号',
|
||
`card_password` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '充值卡密码',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `pk_gift_info`(`id` ASC) USING BTREE,
|
||
UNIQUE INDEX `uk_gift_info_card`(`card_number` ASC, `card_password` ASC) USING BTREE,
|
||
UNIQUE INDEX `uk_gift_info_card_number`(`card_number` ASC) USING BTREE,
|
||
INDEX `nk_gift_info_query`(`agent_id` ASC, `channel_id` ASC, `sales_id` ASC, `type` ASC, `status` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 14 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '礼包表' ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_gold_balance
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_gold_balance`;
|
||
CREATE TABLE `ct_gold_balance` (
|
||
`id` int UNSIGNED NOT NULL AUTO_INCREMENT,
|
||
`agent_id` char(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '代理商id',
|
||
`channel_id` char(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '渠道id',
|
||
`channel_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '渠道名称',
|
||
`report_date` char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '日期',
|
||
`trans_sales` decimal(18, 4) NULL DEFAULT 0.0000 COMMENT '转给代理的金币数',
|
||
`trans_player` decimal(18, 4) NULL DEFAULT 0.0000 COMMENT '转给玩家的金币数',
|
||
`buy_sales` decimal(18, 4) NULL DEFAULT 0.0000 COMMENT '代理购买的金币数',
|
||
`buy_player` decimal(18, 4) NULL DEFAULT 0.0000 COMMENT '玩家购买的金币数',
|
||
`buy_third` decimal(18, 4) NULL DEFAULT 0.0000 COMMENT '第三方代付购买的金币数',
|
||
`request_sales` decimal(18, 4) NULL DEFAULT 0.0000 COMMENT '代理索要金币数',
|
||
`request_player` decimal(18, 4) NULL DEFAULT 0.0000 COMMENT '玩家索要金币数',
|
||
`robot_produce` decimal(18, 4) NULL DEFAULT 0.0000 COMMENT '机器人生产(输掉的)金币数',
|
||
`system_produce` decimal(18, 4) NULL DEFAULT 0.0000 COMMENT '系统生产(转出)金币',
|
||
`manager_produce` decimal(18, 4) NULL DEFAULT 0.0000 COMMENT '总代生产(转出)金币',
|
||
`gift` decimal(18, 4) NULL DEFAULT 0.0000 COMMENT '赠送的金币数',
|
||
`stock_sales` decimal(18, 4) NULL DEFAULT 0.0000 COMMENT '代理库存金币',
|
||
`stock_player` decimal(18, 4) NULL DEFAULT 0.0000 COMMENT '玩家库存金币',
|
||
`bank_sales` decimal(18, 4) NULL DEFAULT 0.0000 COMMENT '代理银行中的金币',
|
||
`bank_player` decimal(18, 4) NULL DEFAULT 0.0000 COMMENT '玩家银行中的金币',
|
||
`consume_commission_system` decimal(18, 4) NULL DEFAULT 0.0000 COMMENT '系统分成金币数(balance)',
|
||
`consume_commission_service` decimal(18, 4) NULL DEFAULT 0.0000 COMMENT '系统扣除服务费金币',
|
||
`robot_consume` decimal(18, 4) NULL DEFAULT 0.0000 COMMENT '机器人消费金币(机器人赢的金币数)',
|
||
`system_consume` decimal(18, 4) NULL DEFAULT 0.0000 COMMENT '系统消费(扣除)金币',
|
||
`manager_consume` decimal(18, 4) NULL DEFAULT 0.0000 COMMENT '总代消费(扣除)金币',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `pk_gold_balance`(`id` ASC) USING BTREE,
|
||
UNIQUE INDEX `uk_gold_balance`(`agent_id` ASC, `channel_id` ASC, `report_date` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 70670 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_grade_202401
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_grade_202401`;
|
||
CREATE TABLE `ct_grade_202401` (
|
||
`id` int NOT NULL AUTO_INCREMENT,
|
||
`agent_id` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '代理商id',
|
||
`channel_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '渠道编号',
|
||
`game_id` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '游戏id',
|
||
`player_id` int NOT NULL COMMENT '玩家id',
|
||
`room_code` int NOT NULL COMMENT '房号',
|
||
`room_type` varchar(200) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '房间类型',
|
||
`owner_id` int NULL DEFAULT NULL COMMENT '房主id',
|
||
`room_card` int NULL DEFAULT 0,
|
||
`owner_card` int NULL DEFAULT 0,
|
||
`create_time` datetime NOT NULL COMMENT '开房时间',
|
||
`makewar_time` datetime NOT NULL COMMENT '开战时间',
|
||
`over_time` datetime NOT NULL COMMENT '结束时间',
|
||
`short_number` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '短号号码',
|
||
`deduct_type` int NULL DEFAULT NULL COMMENT '扣卡模式',
|
||
`deduct_card` int NULL DEFAULT NULL COMMENT '扣卡数',
|
||
`aset_count` int NULL DEFAULT NULL COMMENT '总局数',
|
||
`room_mode` tinyint(1) NULL DEFAULT NULL COMMENT '0-普通房间 1-金币房间',
|
||
`score` int NULL DEFAULT 0 COMMENT '得分',
|
||
`is_winner` tinyint(1) NULL DEFAULT 0 COMMENT '是否大赢家(0: 否; 1: 是)',
|
||
`room_hash` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '房间的hash值',
|
||
`out_id` int NOT NULL,
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `uk_grade_202001`(`out_id` ASC) USING BTREE,
|
||
UNIQUE INDEX `pk_grade_202001`(`id` ASC) USING BTREE,
|
||
INDEX `nk_grade_202001_over_time`(`agent_id` ASC, `short_number` ASC, `over_time` ASC) USING BTREE,
|
||
INDEX `nk_grade_202001_group_data`(`agent_id` ASC, `channel_id` ASC, `game_id` ASC, `player_id` ASC, `short_number` ASC, `create_time` ASC, `makewar_time` ASC, `over_time` ASC) USING BTREE,
|
||
INDEX `nk_grade_202001_player_id`(`agent_id` ASC, `player_id` ASC) USING BTREE,
|
||
INDEX `nk_grade_202001_create_time`(`agent_id` ASC, `short_number` ASC, `create_time` ASC) USING BTREE,
|
||
INDEX `nk_grade_202001_owner_id`(`agent_id` ASC, `owner_id` ASC) USING BTREE,
|
||
INDEX `nk_grade_202001_makewar_time`(`agent_id` ASC, `short_number` ASC, `makewar_time` ASC) USING BTREE,
|
||
INDEX `nk_makewar_time`(`makewar_time` ASC) USING BTREE,
|
||
INDEX `nk_grade_202001_agent_id`(`agent_id` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 619223 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_grade_202402
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_grade_202402`;
|
||
CREATE TABLE `ct_grade_202402` (
|
||
`id` int NOT NULL AUTO_INCREMENT,
|
||
`agent_id` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '代理商id',
|
||
`channel_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '渠道编号',
|
||
`game_id` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '游戏id',
|
||
`player_id` int NOT NULL COMMENT '玩家id',
|
||
`room_code` int NOT NULL COMMENT '房号',
|
||
`room_type` varchar(200) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '房间类型',
|
||
`owner_id` int NULL DEFAULT NULL COMMENT '房主id',
|
||
`room_card` int NULL DEFAULT 0,
|
||
`owner_card` int NULL DEFAULT 0,
|
||
`create_time` datetime NOT NULL COMMENT '开房时间',
|
||
`makewar_time` datetime NOT NULL COMMENT '开战时间',
|
||
`over_time` datetime NOT NULL COMMENT '结束时间',
|
||
`short_number` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '短号号码',
|
||
`deduct_type` int NULL DEFAULT NULL COMMENT '扣卡模式',
|
||
`deduct_card` int NULL DEFAULT NULL COMMENT '扣卡数',
|
||
`aset_count` int NULL DEFAULT NULL COMMENT '总局数',
|
||
`room_mode` tinyint(1) NULL DEFAULT NULL COMMENT '0-普通房间 1-金币房间',
|
||
`score` int NULL DEFAULT 0 COMMENT '得分',
|
||
`is_winner` tinyint(1) NULL DEFAULT 0 COMMENT '是否大赢家(0: 否; 1: 是)',
|
||
`room_hash` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '房间的hash值',
|
||
`out_id` int NOT NULL,
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `uk_grade_202001`(`out_id` ASC) USING BTREE,
|
||
UNIQUE INDEX `pk_grade_202001`(`id` ASC) USING BTREE,
|
||
INDEX `nk_grade_202001_over_time`(`agent_id` ASC, `short_number` ASC, `over_time` ASC) USING BTREE,
|
||
INDEX `nk_grade_202001_group_data`(`agent_id` ASC, `channel_id` ASC, `game_id` ASC, `player_id` ASC, `short_number` ASC, `create_time` ASC, `makewar_time` ASC, `over_time` ASC) USING BTREE,
|
||
INDEX `nk_grade_202001_player_id`(`agent_id` ASC, `player_id` ASC) USING BTREE,
|
||
INDEX `nk_grade_202001_create_time`(`agent_id` ASC, `short_number` ASC, `create_time` ASC) USING BTREE,
|
||
INDEX `nk_grade_202001_owner_id`(`agent_id` ASC, `owner_id` ASC) USING BTREE,
|
||
INDEX `nk_grade_202001_makewar_time`(`agent_id` ASC, `short_number` ASC, `makewar_time` ASC) USING BTREE,
|
||
INDEX `nk_makewar_time`(`makewar_time` ASC) USING BTREE,
|
||
INDEX `nk_grade_202001_agent_id`(`agent_id` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 553676 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_grade_202403
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_grade_202403`;
|
||
CREATE TABLE `ct_grade_202403` (
|
||
`id` int NOT NULL AUTO_INCREMENT,
|
||
`agent_id` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '代理商id',
|
||
`channel_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '渠道编号',
|
||
`game_id` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '游戏id',
|
||
`player_id` int NOT NULL COMMENT '玩家id',
|
||
`room_code` int NOT NULL COMMENT '房号',
|
||
`room_type` varchar(200) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '房间类型',
|
||
`owner_id` int NULL DEFAULT NULL COMMENT '房主id',
|
||
`room_card` int NULL DEFAULT 0,
|
||
`owner_card` int NULL DEFAULT 0,
|
||
`create_time` datetime NOT NULL COMMENT '开房时间',
|
||
`makewar_time` datetime NOT NULL COMMENT '开战时间',
|
||
`over_time` datetime NOT NULL COMMENT '结束时间',
|
||
`short_number` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '短号号码',
|
||
`deduct_type` int NULL DEFAULT NULL COMMENT '扣卡模式',
|
||
`deduct_card` int NULL DEFAULT NULL COMMENT '扣卡数',
|
||
`aset_count` int NULL DEFAULT NULL COMMENT '总局数',
|
||
`room_mode` tinyint(1) NULL DEFAULT NULL COMMENT '0-普通房间 1-金币房间',
|
||
`score` int NULL DEFAULT 0 COMMENT '得分',
|
||
`is_winner` tinyint(1) NULL DEFAULT 0 COMMENT '是否大赢家(0: 否; 1: 是)',
|
||
`room_hash` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '房间的hash值',
|
||
`out_id` int NOT NULL,
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `uk_grade_202001`(`out_id` ASC) USING BTREE,
|
||
UNIQUE INDEX `pk_grade_202001`(`id` ASC) USING BTREE,
|
||
INDEX `nk_grade_202001_over_time`(`agent_id` ASC, `short_number` ASC, `over_time` ASC) USING BTREE,
|
||
INDEX `nk_grade_202001_group_data`(`agent_id` ASC, `channel_id` ASC, `game_id` ASC, `player_id` ASC, `short_number` ASC, `create_time` ASC, `makewar_time` ASC, `over_time` ASC) USING BTREE,
|
||
INDEX `nk_grade_202001_player_id`(`agent_id` ASC, `player_id` ASC) USING BTREE,
|
||
INDEX `nk_grade_202001_create_time`(`agent_id` ASC, `short_number` ASC, `create_time` ASC) USING BTREE,
|
||
INDEX `nk_grade_202001_owner_id`(`agent_id` ASC, `owner_id` ASC) USING BTREE,
|
||
INDEX `nk_grade_202001_makewar_time`(`agent_id` ASC, `short_number` ASC, `makewar_time` ASC) USING BTREE,
|
||
INDEX `nk_makewar_time`(`makewar_time` ASC) USING BTREE,
|
||
INDEX `nk_grade_202001_agent_id`(`agent_id` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 668865 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_grade_202404
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_grade_202404`;
|
||
CREATE TABLE `ct_grade_202404` (
|
||
`id` int NOT NULL AUTO_INCREMENT,
|
||
`agent_id` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '代理商id',
|
||
`channel_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '渠道编号',
|
||
`game_id` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '游戏id',
|
||
`player_id` int NOT NULL COMMENT '玩家id',
|
||
`room_code` int NOT NULL COMMENT '房号',
|
||
`room_type` varchar(200) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '房间类型',
|
||
`owner_id` int NULL DEFAULT NULL COMMENT '房主id',
|
||
`room_card` int NULL DEFAULT 0,
|
||
`owner_card` int NULL DEFAULT 0,
|
||
`create_time` datetime NOT NULL COMMENT '开房时间',
|
||
`makewar_time` datetime NOT NULL COMMENT '开战时间',
|
||
`over_time` datetime NOT NULL COMMENT '结束时间',
|
||
`short_number` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '短号号码',
|
||
`deduct_type` int NULL DEFAULT NULL COMMENT '扣卡模式',
|
||
`deduct_card` int NULL DEFAULT NULL COMMENT '扣卡数',
|
||
`aset_count` int NULL DEFAULT NULL COMMENT '总局数',
|
||
`room_mode` tinyint(1) NULL DEFAULT NULL COMMENT '0-普通房间 1-金币房间',
|
||
`score` int NULL DEFAULT 0 COMMENT '得分',
|
||
`is_winner` tinyint(1) NULL DEFAULT 0 COMMENT '是否大赢家(0: 否; 1: 是)',
|
||
`room_hash` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '房间的hash值',
|
||
`out_id` int NOT NULL,
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `pk_grade_202404`(`id` ASC) USING BTREE,
|
||
UNIQUE INDEX `uk_grade_202404`(`out_id` ASC) USING BTREE,
|
||
INDEX `nk_grade_202404_agent_id`(`agent_id` ASC) USING BTREE,
|
||
INDEX `nk_grade_202404_group_data`(`agent_id` ASC, `channel_id` ASC, `game_id` ASC, `player_id` ASC, `short_number` ASC, `create_time` ASC, `makewar_time` ASC, `over_time` ASC) USING BTREE,
|
||
INDEX `nk_grade_202404_create_time`(`agent_id` ASC, `short_number` ASC, `create_time` ASC) USING BTREE,
|
||
INDEX `nk_grade_202404_player_id`(`agent_id` ASC, `player_id` ASC) USING BTREE,
|
||
INDEX `nk_grade_202404_over_time`(`agent_id` ASC, `short_number` ASC, `over_time` ASC) USING BTREE,
|
||
INDEX `nk_grade_202404_makewar_time`(`agent_id` ASC, `short_number` ASC, `makewar_time` ASC) USING BTREE,
|
||
INDEX `nk_grade_202404_owner_id`(`agent_id` ASC, `owner_id` ASC) USING BTREE,
|
||
INDEX `nk_makewar_time`(`makewar_time` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 483545 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_grade_202405
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_grade_202405`;
|
||
CREATE TABLE `ct_grade_202405` (
|
||
`id` int NOT NULL AUTO_INCREMENT,
|
||
`agent_id` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '代理商id',
|
||
`channel_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '渠道编号',
|
||
`game_id` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '游戏id',
|
||
`player_id` int NOT NULL COMMENT '玩家id',
|
||
`room_code` int NOT NULL COMMENT '房号',
|
||
`room_type` varchar(200) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '房间类型',
|
||
`owner_id` int NULL DEFAULT NULL COMMENT '房主id',
|
||
`room_card` int NULL DEFAULT 0,
|
||
`owner_card` int NULL DEFAULT 0,
|
||
`create_time` datetime NOT NULL COMMENT '开房时间',
|
||
`makewar_time` datetime NOT NULL COMMENT '开战时间',
|
||
`over_time` datetime NOT NULL COMMENT '结束时间',
|
||
`short_number` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '短号号码',
|
||
`deduct_type` int NULL DEFAULT NULL COMMENT '扣卡模式',
|
||
`deduct_card` int NULL DEFAULT NULL COMMENT '扣卡数',
|
||
`aset_count` int NULL DEFAULT NULL COMMENT '总局数',
|
||
`room_mode` tinyint(1) NULL DEFAULT NULL COMMENT '0-普通房间 1-金币房间',
|
||
`score` int NULL DEFAULT 0 COMMENT '得分',
|
||
`is_winner` tinyint(1) NULL DEFAULT 0 COMMENT '是否大赢家(0: 否; 1: 是)',
|
||
`room_hash` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '房间的hash值',
|
||
`out_id` int NOT NULL,
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `pk_grade_202405`(`id` ASC) USING BTREE,
|
||
UNIQUE INDEX `uk_grade_202405`(`out_id` ASC) USING BTREE,
|
||
INDEX `nk_grade_202405_makewar_time`(`agent_id` ASC, `short_number` ASC, `makewar_time` ASC) USING BTREE,
|
||
INDEX `nk_grade_202405_group_data`(`agent_id` ASC, `channel_id` ASC, `game_id` ASC, `player_id` ASC, `short_number` ASC, `create_time` ASC, `makewar_time` ASC, `over_time` ASC) USING BTREE,
|
||
INDEX `nk_grade_202405_owner_id`(`agent_id` ASC, `owner_id` ASC) USING BTREE,
|
||
INDEX `nk_grade_202405_over_time`(`agent_id` ASC, `short_number` ASC, `over_time` ASC) USING BTREE,
|
||
INDEX `nk_grade_202405_agent_id`(`agent_id` ASC) USING BTREE,
|
||
INDEX `nk_grade_202405_create_time`(`agent_id` ASC, `short_number` ASC, `create_time` ASC) USING BTREE,
|
||
INDEX `nk_makewar_time`(`makewar_time` ASC) USING BTREE,
|
||
INDEX `nk_grade_202405_player_id`(`agent_id` ASC, `player_id` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 430313 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_grade_202406
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_grade_202406`;
|
||
CREATE TABLE `ct_grade_202406` (
|
||
`id` int NOT NULL AUTO_INCREMENT,
|
||
`agent_id` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '代理商id',
|
||
`channel_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '渠道编号',
|
||
`game_id` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '游戏id',
|
||
`player_id` int NOT NULL COMMENT '玩家id',
|
||
`room_code` int NOT NULL COMMENT '房号',
|
||
`room_type` varchar(200) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '房间类型',
|
||
`owner_id` int NULL DEFAULT NULL COMMENT '房主id',
|
||
`room_card` int NULL DEFAULT 0,
|
||
`owner_card` int NULL DEFAULT 0,
|
||
`create_time` datetime NOT NULL COMMENT '开房时间',
|
||
`makewar_time` datetime NOT NULL COMMENT '开战时间',
|
||
`over_time` datetime NOT NULL COMMENT '结束时间',
|
||
`short_number` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '短号号码',
|
||
`deduct_type` int NULL DEFAULT NULL COMMENT '扣卡模式',
|
||
`deduct_card` int NULL DEFAULT NULL COMMENT '扣卡数',
|
||
`aset_count` int NULL DEFAULT NULL COMMENT '总局数',
|
||
`room_mode` tinyint(1) NULL DEFAULT NULL COMMENT '0-普通房间 1-金币房间',
|
||
`score` int NULL DEFAULT 0 COMMENT '得分',
|
||
`is_winner` tinyint(1) NULL DEFAULT 0 COMMENT '是否大赢家(0: 否; 1: 是)',
|
||
`room_hash` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '房间的hash值',
|
||
`out_id` int NOT NULL,
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `pk_grade_202406`(`id` ASC) USING BTREE,
|
||
UNIQUE INDEX `uk_grade_202406`(`out_id` ASC) USING BTREE,
|
||
INDEX `nk_grade_202406_player_id`(`agent_id` ASC, `player_id` ASC) USING BTREE,
|
||
INDEX `nk_grade_202406_owner_id`(`agent_id` ASC, `owner_id` ASC) USING BTREE,
|
||
INDEX `nk_grade_202406_makewar_time`(`agent_id` ASC, `short_number` ASC, `makewar_time` ASC) USING BTREE,
|
||
INDEX `nk_grade_202406_agent_id`(`agent_id` ASC) USING BTREE,
|
||
INDEX `nk_grade_202406_group_data`(`agent_id` ASC, `channel_id` ASC, `game_id` ASC, `player_id` ASC, `short_number` ASC, `create_time` ASC, `makewar_time` ASC, `over_time` ASC) USING BTREE,
|
||
INDEX `nk_makewar_time`(`makewar_time` ASC) USING BTREE,
|
||
INDEX `nk_grade_202406_create_time`(`agent_id` ASC, `short_number` ASC, `create_time` ASC) USING BTREE,
|
||
INDEX `nk_grade_202406_over_time`(`agent_id` ASC, `short_number` ASC, `over_time` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 430313 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_grade_202407
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_grade_202407`;
|
||
CREATE TABLE `ct_grade_202407` (
|
||
`id` int NOT NULL AUTO_INCREMENT,
|
||
`agent_id` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '代理商id',
|
||
`channel_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '渠道编号',
|
||
`game_id` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '游戏id',
|
||
`player_id` int NOT NULL COMMENT '玩家id',
|
||
`room_code` int NOT NULL COMMENT '房号',
|
||
`room_type` varchar(200) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '房间类型',
|
||
`owner_id` int NULL DEFAULT NULL COMMENT '房主id',
|
||
`room_card` int NULL DEFAULT 0,
|
||
`owner_card` int NULL DEFAULT 0,
|
||
`create_time` datetime NOT NULL COMMENT '开房时间',
|
||
`makewar_time` datetime NOT NULL COMMENT '开战时间',
|
||
`over_time` datetime NOT NULL COMMENT '结束时间',
|
||
`short_number` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '短号号码',
|
||
`deduct_type` int NULL DEFAULT NULL COMMENT '扣卡模式',
|
||
`deduct_card` int NULL DEFAULT NULL COMMENT '扣卡数',
|
||
`aset_count` int NULL DEFAULT NULL COMMENT '总局数',
|
||
`room_mode` tinyint(1) NULL DEFAULT NULL COMMENT '0-普通房间 1-金币房间',
|
||
`score` int NULL DEFAULT 0 COMMENT '得分',
|
||
`is_winner` tinyint(1) NULL DEFAULT 0 COMMENT '是否大赢家(0: 否; 1: 是)',
|
||
`room_hash` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '房间的hash值',
|
||
`out_id` int NOT NULL,
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `pk_grade_202407`(`id` ASC) USING BTREE,
|
||
UNIQUE INDEX `uk_grade_202407`(`out_id` ASC) USING BTREE,
|
||
INDEX `nk_grade_202407_makewar_time`(`agent_id` ASC, `short_number` ASC, `makewar_time` ASC) USING BTREE,
|
||
INDEX `nk_grade_202407_over_time`(`agent_id` ASC, `short_number` ASC, `over_time` ASC) USING BTREE,
|
||
INDEX `nk_grade_202407_agent_id`(`agent_id` ASC) USING BTREE,
|
||
INDEX `nk_grade_202407_create_time`(`agent_id` ASC, `short_number` ASC, `create_time` ASC) USING BTREE,
|
||
INDEX `nk_grade_202407_owner_id`(`agent_id` ASC, `owner_id` ASC) USING BTREE,
|
||
INDEX `nk_grade_202407_group_data`(`agent_id` ASC, `channel_id` ASC, `game_id` ASC, `player_id` ASC, `short_number` ASC, `create_time` ASC, `makewar_time` ASC, `over_time` ASC) USING BTREE,
|
||
INDEX `nk_grade_202407_player_id`(`agent_id` ASC, `player_id` ASC) USING BTREE,
|
||
INDEX `nk_makewar_time`(`makewar_time` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 430313 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_grade_202408
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_grade_202408`;
|
||
CREATE TABLE `ct_grade_202408` (
|
||
`id` int NOT NULL AUTO_INCREMENT,
|
||
`agent_id` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '代理商id',
|
||
`channel_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '渠道编号',
|
||
`game_id` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '游戏id',
|
||
`player_id` int NOT NULL COMMENT '玩家id',
|
||
`room_code` int NOT NULL COMMENT '房号',
|
||
`room_type` varchar(200) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '房间类型',
|
||
`owner_id` int NULL DEFAULT NULL COMMENT '房主id',
|
||
`room_card` int NULL DEFAULT 0,
|
||
`owner_card` int NULL DEFAULT 0,
|
||
`create_time` datetime NOT NULL COMMENT '开房时间',
|
||
`makewar_time` datetime NOT NULL COMMENT '开战时间',
|
||
`over_time` datetime NOT NULL COMMENT '结束时间',
|
||
`short_number` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '短号号码',
|
||
`deduct_type` int NULL DEFAULT NULL COMMENT '扣卡模式',
|
||
`deduct_card` int NULL DEFAULT NULL COMMENT '扣卡数',
|
||
`aset_count` int NULL DEFAULT NULL COMMENT '总局数',
|
||
`room_mode` tinyint(1) NULL DEFAULT NULL COMMENT '0-普通房间 1-金币房间',
|
||
`score` int NULL DEFAULT 0 COMMENT '得分',
|
||
`is_winner` tinyint(1) NULL DEFAULT 0 COMMENT '是否大赢家(0: 否; 1: 是)',
|
||
`room_hash` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '房间的hash值',
|
||
`out_id` int NOT NULL,
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `pk_grade_202408`(`id` ASC) USING BTREE,
|
||
UNIQUE INDEX `uk_grade_202408`(`out_id` ASC) USING BTREE,
|
||
INDEX `nk_grade_202408_makewar_time`(`agent_id` ASC, `short_number` ASC, `makewar_time` ASC) USING BTREE,
|
||
INDEX `nk_grade_202408_group_data`(`agent_id` ASC, `channel_id` ASC, `game_id` ASC, `player_id` ASC, `short_number` ASC, `create_time` ASC, `makewar_time` ASC, `over_time` ASC) USING BTREE,
|
||
INDEX `nk_grade_202408_over_time`(`agent_id` ASC, `short_number` ASC, `over_time` ASC) USING BTREE,
|
||
INDEX `nk_grade_202408_create_time`(`agent_id` ASC, `short_number` ASC, `create_time` ASC) USING BTREE,
|
||
INDEX `nk_grade_202408_agent_id`(`agent_id` ASC) USING BTREE,
|
||
INDEX `nk_grade_202408_player_id`(`agent_id` ASC, `player_id` ASC) USING BTREE,
|
||
INDEX `nk_makewar_time`(`makewar_time` ASC) USING BTREE,
|
||
INDEX `nk_grade_202408_owner_id`(`agent_id` ASC, `owner_id` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 430313 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_grade_202409
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_grade_202409`;
|
||
CREATE TABLE `ct_grade_202409` (
|
||
`id` int NOT NULL AUTO_INCREMENT,
|
||
`agent_id` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '代理商id',
|
||
`channel_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '渠道编号',
|
||
`game_id` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '游戏id',
|
||
`player_id` int NOT NULL COMMENT '玩家id',
|
||
`room_code` int NOT NULL COMMENT '房号',
|
||
`room_type` varchar(200) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '房间类型',
|
||
`owner_id` int NULL DEFAULT NULL COMMENT '房主id',
|
||
`room_card` int NULL DEFAULT 0,
|
||
`owner_card` int NULL DEFAULT 0,
|
||
`create_time` datetime NOT NULL COMMENT '开房时间',
|
||
`makewar_time` datetime NOT NULL COMMENT '开战时间',
|
||
`over_time` datetime NOT NULL COMMENT '结束时间',
|
||
`short_number` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '短号号码',
|
||
`deduct_type` int NULL DEFAULT NULL COMMENT '扣卡模式',
|
||
`deduct_card` int NULL DEFAULT NULL COMMENT '扣卡数',
|
||
`aset_count` int NULL DEFAULT NULL COMMENT '总局数',
|
||
`room_mode` tinyint(1) NULL DEFAULT NULL COMMENT '0-普通房间 1-金币房间',
|
||
`score` int NULL DEFAULT 0 COMMENT '得分',
|
||
`is_winner` tinyint(1) NULL DEFAULT 0 COMMENT '是否大赢家(0: 否; 1: 是)',
|
||
`room_hash` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '房间的hash值',
|
||
`out_id` int NOT NULL,
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `pk_grade_202409`(`id` ASC) USING BTREE,
|
||
UNIQUE INDEX `uk_grade_202409`(`out_id` ASC) USING BTREE,
|
||
INDEX `nk_grade_202409_create_time`(`agent_id` ASC, `short_number` ASC, `create_time` ASC) USING BTREE,
|
||
INDEX `nk_grade_202409_makewar_time`(`agent_id` ASC, `short_number` ASC, `makewar_time` ASC) USING BTREE,
|
||
INDEX `nk_grade_202409_group_data`(`agent_id` ASC, `channel_id` ASC, `game_id` ASC, `player_id` ASC, `short_number` ASC, `create_time` ASC, `makewar_time` ASC, `over_time` ASC) USING BTREE,
|
||
INDEX `nk_grade_202409_player_id`(`agent_id` ASC, `player_id` ASC) USING BTREE,
|
||
INDEX `nk_grade_202409_agent_id`(`agent_id` ASC) USING BTREE,
|
||
INDEX `nk_grade_202409_owner_id`(`agent_id` ASC, `owner_id` ASC) USING BTREE,
|
||
INDEX `nk_grade_202409_over_time`(`agent_id` ASC, `short_number` ASC, `over_time` ASC) USING BTREE,
|
||
INDEX `nk_makewar_time`(`makewar_time` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 430313 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_grade_202410
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_grade_202410`;
|
||
CREATE TABLE `ct_grade_202410` (
|
||
`id` int NOT NULL AUTO_INCREMENT,
|
||
`agent_id` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '代理商id',
|
||
`channel_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '渠道编号',
|
||
`game_id` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '游戏id',
|
||
`player_id` int NOT NULL COMMENT '玩家id',
|
||
`room_code` int NOT NULL COMMENT '房号',
|
||
`room_type` varchar(200) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '房间类型',
|
||
`owner_id` int NULL DEFAULT NULL COMMENT '房主id',
|
||
`room_card` int NULL DEFAULT 0,
|
||
`owner_card` int NULL DEFAULT 0,
|
||
`create_time` datetime NOT NULL COMMENT '开房时间',
|
||
`makewar_time` datetime NOT NULL COMMENT '开战时间',
|
||
`over_time` datetime NOT NULL COMMENT '结束时间',
|
||
`short_number` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '短号号码',
|
||
`deduct_type` int NULL DEFAULT NULL COMMENT '扣卡模式',
|
||
`deduct_card` int NULL DEFAULT NULL COMMENT '扣卡数',
|
||
`aset_count` int NULL DEFAULT NULL COMMENT '总局数',
|
||
`room_mode` tinyint(1) NULL DEFAULT NULL COMMENT '0-普通房间 1-金币房间',
|
||
`score` int NULL DEFAULT 0 COMMENT '得分',
|
||
`is_winner` tinyint(1) NULL DEFAULT 0 COMMENT '是否大赢家(0: 否; 1: 是)',
|
||
`room_hash` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '房间的hash值',
|
||
`out_id` int NOT NULL,
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `pk_grade_202410`(`id` ASC) USING BTREE,
|
||
UNIQUE INDEX `uk_grade_202410`(`out_id` ASC) USING BTREE,
|
||
INDEX `nk_grade_202410_create_time`(`agent_id` ASC, `short_number` ASC, `create_time` ASC) USING BTREE,
|
||
INDEX `nk_grade_202410_player_id`(`agent_id` ASC, `player_id` ASC) USING BTREE,
|
||
INDEX `nk_grade_202410_makewar_time`(`agent_id` ASC, `short_number` ASC, `makewar_time` ASC) USING BTREE,
|
||
INDEX `nk_grade_202410_agent_id`(`agent_id` ASC) USING BTREE,
|
||
INDEX `nk_grade_202410_over_time`(`agent_id` ASC, `short_number` ASC, `over_time` ASC) USING BTREE,
|
||
INDEX `nk_grade_202410_group_data`(`agent_id` ASC, `channel_id` ASC, `game_id` ASC, `player_id` ASC, `short_number` ASC, `create_time` ASC, `makewar_time` ASC, `over_time` ASC) USING BTREE,
|
||
INDEX `nk_makewar_time`(`makewar_time` ASC) USING BTREE,
|
||
INDEX `nk_grade_202410_owner_id`(`agent_id` ASC, `owner_id` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 430313 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_grade_202411
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_grade_202411`;
|
||
CREATE TABLE `ct_grade_202411` (
|
||
`id` int NOT NULL AUTO_INCREMENT,
|
||
`agent_id` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '代理商id',
|
||
`channel_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '渠道编号',
|
||
`game_id` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '游戏id',
|
||
`player_id` int NOT NULL COMMENT '玩家id',
|
||
`room_code` int NOT NULL COMMENT '房号',
|
||
`room_type` varchar(200) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '房间类型',
|
||
`owner_id` int NULL DEFAULT NULL COMMENT '房主id',
|
||
`room_card` int NULL DEFAULT 0,
|
||
`owner_card` int NULL DEFAULT 0,
|
||
`create_time` datetime NOT NULL COMMENT '开房时间',
|
||
`makewar_time` datetime NOT NULL COMMENT '开战时间',
|
||
`over_time` datetime NOT NULL COMMENT '结束时间',
|
||
`short_number` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '短号号码',
|
||
`deduct_type` int NULL DEFAULT NULL COMMENT '扣卡模式',
|
||
`deduct_card` int NULL DEFAULT NULL COMMENT '扣卡数',
|
||
`aset_count` int NULL DEFAULT NULL COMMENT '总局数',
|
||
`room_mode` tinyint(1) NULL DEFAULT NULL COMMENT '0-普通房间 1-金币房间',
|
||
`score` int NULL DEFAULT 0 COMMENT '得分',
|
||
`is_winner` tinyint(1) NULL DEFAULT 0 COMMENT '是否大赢家(0: 否; 1: 是)',
|
||
`room_hash` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '房间的hash值',
|
||
`out_id` int NOT NULL,
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `pk_grade_202411`(`id` ASC) USING BTREE,
|
||
UNIQUE INDEX `uk_grade_202411`(`out_id` ASC) USING BTREE,
|
||
INDEX `nk_grade_202411_player_id`(`agent_id` ASC, `player_id` ASC) USING BTREE,
|
||
INDEX `nk_grade_202411_owner_id`(`agent_id` ASC, `owner_id` ASC) USING BTREE,
|
||
INDEX `nk_grade_202411_over_time`(`agent_id` ASC, `short_number` ASC, `over_time` ASC) USING BTREE,
|
||
INDEX `nk_grade_202411_group_data`(`agent_id` ASC, `channel_id` ASC, `game_id` ASC, `player_id` ASC, `short_number` ASC, `create_time` ASC, `makewar_time` ASC, `over_time` ASC) USING BTREE,
|
||
INDEX `nk_grade_202411_create_time`(`agent_id` ASC, `short_number` ASC, `create_time` ASC) USING BTREE,
|
||
INDEX `nk_grade_202411_agent_id`(`agent_id` ASC) USING BTREE,
|
||
INDEX `nk_grade_202411_makewar_time`(`agent_id` ASC, `short_number` ASC, `makewar_time` ASC) USING BTREE,
|
||
INDEX `nk_makewar_time`(`makewar_time` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 430313 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_grade_202412
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_grade_202412`;
|
||
CREATE TABLE `ct_grade_202412` (
|
||
`id` int NOT NULL AUTO_INCREMENT,
|
||
`agent_id` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '代理商id',
|
||
`channel_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '渠道编号',
|
||
`game_id` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '游戏id',
|
||
`player_id` int NOT NULL COMMENT '玩家id',
|
||
`room_code` int NOT NULL COMMENT '房号',
|
||
`room_type` varchar(200) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '房间类型',
|
||
`owner_id` int NULL DEFAULT NULL COMMENT '房主id',
|
||
`room_card` int NULL DEFAULT 0,
|
||
`owner_card` int NULL DEFAULT 0,
|
||
`create_time` datetime NOT NULL COMMENT '开房时间',
|
||
`makewar_time` datetime NOT NULL COMMENT '开战时间',
|
||
`over_time` datetime NOT NULL COMMENT '结束时间',
|
||
`short_number` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '短号号码',
|
||
`deduct_type` int NULL DEFAULT NULL COMMENT '扣卡模式',
|
||
`deduct_card` int NULL DEFAULT NULL COMMENT '扣卡数',
|
||
`aset_count` int NULL DEFAULT NULL COMMENT '总局数',
|
||
`room_mode` tinyint(1) NULL DEFAULT NULL COMMENT '0-普通房间 1-金币房间',
|
||
`score` int NULL DEFAULT 0 COMMENT '得分',
|
||
`is_winner` tinyint(1) NULL DEFAULT 0 COMMENT '是否大赢家(0: 否; 1: 是)',
|
||
`room_hash` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '房间的hash值',
|
||
`out_id` int NOT NULL,
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `pk_grade_202412`(`id` ASC) USING BTREE,
|
||
UNIQUE INDEX `uk_grade_202412`(`out_id` ASC) USING BTREE,
|
||
INDEX `nk_grade_202412_over_time`(`agent_id` ASC, `short_number` ASC, `over_time` ASC) USING BTREE,
|
||
INDEX `nk_grade_202412_group_data`(`agent_id` ASC, `channel_id` ASC, `game_id` ASC, `player_id` ASC, `short_number` ASC, `create_time` ASC, `makewar_time` ASC, `over_time` ASC) USING BTREE,
|
||
INDEX `nk_grade_202412_create_time`(`agent_id` ASC, `short_number` ASC, `create_time` ASC) USING BTREE,
|
||
INDEX `nk_grade_202412_owner_id`(`agent_id` ASC, `owner_id` ASC) USING BTREE,
|
||
INDEX `nk_makewar_time`(`makewar_time` ASC) USING BTREE,
|
||
INDEX `nk_grade_202412_makewar_time`(`agent_id` ASC, `short_number` ASC, `makewar_time` ASC) USING BTREE,
|
||
INDEX `nk_grade_202412_agent_id`(`agent_id` ASC) USING BTREE,
|
||
INDEX `nk_grade_202412_player_id`(`agent_id` ASC, `player_id` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 430313 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_grade_core
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_grade_core`;
|
||
CREATE TABLE `ct_grade_core` (
|
||
`id` int NOT NULL AUTO_INCREMENT,
|
||
`agent_id` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '代理商id',
|
||
`channel_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '渠道',
|
||
`game_id` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '游戏id',
|
||
`player_id` int NULL DEFAULT NULL COMMENT '玩家id',
|
||
`nick_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '昵称',
|
||
`player_core` int NULL DEFAULT NULL COMMENT '得分',
|
||
`room_code` int NOT NULL COMMENT '房号',
|
||
`room_type` varchar(200) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '房间类型',
|
||
`owner_id` int NULL DEFAULT NULL COMMENT '房主id',
|
||
`room_card` int NULL DEFAULT 0,
|
||
`owner_card` int NULL DEFAULT 0,
|
||
`create_time` datetime NOT NULL COMMENT '开房时间',
|
||
`makewar_time` datetime NOT NULL COMMENT '开战时间',
|
||
`over_time` datetime NOT NULL COMMENT '结束时间',
|
||
`is_done` int NULL DEFAULT 1,
|
||
`out_id` int NOT NULL,
|
||
`out_sub_id` int NOT NULL,
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `pk_grade_core`(`id` ASC) USING BTREE,
|
||
UNIQUE INDEX `uk_grade_core`(`out_id` ASC, `out_sub_id` ASC) USING BTREE,
|
||
INDEX `nk_grade_core_player_id`(`agent_id` ASC, `channel_id` ASC, `game_id` ASC, `player_id` ASC, `nick_name`(191) ASC) USING BTREE,
|
||
INDEX `nk_grade_core_create_time`(`agent_id` ASC, `channel_id` ASC, `game_id` ASC, `create_time` ASC) USING BTREE
|
||
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_grade_temp
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_grade_temp`;
|
||
CREATE TABLE `ct_grade_temp` (
|
||
`id` int NOT NULL AUTO_INCREMENT,
|
||
`agent_id` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '代理商id',
|
||
`channel_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '渠道编号',
|
||
`game_id` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '游戏id',
|
||
`player_id` int NOT NULL COMMENT '玩家id',
|
||
`room_code` int NOT NULL COMMENT '房号',
|
||
`room_type` varchar(200) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '房间类型',
|
||
`owner_id` int NULL DEFAULT NULL COMMENT '房主id',
|
||
`room_card` int NULL DEFAULT 0,
|
||
`owner_card` int NULL DEFAULT 0,
|
||
`create_time` datetime NOT NULL COMMENT '开房时间',
|
||
`makewar_time` datetime NOT NULL COMMENT '开战时间',
|
||
`over_time` datetime NOT NULL COMMENT '结束时间',
|
||
`short_number` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '短号号码',
|
||
`deduct_type` int NULL DEFAULT NULL COMMENT '扣卡模式',
|
||
`deduct_card` int NULL DEFAULT NULL COMMENT '扣卡数',
|
||
`aset_count` int NULL DEFAULT NULL COMMENT '总局数',
|
||
`room_mode` tinyint NULL DEFAULT NULL COMMENT '0-普通房间 1-金币房间',
|
||
`out_id` int NOT NULL,
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `pk_grade_temp`(`id` ASC) USING BTREE,
|
||
UNIQUE INDEX `uk_grade_temp`(`out_id` ASC) USING BTREE,
|
||
INDEX `nk_grade_temp_create_time`(`agent_id` ASC, `channel_id` ASC, `game_id` ASC, `short_number` ASC, `create_time` ASC) USING BTREE,
|
||
INDEX `nk_grade_temp_group_data`(`agent_id` ASC, `channel_id` ASC, `player_id` ASC, `short_number` ASC, `create_time` ASC) USING BTREE,
|
||
INDEX `nk_grade_temp_group_short_number_data`(`agent_id` ASC, `short_number` ASC, `create_time` ASC) USING BTREE,
|
||
INDEX `nk_grade_temp_owner_id`(`agent_id` ASC, `owner_id` ASC) USING BTREE,
|
||
INDEX `nk_grade_temp_makewar_time`(`agent_id` ASC, `short_number` ASC, `makewar_time` ASC) USING BTREE,
|
||
INDEX `nk_grade_temp_player_id`(`agent_id` ASC, `channel_id` ASC, `game_id` ASC, `player_id` ASC) USING BTREE,
|
||
INDEX `nk_grade_temp_agent_id`(`agent_id` ASC) USING BTREE,
|
||
INDEX `nk_grade_temp_over_time`(`agent_id` ASC, `short_number` ASC, `over_time` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 74271 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_group_authorization
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_group_authorization`;
|
||
CREATE TABLE `ct_group_authorization` (
|
||
`id` int NOT NULL AUTO_INCREMENT,
|
||
`group_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '用户组标识',
|
||
`group_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '用户组名称',
|
||
`module_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '模块(接口)标识',
|
||
`group_auth` int NOT NULL DEFAULT 0 COMMENT '权限(0:无;1:有;2:所有)',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `uk_group_authorization`(`group_id` ASC, `module_id` ASC) USING BTREE,
|
||
UNIQUE INDEX `pk_group_authorization`(`id` ASC) USING BTREE,
|
||
INDEX `nk_group_authorization`(`group_id` ASC, `module_id` ASC, `group_auth` ASC) USING BTREE
|
||
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_group_info
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_group_info`;
|
||
CREATE TABLE `ct_group_info` (
|
||
`group_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
|
||
`group_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
||
`remark` varchar(2000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
||
PRIMARY KEY (`group_id`) USING BTREE,
|
||
UNIQUE INDEX `pk_group_info`(`group_id` ASC) USING BTREE
|
||
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_manager_auth
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_manager_auth`;
|
||
CREATE TABLE `ct_manager_auth` (
|
||
`id` int UNSIGNED NOT NULL AUTO_INCREMENT,
|
||
`login_id` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '关联到统一账户的id',
|
||
`report_id` int NULL DEFAULT NULL,
|
||
`status` tinyint(1) NULL DEFAULT 1 COMMENT 'status',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `pk_manager_info`(`id` ASC) USING BTREE,
|
||
INDEX `nk_manager_info`(`login_id` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 9722 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_manager_channel_info
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_manager_channel_info`;
|
||
CREATE TABLE `ct_manager_channel_info` (
|
||
`manager_id` int NOT NULL COMMENT '管理员id',
|
||
`list_id` int NOT NULL COMMENT 'ct_channel_list的主键',
|
||
`agent_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '代理商id',
|
||
`channel_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '渠道id',
|
||
`create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间',
|
||
`is_enabled` int NULL DEFAULT 1 COMMENT '是否有效(0:无效;1:有效)',
|
||
PRIMARY KEY (`manager_id`, `list_id`, `agent_id`, `channel_id`) USING BTREE,
|
||
UNIQUE INDEX `pk_manager_channel_info_2`(`manager_id` ASC, `agent_id` ASC, `channel_id` ASC) USING BTREE,
|
||
UNIQUE INDEX `pk_manager_channel_info_1`(`manager_id` ASC, `list_id` ASC) USING BTREE
|
||
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '管理员渠道信息表' ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_manager_info
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_manager_info`;
|
||
CREATE TABLE `ct_manager_info` (
|
||
`id` int UNSIGNED NOT NULL AUTO_INCREMENT,
|
||
`user_id` int NULL DEFAULT NULL COMMENT '关联到统一账户的id',
|
||
`login_id` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '登录账户',
|
||
`password` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '登录密码',
|
||
`salt` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '密码加密盐',
|
||
`nick_name` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '昵称',
|
||
`sex` int NULL DEFAULT 0 COMMENT '性别(1:男;2:女)',
|
||
`avatar` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '头像',
|
||
`level` int NULL DEFAULT -1 COMMENT '账户等级(0:超级管理员;1:渠道管理员;2:总代理;3:普通用户;-1:无)',
|
||
`phone` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '电话号码',
|
||
`create_time` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间',
|
||
`is_enabled` int NULL DEFAULT 1 COMMENT '是否有效(0:无效;1:有效)',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `uk_manager_info_login_id`(`login_id` ASC) USING BTREE,
|
||
UNIQUE INDEX `pk_manager_info`(`id` ASC) USING BTREE,
|
||
INDEX `nk_manager_info`(`user_id` ASC, `login_id` ASC, `password` ASC, `salt` ASC, `level` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 25 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '操作员(管理员)信息表' ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_manager_production_info
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_manager_production_info`;
|
||
CREATE TABLE `ct_manager_production_info` (
|
||
`id` int UNSIGNED NOT NULL AUTO_INCREMENT,
|
||
`agent_id` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '代理',
|
||
`channel_id` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '渠道',
|
||
`from_user` int NOT NULL DEFAULT 0 COMMENT '来源用户id(总代理id)',
|
||
`to_user` int NOT NULL COMMENT '代理或玩家编号',
|
||
`user_type` int NOT NULL DEFAULT 0 COMMENT '用户类型(1:玩家;2:代理;)',
|
||
`production_type` int NOT NULL DEFAULT 0 COMMENT '生产类型(1:房卡;2:金币)',
|
||
`amount` int NOT NULL COMMENT '数量',
|
||
`before_update` int NOT NULL COMMENT '生效前的数量',
|
||
`after_update` int NOT NULL COMMENT '生效后的数量',
|
||
`oper_type` int NOT NULL DEFAULT 0 COMMENT '操作类型(1:发出;2:扣除)',
|
||
`create_time` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT '时间',
|
||
`source_from` varchar(2000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '来源渠道',
|
||
`remark` varchar(2000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `pk_manager_production_info`(`id` ASC) USING BTREE,
|
||
INDEX `nk_manager_production_info`(`agent_id` ASC, `channel_id` ASC, `from_user` ASC, `to_user` ASC, `user_type` ASC, `production_type` ASC, `amount` ASC, `before_update` ASC, `after_update` ASC, `create_time` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 6504 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '总代理发出/扣罚流水' ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_order_info
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_order_info`;
|
||
CREATE TABLE `ct_order_info` (
|
||
`id` int UNSIGNED NOT NULL AUTO_INCREMENT,
|
||
`parent_id` int UNSIGNED NULL DEFAULT NULL COMMENT '关联的上级编号',
|
||
`agent_id` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '' COMMENT '代理商id',
|
||
`channel_id` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '' COMMENT '渠道id',
|
||
`order_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '订单编号',
|
||
`parent_order_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '关联的上级订单编号',
|
||
`product_id` int UNSIGNED NOT NULL COMMENT '产品编号',
|
||
`product_amount` int UNSIGNED NOT NULL COMMENT '产品数量',
|
||
`product_money` decimal(18, 2) UNSIGNED NOT NULL COMMENT '产品金额',
|
||
`product_type` int NOT NULL DEFAULT 0 COMMENT '0、房卡,1、星星,2、钻石',
|
||
`pay_status` int UNSIGNED NOT NULL DEFAULT 0 COMMENT '支付状态 0-未支付 1-已支付 2-已退款',
|
||
`pay_money` decimal(18, 2) UNSIGNED NULL DEFAULT NULL COMMENT '实际支付金额',
|
||
`order_time` int UNSIGNED NOT NULL COMMENT '订单创建时间',
|
||
`pay_time` int UNSIGNED NULL DEFAULT NULL COMMENT '支付时间',
|
||
`refund_time` int UNSIGNED NULL DEFAULT NULL COMMENT '退款时间',
|
||
`order_type` int UNSIGNED NULL DEFAULT 0 COMMENT '订单类型(0:玩家;1:代理)',
|
||
`player_id` int UNSIGNED NULL DEFAULT NULL COMMENT '玩家编号',
|
||
`sales_id` int UNSIGNED NULL DEFAULT NULL COMMENT '代理编号',
|
||
`nick_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '玩家或代理昵称',
|
||
`out_trade_no` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '三方平台订单号',
|
||
`transaction_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '支付通道订单号',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `pk_order_info`(`id` ASC) USING BTREE,
|
||
UNIQUE INDEX `uk_order_info`(`order_id` ASC) USING BTREE,
|
||
UNIQUE INDEX `uk_order_info_agent_order`(`agent_id` ASC, `channel_id` ASC, `order_id` ASC) USING BTREE,
|
||
UNIQUE INDEX `uk_order_info_order_product_type`(`order_id` ASC, `product_type` ASC) USING BTREE,
|
||
INDEX `nk_order_info_parent_id`(`parent_id` ASC) USING BTREE,
|
||
INDEX `nk_order_info_parent_order`(`parent_order_id` ASC) USING BTREE,
|
||
INDEX `nk_order_info_parent_order_product_type`(`parent_order_id` ASC, `product_type` ASC) USING BTREE,
|
||
INDEX `nk_order_info_sales_id`(`agent_id` ASC, `channel_id` ASC, `sales_id` ASC) USING BTREE,
|
||
INDEX `nk_order_info_player_id`(`agent_id` ASC, `channel_id` ASC, `player_id` ASC) USING BTREE,
|
||
INDEX `nk_order_info_agent_channel`(`agent_id` ASC, `channel_id` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 556 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_pay_for_third
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_pay_for_third`;
|
||
CREATE TABLE `ct_pay_for_third` (
|
||
`id` int UNSIGNED NOT NULL AUTO_INCREMENT,
|
||
`agent_id` char(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '代理商id',
|
||
`channel_id` char(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '渠道id',
|
||
`player_id` int UNSIGNED NOT NULL COMMENT '玩家编号',
|
||
`transaction_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '订单编号',
|
||
`fee` decimal(18, 4) NULL DEFAULT NULL COMMENT '金额',
|
||
`type` int UNSIGNED NOT NULL COMMENT '类型(1:三方购买房卡;2:三方购买金币;101:三方转账房卡;102:三方转账星星;)',
|
||
`amount` decimal(18, 4) NOT NULL COMMENT '房卡或金币的数量',
|
||
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||
`from_sign` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '来源标志',
|
||
`log_id` int NULL DEFAULT NULL COMMENT '日志流水编号',
|
||
`remark` varchar(2000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `pk_pay_for_third`(`id` ASC) USING BTREE,
|
||
INDEX `nk_pay_for_third_agent`(`agent_id` ASC, `channel_id` ASC) USING BTREE,
|
||
INDEX `nk_pay_for_third_player_id`(`agent_id` ASC, `channel_id` ASC, `player_id` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 630 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '第三方代付流水表' ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_player_login_info
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_player_login_info`;
|
||
CREATE TABLE `ct_player_login_info` (
|
||
`id` int UNSIGNED NOT NULL AUTO_INCREMENT,
|
||
`agent_id` char(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '代理商id',
|
||
`channel_id` char(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '渠道id',
|
||
`player_id` int NULL DEFAULT NULL COMMENT '玩家编号',
|
||
`login_time` datetime NULL DEFAULT NULL COMMENT '登陆时间',
|
||
`from_sign` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '来源',
|
||
PRIMARY KEY (`id`) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 1416 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_production_info
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_production_info`;
|
||
CREATE TABLE `ct_production_info` (
|
||
`id` int UNSIGNED NOT NULL AUTO_INCREMENT,
|
||
`agent_id` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '代理',
|
||
`channel_id` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '渠道',
|
||
`from_user` int NOT NULL DEFAULT 0 COMMENT '来源用户id',
|
||
`to_user` int NOT NULL COMMENT '代理或玩家编号',
|
||
`user_type` int NOT NULL DEFAULT 0 COMMENT '用户类型(1:玩家;2:代理;)',
|
||
`production_type` int NOT NULL DEFAULT 0 COMMENT '生产类型(1:房卡;2:金币)',
|
||
`amount` int NOT NULL COMMENT '数量',
|
||
`before_update` int NOT NULL COMMENT '生效前的数量',
|
||
`after_update` int NOT NULL COMMENT '生效后的数量',
|
||
`oper_type` int NOT NULL DEFAULT 0 COMMENT '操作类型(1:发出;2:扣除)',
|
||
`create_time` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT '时间',
|
||
`source_from` varchar(2000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '来源渠道',
|
||
`remark` varchar(2000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `pk_production_info`(`id` ASC) USING BTREE,
|
||
INDEX `nk_production_info`(`agent_id` ASC, `channel_id` ASC, `from_user` ASC, `to_user` ASC, `user_type` ASC, `production_type` ASC, `amount` ASC, `before_update` ASC, `after_update` ASC, `create_time` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 800 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '生产流水' ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_report_cate
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_report_cate`;
|
||
CREATE TABLE `ct_report_cate` (
|
||
`id` int NOT NULL,
|
||
`name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '分类名称',
|
||
`icon` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '图标',
|
||
`url` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT 'url',
|
||
`sort` int NULL DEFAULT 50 COMMENT '排序',
|
||
`status` int NULL DEFAULT 1 COMMENT '状态:1开启 0关闭',
|
||
PRIMARY KEY (`id`) USING BTREE
|
||
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_report_ext_sql
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_report_ext_sql`;
|
||
CREATE TABLE `ct_report_ext_sql` (
|
||
`id` int UNSIGNED NOT NULL AUTO_INCREMENT,
|
||
`name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '名称',
|
||
`sql` varchar(4000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '自动执行的sql语句',
|
||
`params` varchar(320) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '参数(,分割)',
|
||
`status` int NULL DEFAULT 1 COMMENT '状态(1 开启, 0 关闭)',
|
||
`table` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '对应的数据库表名',
|
||
PRIMARY KEY (`id`) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 14 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_report_info
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_report_info`;
|
||
CREATE TABLE `ct_report_info` (
|
||
`id` int NOT NULL AUTO_INCREMENT,
|
||
`agent_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
|
||
`channel_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
|
||
`sales_id` int NULL DEFAULT 0,
|
||
`report_id` int NOT NULL,
|
||
`report_date` date NOT NULL,
|
||
`report_data` int NULL DEFAULT 0,
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `pk_report_info`(`id` ASC) USING BTREE,
|
||
UNIQUE INDEX `uk_report_info`(`agent_id` ASC, `channel_id` ASC, `sales_id` ASC, `report_id` ASC, `report_date` ASC) USING BTREE,
|
||
INDEX `nk_report_info`(`agent_id` ASC, `channel_id` ASC, `report_id` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 2978272 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_report_list
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_report_list`;
|
||
CREATE TABLE `ct_report_list` (
|
||
`report_id` int UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '报表编号',
|
||
`cate_id` int NULL DEFAULT NULL COMMENT '分类id',
|
||
`report_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '报表名称',
|
||
`agent_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '代理id',
|
||
`channel_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '渠道id',
|
||
`report_caption` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '显示名称',
|
||
`command_line` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT 'sql语句',
|
||
`summary_type` int NULL DEFAULT 0 COMMENT '计算月或年数据时的汇总方式(0: 相加; 1: 最大值; 2: 最小值; 3: 平均值; 4: 第一个值; 5: 最后一个值)',
|
||
`is_group` int NULL DEFAULT 0 COMMENT '是否按sales_id分组(0:否;1:是);\r\n如果按sales_id分组则统计的数据会以sales_id分组统计;\r\n否则统计数据为agent_id下所有总和,并且sales_id为空。',
|
||
`is_admin` int NULL DEFAULT 0 COMMENT '是否需要管理员权限(0:否;1:是)',
|
||
`is_autorun` int NULL DEFAULT 0 COMMENT '是否需要自动计算(0:否;1:是)',
|
||
`is_mobile` int NULL DEFAULT 0 COMMENT '是否是移动平台(0:否;1:是)',
|
||
`is_enabled` int NULL DEFAULT 1 COMMENT '是否启用(0:不启用;1:启用)',
|
||
`url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '前端菜单地址',
|
||
`desc` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL COMMENT '报表简介',
|
||
PRIMARY KEY (`report_id`) USING BTREE,
|
||
UNIQUE INDEX `pk_report_list`(`report_id` ASC) USING BTREE,
|
||
UNIQUE INDEX `uk_report_list`(`agent_id` ASC, `channel_id` ASC, `report_id` ASC) USING BTREE,
|
||
INDEX `nk_report_list`(`agent_id` ASC, `channel_id` ASC, `report_id` ASC, `is_group` ASC, `is_admin` ASC, `is_autorun` ASC, `is_mobile` ASC, `is_enabled` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 10080 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_report_offline_data
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_report_offline_data`;
|
||
CREATE TABLE `ct_report_offline_data` (
|
||
`id` int UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||
`agent_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '代理商id',
|
||
`channel_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '渠道id',
|
||
`data` int NOT NULL DEFAULT 0 COMMENT '数据',
|
||
`type` tinyint NOT NULL DEFAULT 0 COMMENT '类型 0-待定 1-房卡赠送数',
|
||
`remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '备注',
|
||
`checked_time` date NOT NULL DEFAULT '0000-00-00' COMMENT '选中的时间',
|
||
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '生成时间',
|
||
`status` tinyint NOT NULL DEFAULT 1 COMMENT '状态 0-删除 1-正常',
|
||
PRIMARY KEY (`id`) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 16 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_report_player_buy_record
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_report_player_buy_record`;
|
||
CREATE TABLE `ct_report_player_buy_record` (
|
||
`id` int UNSIGNED NOT NULL AUTO_INCREMENT,
|
||
`agent_id` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '' COMMENT '代理商id',
|
||
`channel_id` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '' COMMENT '渠道id',
|
||
`channel_name` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '' COMMENT '渠道名',
|
||
`player_id` mediumint UNSIGNED NOT NULL DEFAULT 0 COMMENT '玩家id',
|
||
`player_name` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '' COMMENT '玩家名称',
|
||
`player_avatar` varchar(200) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '' COMMENT '玩家头像',
|
||
`buy_card_sum` int UNSIGNED NOT NULL DEFAULT 0 COMMENT '购卡数',
|
||
`buy_card_money_sum` decimal(10, 2) NOT NULL DEFAULT 0.00 COMMENT '购卡金额',
|
||
`buy_star_sum` int UNSIGNED NOT NULL DEFAULT 0 COMMENT '购星数',
|
||
`buy_star_money_sum` decimal(10, 2) NOT NULL DEFAULT 0.00 COMMENT '购星金额',
|
||
`deduct_card_sum` int UNSIGNED NOT NULL DEFAULT 0 COMMENT '扣卡数',
|
||
`time` date NOT NULL DEFAULT '0000-00-00' COMMENT '时间',
|
||
`phone` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '手机号码',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `pk_report_player_buy_record`(`id` ASC) USING BTREE,
|
||
INDEX `nk_report_player_buy_record_player_id`(`agent_id` ASC, `channel_id` ASC, `player_id` ASC) USING BTREE,
|
||
INDEX `nk_report_player_buy_record_time`(`time` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 3195881 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci COMMENT = '统计表-玩家购买房卡、星星和消耗记录表' ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_report_player_room_open
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_report_player_room_open`;
|
||
CREATE TABLE `ct_report_player_room_open` (
|
||
`id` int UNSIGNED NOT NULL AUTO_INCREMENT,
|
||
`agent_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '代理id',
|
||
`channel_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '渠道id',
|
||
`player_id` int NULL DEFAULT NULL COMMENT '玩家id',
|
||
`nickname` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '昵称',
|
||
`avatar` varchar(320) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '头像',
|
||
`count` int NULL DEFAULT NULL COMMENT '总开房数',
|
||
`time` datetime NULL DEFAULT NULL COMMENT '时间',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `pk_report_player_room_open`(`id` ASC) USING BTREE,
|
||
INDEX `nk_report_player_room_open_time`(`time` ASC) USING BTREE,
|
||
INDEX `nk_report_player_room_open_player_id`(`agent_id` ASC, `channel_id` ASC, `player_id` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 2002242 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_report_player_roomcard_record
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_report_player_roomcard_record`;
|
||
CREATE TABLE `ct_report_player_roomcard_record` (
|
||
`id` int UNSIGNED NOT NULL AUTO_INCREMENT,
|
||
`agent_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '代理id',
|
||
`channel_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '渠道id',
|
||
`player_id` int NULL DEFAULT NULL COMMENT '玩家id',
|
||
`by_transfer` int NULL DEFAULT NULL COMMENT '代理转入统计',
|
||
`by_ask` int NULL DEFAULT NULL COMMENT '索卡统计',
|
||
`by_charge` int NULL DEFAULT NULL COMMENT '充卡统计',
|
||
`count` int NULL DEFAULT NULL COMMENT '汇总',
|
||
`time` datetime NULL DEFAULT NULL COMMENT '统计时间',
|
||
`avatar` varchar(320) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
||
`nickname` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `pk_report_player_roomcard_record`(`id` ASC) USING BTREE,
|
||
INDEX `nk_report_player_roomcard_record_player_id`(`agent_id` ASC, `channel_id` ASC, `player_id` ASC) USING BTREE,
|
||
INDEX `nk_report_player_roomcard_record_time`(`time` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 725524 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_report_player_roomcard_use
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_report_player_roomcard_use`;
|
||
CREATE TABLE `ct_report_player_roomcard_use` (
|
||
`id` int UNSIGNED NOT NULL AUTO_INCREMENT,
|
||
`agent_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '代理id',
|
||
`channel_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '渠道id',
|
||
`player_id` int NULL DEFAULT NULL COMMENT '玩家id',
|
||
`count` int NULL DEFAULT NULL COMMENT '消耗房卡数统计',
|
||
`time` datetime NULL DEFAULT NULL COMMENT '统计时间',
|
||
`avatar` varchar(320) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
||
`nickname` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `pk_report_player_roomcard_use`(`id` ASC) USING BTREE,
|
||
INDEX `nk_report_player_roomcard_use_time`(`time` ASC) USING BTREE,
|
||
INDEX `nk_report_player_roomcard_use_player_id`(`agent_id` ASC, `channel_id` ASC, `player_id` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 3215538 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_report_player_star_record
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_report_player_star_record`;
|
||
CREATE TABLE `ct_report_player_star_record` (
|
||
`id` int UNSIGNED NOT NULL AUTO_INCREMENT,
|
||
`agent_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '代理id',
|
||
`channel_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '渠道id',
|
||
`player_id` int NULL DEFAULT NULL COMMENT '玩家id',
|
||
`by_transfer` int NULL DEFAULT NULL COMMENT '代理转入统计',
|
||
`by_ask` int NULL DEFAULT NULL COMMENT '索要统计',
|
||
`by_charge` int NULL DEFAULT NULL COMMENT '充值统计',
|
||
`count` int NULL DEFAULT NULL COMMENT '汇总',
|
||
`time` datetime NULL DEFAULT NULL COMMENT '统计时间',
|
||
`avatar` varchar(320) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
||
`nickname` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `pk_report_player_star_record`(`id` ASC) USING BTREE,
|
||
INDEX `nk_report_player_star_record_time`(`time` ASC) USING BTREE,
|
||
INDEX `nk_report_player_star_record_player_id`(`agent_id` ASC, `channel_id` ASC, `player_id` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 26301 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_report_sales_charge_record
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_report_sales_charge_record`;
|
||
CREATE TABLE `ct_report_sales_charge_record` (
|
||
`id` int UNSIGNED NOT NULL AUTO_INCREMENT,
|
||
`agent_id` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '' COMMENT '代理商id',
|
||
`channel_id` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '' COMMENT '渠道id',
|
||
`channel_name` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '' COMMENT '渠道名',
|
||
`from_user_id` mediumint UNSIGNED NOT NULL DEFAULT 0 COMMENT '转出代理id',
|
||
`from_user_name` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '' COMMENT '转出代理名称',
|
||
`from_user_avatar` varchar(200) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '' COMMENT '转出代理头像',
|
||
`from_user_type` tinyint NOT NULL DEFAULT 0 COMMENT '是否是总代 0-普通代理 1-总代',
|
||
`to_user_id` mediumint UNSIGNED NOT NULL DEFAULT 0 COMMENT '转入用户id',
|
||
`to_user_name` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '' COMMENT '转入用户名称',
|
||
`to_user_avatar` varchar(200) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '' COMMENT '转入用户头像',
|
||
`to_user_type` tinyint UNSIGNED NOT NULL DEFAULT 0 COMMENT '转入用户类型 0-玩家 1-代理',
|
||
`product_type` tinyint UNSIGNED NOT NULL DEFAULT 0 COMMENT '产品类型 0-房卡 1-星星',
|
||
`amount` mediumint NOT NULL DEFAULT 0 COMMENT '数量',
|
||
`time` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT '充值时间',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `pk_report_sales_charge_record`(`id` ASC) USING BTREE,
|
||
INDEX `nk_report_sales_charge_record_user_id`(`agent_id` ASC, `channel_id` ASC, `from_user_id` ASC, `to_user_id` ASC) USING BTREE,
|
||
INDEX `nk_report_sales_charge_record_time`(`time` ASC) USING BTREE,
|
||
INDEX `nk_report_sales_charge_record_from_user_id`(`agent_id` ASC, `channel_id` ASC, `from_user_id` ASC) USING BTREE,
|
||
INDEX `nk_report_sales_charge_record_to_user_id`(`agent_id` ASC, `channel_id` ASC, `to_user_id` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 821725 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci COMMENT = '统计表-代理给用户充值记录表' ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_report_sales_login_record
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_report_sales_login_record`;
|
||
CREATE TABLE `ct_report_sales_login_record` (
|
||
`id` int UNSIGNED NOT NULL AUTO_INCREMENT,
|
||
`agent_id` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '' COMMENT '代理商id',
|
||
`channel_id` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '' COMMENT '渠道id',
|
||
`channel_name` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '' COMMENT '渠道名',
|
||
`sales_id` mediumint UNSIGNED NOT NULL DEFAULT 0 COMMENT '代理id',
|
||
`sales_name` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '' COMMENT '代理名称',
|
||
`sales_avatar` varchar(200) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '' COMMENT '代理头像',
|
||
`login_count` mediumint UNSIGNED NOT NULL DEFAULT 0 COMMENT '登录次数',
|
||
`time` date NOT NULL DEFAULT '0000-00-00' COMMENT '时间',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `pk_report_sales_login_record`(`id` ASC) USING BTREE,
|
||
INDEX `nk_report_sales_login_record_time`(`time` ASC) USING BTREE,
|
||
INDEX `nk_report_sales_login_record_sales_id`(`agent_id` ASC, `channel_id` ASC, `sales_id` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 201756 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci COMMENT = '统计表-代理登录次数记录表' ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_report_sales_roomcard_buy
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_report_sales_roomcard_buy`;
|
||
CREATE TABLE `ct_report_sales_roomcard_buy` (
|
||
`id` int UNSIGNED NOT NULL AUTO_INCREMENT,
|
||
`agent_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '代理id',
|
||
`channel_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '渠道id',
|
||
`channel_name` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '渠道名称',
|
||
`order_id` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '订单号',
|
||
`faqi_nickname` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '发起人昵称',
|
||
`faqi_avatar` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '发起人头像',
|
||
`faqi_user_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '发起人id',
|
||
`2_user_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '被充值人ID',
|
||
`2_nickname` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '被充值人昵称',
|
||
`2_avatar` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '被充值人头像',
|
||
`time` datetime NULL DEFAULT NULL COMMENT '统计时间(下单时间)',
|
||
`price_goods` decimal(10, 2) NULL DEFAULT NULL COMMENT '商品标价',
|
||
`num` int NULL DEFAULT NULL COMMENT '数量',
|
||
`status` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '支付状态',
|
||
`pay_money` decimal(10, 2) NULL DEFAULT NULL COMMENT '实际支付金额',
|
||
`pay_time` datetime NULL DEFAULT NULL COMMENT '支付时间',
|
||
`trans_id` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '微信支付流水号',
|
||
`outtrade_no` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '微信支付商家订单号',
|
||
`type` int NULL DEFAULT NULL COMMENT '订单类型 0-玩家购卡 1-代理购卡',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `pk_report_sales_roomcard_buy`(`id` ASC) USING BTREE,
|
||
UNIQUE INDEX `uk_report_sales_roomcard_buy_order_id`(`agent_id` ASC, `channel_id` ASC, `order_id` ASC) USING BTREE,
|
||
INDEX `nk_report_sales_roomcard_buy_to_user`(`agent_id` ASC, `channel_id` ASC, `2_user_id` ASC) USING BTREE,
|
||
INDEX `nk_report_sales_roomcard_buy_time`(`time` ASC) USING BTREE,
|
||
INDEX `nk_report_sales_roomcard_buy_from_user`(`agent_id` ASC, `channel_id` ASC, `faqi_user_id` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 40422 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_sales_login_log
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_sales_login_log`;
|
||
CREATE TABLE `ct_sales_login_log` (
|
||
`id` int UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||
`agent_id` char(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '' COMMENT '代理商id',
|
||
`channel_id` char(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '' COMMENT '渠道id',
|
||
`sales_id` int UNSIGNED NOT NULL DEFAULT 0 COMMENT '代理id',
|
||
`login_type` tinyint NOT NULL DEFAULT 0 COMMENT '登录类型 0-微信登录 1-账号登录',
|
||
`login_time` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT '登录时间',
|
||
`login_addr` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '登陆地址',
|
||
`login_status` int UNSIGNED NULL DEFAULT 0 COMMENT '登陆状态(0:正常;1:异常;)',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `pk_sales_login_log`(`id` ASC) USING BTREE,
|
||
INDEX `nk_sales_login_log_sales_id`(`agent_id` ASC, `channel_id` ASC, `sales_id` ASC) USING BTREE,
|
||
INDEX `nk_sales_login_log_agent`(`agent_id` ASC, `channel_id` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 625986 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci COMMENT = '代理登录记录表' ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_sales_player
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_sales_player`;
|
||
CREATE TABLE `ct_sales_player` (
|
||
`id` int UNSIGNED NOT NULL AUTO_INCREMENT,
|
||
`agent_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '代理id',
|
||
`channel_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '渠道id',
|
||
`saus_salesid` int NULL DEFAULT NULL COMMENT '个人代理id',
|
||
`play_playerid` int NULL DEFAULT NULL COMMENT '玩家id',
|
||
`create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `pk_sales_player`(`id` ASC) USING BTREE,
|
||
UNIQUE INDEX `uk_sales_player`(`agent_id` ASC, `channel_id` ASC, `saus_salesid` ASC, `play_playerid` ASC) USING BTREE,
|
||
INDEX `nk_sales_player_salesid`(`agent_id` ASC, `channel_id` ASC, `saus_salesid` ASC) USING BTREE,
|
||
INDEX `nk_sales_player_playerid`(`agent_id` ASC, `channel_id` ASC, `play_playerid` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 27 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_service_info
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_service_info`;
|
||
CREATE TABLE `ct_service_info` (
|
||
`id` int UNSIGNED NOT NULL AUTO_INCREMENT,
|
||
`agent_id` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '代理商id',
|
||
`channel_id` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '渠道id',
|
||
`user_id` int NULL DEFAULT NULL COMMENT '统一用户编号',
|
||
`sales_id` int NOT NULL COMMENT '代理编号',
|
||
`total_value` decimal(18, 4) NOT NULL DEFAULT 0.0000 COMMENT '总计获得抽成金币数',
|
||
`real_value` decimal(18, 4) NOT NULL DEFAULT 0.0000 COMMENT '实际获得抽成金币数',
|
||
`sub_value` decimal(18, 4) NOT NULL DEFAULT 0.0000 COMMENT '平台扣除金币数',
|
||
`service_id` int NOT NULL DEFAULT 0 COMMENT 'ct_service_id表的id',
|
||
`create_time` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '时间',
|
||
`service_index` int UNSIGNED NULL DEFAULT 0 COMMENT '当前计算序号',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `pk_service_info`(`id` ASC) USING BTREE,
|
||
INDEX `nk_service_info`(`agent_id` ASC, `channel_id` ASC, `user_id` ASC, `sales_id` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 801 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_short_number_player_list
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_short_number_player_list`;
|
||
CREATE TABLE `ct_short_number_player_list` (
|
||
`id` int NOT NULL AUTO_INCREMENT,
|
||
`short_id` int NOT NULL COMMENT '短号表id',
|
||
`agent_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '代理商id',
|
||
`channel_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '渠道id',
|
||
`player_id` int UNSIGNED NOT NULL COMMENT '玩家id',
|
||
`type` int NOT NULL DEFAULT 1 COMMENT '名单类型(0:黑名单;1:白名单)',
|
||
`property_1` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '收款码',
|
||
`property_2` int NOT NULL DEFAULT 0 COMMENT '默认魅力值',
|
||
`property_3` int NULL DEFAULT 0,
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `pk_short_number_player_list`(`id` ASC) USING BTREE,
|
||
INDEX `nk_short_number_player_list_agent_channel_player`(`agent_id` ASC, `channel_id` ASC, `player_id` ASC) USING BTREE,
|
||
INDEX `nk_short_number_player_list_agent_player`(`agent_id` ASC, `player_id` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 49209 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_system_module
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_system_module`;
|
||
CREATE TABLE `ct_system_module` (
|
||
`module_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '模块(接口)标识',
|
||
`module_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '模块(接口)名称',
|
||
`parent_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '上级模块(接口)标识',
|
||
PRIMARY KEY (`module_id`) USING BTREE
|
||
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_transform_order_info
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_transform_order_info`;
|
||
CREATE TABLE `ct_transform_order_info` (
|
||
`id` int UNSIGNED NOT NULL AUTO_INCREMENT,
|
||
`agent_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '代理id',
|
||
`channel_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '渠道id',
|
||
`sales_id` int UNSIGNED NOT NULL DEFAULT 0 COMMENT '代理编号',
|
||
`product_id` int UNSIGNED NOT NULL DEFAULT 0 COMMENT '产品编号',
|
||
`product_amount` int UNSIGNED NOT NULL COMMENT '产品数量',
|
||
`product_type` int NOT NULL DEFAULT 0 COMMENT '0、房卡,1、星星',
|
||
`product_diamond` int UNSIGNED NOT NULL COMMENT '兑换所需要的钻石数量',
|
||
`create_time` int UNSIGNED NOT NULL DEFAULT 0 COMMENT '创建/兑换时间',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `pk_transform_order_info`(`id` ASC) USING BTREE,
|
||
INDEX `nk_transform_order_info_product`(`product_id` ASC) USING BTREE,
|
||
INDEX `nk_transform_order_info_sales`(`agent_id` ASC, `channel_id` ASC, `sales_id` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_transform_product_info
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_transform_product_info`;
|
||
CREATE TABLE `ct_transform_product_info` (
|
||
`id` int UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '商品编号',
|
||
`name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '商品名称',
|
||
`agent_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '代理id',
|
||
`channel_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '渠道id',
|
||
`amount` decimal(18, 4) UNSIGNED NOT NULL DEFAULT 0.0000 COMMENT '商品数量',
|
||
`diamond` int UNSIGNED NOT NULL COMMENT '兑换所需要的钻石数量',
|
||
`type` int UNSIGNED NOT NULL DEFAULT 0 COMMENT '商品类型 0、房卡,1、星星',
|
||
`remark` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '商品备注、描述',
|
||
`enabled` int NOT NULL DEFAULT 1 COMMENT '是否启用(0:禁用;1:启用)',
|
||
`sort` int UNSIGNED NULL DEFAULT 0 COMMENT '排序',
|
||
`is_preferential` int UNSIGNED NULL DEFAULT 0 COMMENT '是否限时优惠(0:否;1:是)',
|
||
`preferential_start_time` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '优惠起始时间',
|
||
`preferential_end_time` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '优惠截止时间',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `uk_transform_product_info`(`id` ASC, `agent_id` ASC, `channel_id` ASC, `enabled` ASC) USING BTREE,
|
||
UNIQUE INDEX `pk_transform_product_info`(`id` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 21 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_user_account
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_user_account`;
|
||
CREATE TABLE `ct_user_account` (
|
||
`id` int UNSIGNED NOT NULL AUTO_INCREMENT,
|
||
`user_id` int NOT NULL COMMENT '用户编号',
|
||
`agent_id` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '代理',
|
||
`channel_id` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '渠道',
|
||
`card` int UNSIGNED NULL DEFAULT 0 COMMENT '账户房卡数',
|
||
`currency` decimal(18, 4) UNSIGNED NULL DEFAULT 0.0000 COMMENT '账户游戏币',
|
||
`diamond` decimal(18, 4) UNSIGNED NULL DEFAULT 0.0000 COMMENT '账户钻石数',
|
||
`enabled` int NULL DEFAULT 1 COMMENT '是否有效(0:无效;1:有效)',
|
||
`create_time` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `pk_user_account`(`id` ASC) USING BTREE,
|
||
UNIQUE INDEX `uk_user_account_agent_enabled`(`user_id` ASC, `agent_id` ASC, `channel_id` ASC, `enabled` ASC) USING BTREE,
|
||
UNIQUE INDEX `uk_user_account_agent`(`user_id` ASC, `agent_id` ASC, `channel_id` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 492 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_user_authorization
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_user_authorization`;
|
||
CREATE TABLE `ct_user_authorization` (
|
||
`id` int NOT NULL AUTO_INCREMENT,
|
||
`user_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '用户标识',
|
||
`user_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '用户名称',
|
||
`module_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '模块(接口)标识',
|
||
`user_auth` int NOT NULL DEFAULT 0 COMMENT '权限(0:无;1:有;2:所有)',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `uk_user_authorization`(`user_id` ASC, `module_id` ASC) USING BTREE,
|
||
UNIQUE INDEX `pk_user_authorization`(`id` ASC) USING BTREE,
|
||
INDEX `nk_user_authorization`(`user_id` ASC, `module_id` ASC, `user_auth` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_user_commission
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_user_commission`;
|
||
CREATE TABLE `ct_user_commission` (
|
||
`id` int NOT NULL AUTO_INCREMENT,
|
||
`agent_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '代理',
|
||
`channel_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '渠道',
|
||
`game_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '游戏',
|
||
`room_id` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '房间标识',
|
||
`player_id` int NOT NULL COMMENT '玩家id',
|
||
`user_id` int NULL DEFAULT NULL COMMENT '用户id(玩家绑定的代理)',
|
||
`parent_user_id` int NULL DEFAULT NULL COMMENT '用户id(玩家绑定的代理的上级代理)',
|
||
`room_code` int NOT NULL COMMENT '房号',
|
||
`short_number` int NULL DEFAULT NULL COMMENT '短号',
|
||
`used_card` int NOT NULL COMMENT '使用的房卡数',
|
||
`owner_id` int NOT NULL COMMENT '房主',
|
||
`room_type` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '房间类型',
|
||
`room_mode` tinyint(1) NOT NULL COMMENT '0-普通星星场房间 1-短号星星场房间 2-系统星星房间',
|
||
`commission_type` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '分成类型编号',
|
||
`grade` decimal(18, 4) NOT NULL COMMENT '玩家得分',
|
||
`source_mode` tinyint(1) NULL DEFAULT NULL COMMENT '0-不抽成 1-对大赢家进行抽成 2-对所有赢家抽成 3-对所有玩家抽成',
|
||
`target_mode` tinyint(1) NULL DEFAULT NULL COMMENT '0-抽成给系统 1-抽成给房主 2-抽成给指定玩家 3-抽成给指定玩家的代理账号 4-抽成给房主玩家的代理帐号',
|
||
`target_id` int NULL DEFAULT NULL COMMENT '目标玩家编号(获取抽水的玩家编号)',
|
||
`mode` int NOT NULL COMMENT '抽成模式 1-按得分的百分比抽成 2-按倍数的百分比抽成 3-按固定值抽成',
|
||
`type` tinyint NOT NULL COMMENT '0-大局系统抽成数据 1-小局系统抽成数据',
|
||
`commission_total` decimal(18, 4) NOT NULL COMMENT '总计分成数',
|
||
`commission_system` decimal(18, 4) NULL DEFAULT NULL COMMENT '系统(平台)分成数',
|
||
`commission_user` decimal(18, 4) NULL DEFAULT NULL COMMENT '用户(代理)分成数',
|
||
`commission_parent_user` decimal(18, 4) NULL DEFAULT NULL COMMENT '用户(代理)的上级分成数',
|
||
`commission_owner` decimal(18, 4) NULL DEFAULT NULL COMMENT '房主的分成数',
|
||
`commission_user_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '用户(代理)分成比例(百分比)(0~1)',
|
||
`commission_parent_user_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '上级用户(代理)分成比例(百分比)(0~1)',
|
||
`commission_owner_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '房主分成比例(百分比)(0~1)',
|
||
`create_time` timestamp NULL DEFAULT NULL COMMENT '时间',
|
||
`is_settle` int NULL DEFAULT 0 COMMENT '是否结算(0:否;1:是)',
|
||
`is_robot` int NULL DEFAULT 0 COMMENT '是否是机器人(0:否;1:是)',
|
||
`service_index` int UNSIGNED NULL DEFAULT NULL COMMENT '茶水费的计算序号',
|
||
`out_id` int NOT NULL COMMENT '外部id',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `pk_user_commission`(`id` ASC) USING BTREE,
|
||
UNIQUE INDEX `uk_user_commission_out_id`(`out_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_user`(`agent_id` ASC, `channel_id` ASC, `player_id` ASC, `user_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_target_mode_settle`(`target_mode` ASC, `is_settle` ASC, `commission_total` ASC, `create_time` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_player_id`(`agent_id` ASC, `channel_id` ASC, `player_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_user_id`(`agent_id` ASC, `channel_id` ASC, `user_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_target_id`(`agent_id` ASC, `channel_id` ASC, `target_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_service_index`(`agent_id` ASC, `channel_id` ASC, `service_index` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 25078341 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_user_commission_202205
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_user_commission_202205`;
|
||
CREATE TABLE `ct_user_commission_202205` (
|
||
`id` int NOT NULL AUTO_INCREMENT,
|
||
`agent_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '代理',
|
||
`channel_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '渠道',
|
||
`game_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '游戏',
|
||
`room_id` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '房间标识',
|
||
`player_id` int NOT NULL COMMENT '玩家id',
|
||
`user_id` int NULL DEFAULT NULL COMMENT '用户id(玩家绑定的代理)',
|
||
`parent_user_id` int NULL DEFAULT NULL COMMENT '用户id(玩家绑定的代理的上级代理)',
|
||
`room_code` int NOT NULL COMMENT '房号',
|
||
`short_number` int NULL DEFAULT NULL COMMENT '短号',
|
||
`used_card` int NOT NULL COMMENT '使用的房卡数',
|
||
`owner_id` int NOT NULL COMMENT '房主',
|
||
`room_type` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '房间类型',
|
||
`room_mode` tinyint(1) NOT NULL COMMENT '0-普通星星场房间 1-短号星星场房间 2-系统星星房间',
|
||
`commission_type` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '分成类型编号',
|
||
`grade` decimal(18, 4) NOT NULL COMMENT '玩家得分',
|
||
`source_mode` tinyint(1) NULL DEFAULT NULL COMMENT '0-不抽成 1-对大赢家进行抽成 2-对所有赢家抽成 3-对所有玩家抽成',
|
||
`target_mode` tinyint(1) NULL DEFAULT NULL COMMENT '0-抽成给系统 1-抽成给房主 2-抽成给指定玩家 3-抽成给指定玩家的代理账号 4-抽成给房主玩家的代理帐号',
|
||
`target_id` int NULL DEFAULT NULL COMMENT '目标玩家编号(获取抽水的玩家编号)',
|
||
`mode` int NOT NULL COMMENT '抽成模式 1-按得分的百分比抽成 2-按倍数的百分比抽成 3-按固定值抽成',
|
||
`type` tinyint NOT NULL COMMENT '0-大局系统抽成数据 1-小局系统抽成数据',
|
||
`commission_total` decimal(18, 4) NOT NULL COMMENT '总计分成数',
|
||
`commission_system` decimal(18, 4) NULL DEFAULT NULL COMMENT '系统(平台)分成数',
|
||
`commission_user` decimal(18, 4) NULL DEFAULT NULL COMMENT '用户(代理)分成数',
|
||
`commission_parent_user` decimal(18, 4) NULL DEFAULT NULL COMMENT '用户(代理)的上级分成数',
|
||
`commission_owner` decimal(18, 4) NULL DEFAULT NULL COMMENT '房主的分成数',
|
||
`commission_user_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '用户(代理)分成比例(百分比)(0~1)',
|
||
`commission_parent_user_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '上级用户(代理)分成比例(百分比)(0~1)',
|
||
`commission_owner_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '房主分成比例(百分比)(0~1)',
|
||
`create_time` timestamp NULL DEFAULT NULL COMMENT '时间',
|
||
`is_settle` int NULL DEFAULT 0 COMMENT '是否结算(0:否;1:是)',
|
||
`is_robot` int NULL DEFAULT 0 COMMENT '是否是机器人(0:否;1:是)',
|
||
`service_index` int UNSIGNED NULL DEFAULT NULL COMMENT '茶水费的计算序号',
|
||
`out_id` int NOT NULL COMMENT '外部id',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `uk_user_commission_202012_out_id`(`out_id` ASC) USING BTREE,
|
||
UNIQUE INDEX `pk_user_commission_202012`(`id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_service_index`(`agent_id` ASC, `channel_id` ASC, `service_index` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_user_id`(`agent_id` ASC, `channel_id` ASC, `user_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_target_id`(`agent_id` ASC, `channel_id` ASC, `target_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_target_mode_settle`(`target_mode` ASC, `is_settle` ASC, `commission_total` ASC, `create_time` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_user`(`agent_id` ASC, `channel_id` ASC, `player_id` ASC, `user_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_player_id`(`agent_id` ASC, `channel_id` ASC, `player_id` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 530418 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_user_commission_202206
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_user_commission_202206`;
|
||
CREATE TABLE `ct_user_commission_202206` (
|
||
`id` int NOT NULL AUTO_INCREMENT,
|
||
`agent_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '代理',
|
||
`channel_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '渠道',
|
||
`game_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '游戏',
|
||
`room_id` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '房间标识',
|
||
`player_id` int NOT NULL COMMENT '玩家id',
|
||
`user_id` int NULL DEFAULT NULL COMMENT '用户id(玩家绑定的代理)',
|
||
`parent_user_id` int NULL DEFAULT NULL COMMENT '用户id(玩家绑定的代理的上级代理)',
|
||
`room_code` int NOT NULL COMMENT '房号',
|
||
`short_number` int NULL DEFAULT NULL COMMENT '短号',
|
||
`used_card` int NOT NULL COMMENT '使用的房卡数',
|
||
`owner_id` int NOT NULL COMMENT '房主',
|
||
`room_type` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '房间类型',
|
||
`room_mode` tinyint(1) NOT NULL COMMENT '0-普通星星场房间 1-短号星星场房间 2-系统星星房间',
|
||
`commission_type` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '分成类型编号',
|
||
`grade` decimal(18, 4) NOT NULL COMMENT '玩家得分',
|
||
`source_mode` tinyint(1) NULL DEFAULT NULL COMMENT '0-不抽成 1-对大赢家进行抽成 2-对所有赢家抽成 3-对所有玩家抽成',
|
||
`target_mode` tinyint(1) NULL DEFAULT NULL COMMENT '0-抽成给系统 1-抽成给房主 2-抽成给指定玩家 3-抽成给指定玩家的代理账号 4-抽成给房主玩家的代理帐号',
|
||
`target_id` int NULL DEFAULT NULL COMMENT '目标玩家编号(获取抽水的玩家编号)',
|
||
`mode` int NOT NULL COMMENT '抽成模式 1-按得分的百分比抽成 2-按倍数的百分比抽成 3-按固定值抽成',
|
||
`type` tinyint NOT NULL COMMENT '0-大局系统抽成数据 1-小局系统抽成数据',
|
||
`commission_total` decimal(18, 4) NOT NULL COMMENT '总计分成数',
|
||
`commission_system` decimal(18, 4) NULL DEFAULT NULL COMMENT '系统(平台)分成数',
|
||
`commission_user` decimal(18, 4) NULL DEFAULT NULL COMMENT '用户(代理)分成数',
|
||
`commission_parent_user` decimal(18, 4) NULL DEFAULT NULL COMMENT '用户(代理)的上级分成数',
|
||
`commission_owner` decimal(18, 4) NULL DEFAULT NULL COMMENT '房主的分成数',
|
||
`commission_user_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '用户(代理)分成比例(百分比)(0~1)',
|
||
`commission_parent_user_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '上级用户(代理)分成比例(百分比)(0~1)',
|
||
`commission_owner_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '房主分成比例(百分比)(0~1)',
|
||
`create_time` timestamp NULL DEFAULT NULL COMMENT '时间',
|
||
`is_settle` int NULL DEFAULT 0 COMMENT '是否结算(0:否;1:是)',
|
||
`is_robot` int NULL DEFAULT 0 COMMENT '是否是机器人(0:否;1:是)',
|
||
`service_index` int UNSIGNED NULL DEFAULT NULL COMMENT '茶水费的计算序号',
|
||
`out_id` int NOT NULL COMMENT '外部id',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `uk_user_commission_202012_out_id`(`out_id` ASC) USING BTREE,
|
||
UNIQUE INDEX `pk_user_commission_202012`(`id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_service_index`(`agent_id` ASC, `channel_id` ASC, `service_index` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_user_id`(`agent_id` ASC, `channel_id` ASC, `user_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_target_id`(`agent_id` ASC, `channel_id` ASC, `target_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_target_mode_settle`(`target_mode` ASC, `is_settle` ASC, `commission_total` ASC, `create_time` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_user`(`agent_id` ASC, `channel_id` ASC, `player_id` ASC, `user_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_player_id`(`agent_id` ASC, `channel_id` ASC, `player_id` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 488687 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_user_commission_202207
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_user_commission_202207`;
|
||
CREATE TABLE `ct_user_commission_202207` (
|
||
`id` int NOT NULL AUTO_INCREMENT,
|
||
`agent_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '代理',
|
||
`channel_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '渠道',
|
||
`game_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '游戏',
|
||
`room_id` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '房间标识',
|
||
`player_id` int NOT NULL COMMENT '玩家id',
|
||
`user_id` int NULL DEFAULT NULL COMMENT '用户id(玩家绑定的代理)',
|
||
`parent_user_id` int NULL DEFAULT NULL COMMENT '用户id(玩家绑定的代理的上级代理)',
|
||
`room_code` int NOT NULL COMMENT '房号',
|
||
`short_number` int NULL DEFAULT NULL COMMENT '短号',
|
||
`used_card` int NOT NULL COMMENT '使用的房卡数',
|
||
`owner_id` int NOT NULL COMMENT '房主',
|
||
`room_type` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '房间类型',
|
||
`room_mode` tinyint(1) NOT NULL COMMENT '0-普通星星场房间 1-短号星星场房间 2-系统星星房间',
|
||
`commission_type` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '分成类型编号',
|
||
`grade` decimal(18, 4) NOT NULL COMMENT '玩家得分',
|
||
`source_mode` tinyint(1) NULL DEFAULT NULL COMMENT '0-不抽成 1-对大赢家进行抽成 2-对所有赢家抽成 3-对所有玩家抽成',
|
||
`target_mode` tinyint(1) NULL DEFAULT NULL COMMENT '0-抽成给系统 1-抽成给房主 2-抽成给指定玩家 3-抽成给指定玩家的代理账号 4-抽成给房主玩家的代理帐号',
|
||
`target_id` int NULL DEFAULT NULL COMMENT '目标玩家编号(获取抽水的玩家编号)',
|
||
`mode` int NOT NULL COMMENT '抽成模式 1-按得分的百分比抽成 2-按倍数的百分比抽成 3-按固定值抽成',
|
||
`type` tinyint NOT NULL COMMENT '0-大局系统抽成数据 1-小局系统抽成数据',
|
||
`commission_total` decimal(18, 4) NOT NULL COMMENT '总计分成数',
|
||
`commission_system` decimal(18, 4) NULL DEFAULT NULL COMMENT '系统(平台)分成数',
|
||
`commission_user` decimal(18, 4) NULL DEFAULT NULL COMMENT '用户(代理)分成数',
|
||
`commission_parent_user` decimal(18, 4) NULL DEFAULT NULL COMMENT '用户(代理)的上级分成数',
|
||
`commission_owner` decimal(18, 4) NULL DEFAULT NULL COMMENT '房主的分成数',
|
||
`commission_user_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '用户(代理)分成比例(百分比)(0~1)',
|
||
`commission_parent_user_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '上级用户(代理)分成比例(百分比)(0~1)',
|
||
`commission_owner_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '房主分成比例(百分比)(0~1)',
|
||
`create_time` timestamp NULL DEFAULT NULL COMMENT '时间',
|
||
`is_settle` int NULL DEFAULT 0 COMMENT '是否结算(0:否;1:是)',
|
||
`is_robot` int NULL DEFAULT 0 COMMENT '是否是机器人(0:否;1:是)',
|
||
`service_index` int UNSIGNED NULL DEFAULT NULL COMMENT '茶水费的计算序号',
|
||
`out_id` int NOT NULL COMMENT '外部id',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `uk_user_commission_202012_out_id`(`out_id` ASC) USING BTREE,
|
||
UNIQUE INDEX `pk_user_commission_202012`(`id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_service_index`(`agent_id` ASC, `channel_id` ASC, `service_index` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_user_id`(`agent_id` ASC, `channel_id` ASC, `user_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_target_id`(`agent_id` ASC, `channel_id` ASC, `target_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_target_mode_settle`(`target_mode` ASC, `is_settle` ASC, `commission_total` ASC, `create_time` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_user`(`agent_id` ASC, `channel_id` ASC, `player_id` ASC, `user_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_player_id`(`agent_id` ASC, `channel_id` ASC, `player_id` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 471775 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_user_commission_202208
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_user_commission_202208`;
|
||
CREATE TABLE `ct_user_commission_202208` (
|
||
`id` int NOT NULL AUTO_INCREMENT,
|
||
`agent_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '代理',
|
||
`channel_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '渠道',
|
||
`game_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '游戏',
|
||
`room_id` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '房间标识',
|
||
`player_id` int NOT NULL COMMENT '玩家id',
|
||
`user_id` int NULL DEFAULT NULL COMMENT '用户id(玩家绑定的代理)',
|
||
`parent_user_id` int NULL DEFAULT NULL COMMENT '用户id(玩家绑定的代理的上级代理)',
|
||
`room_code` int NOT NULL COMMENT '房号',
|
||
`short_number` int NULL DEFAULT NULL COMMENT '短号',
|
||
`used_card` int NOT NULL COMMENT '使用的房卡数',
|
||
`owner_id` int NOT NULL COMMENT '房主',
|
||
`room_type` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '房间类型',
|
||
`room_mode` tinyint(1) NOT NULL COMMENT '0-普通星星场房间 1-短号星星场房间 2-系统星星房间',
|
||
`commission_type` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '分成类型编号',
|
||
`grade` decimal(18, 4) NOT NULL COMMENT '玩家得分',
|
||
`source_mode` tinyint(1) NULL DEFAULT NULL COMMENT '0-不抽成 1-对大赢家进行抽成 2-对所有赢家抽成 3-对所有玩家抽成',
|
||
`target_mode` tinyint(1) NULL DEFAULT NULL COMMENT '0-抽成给系统 1-抽成给房主 2-抽成给指定玩家 3-抽成给指定玩家的代理账号 4-抽成给房主玩家的代理帐号',
|
||
`target_id` int NULL DEFAULT NULL COMMENT '目标玩家编号(获取抽水的玩家编号)',
|
||
`mode` int NOT NULL COMMENT '抽成模式 1-按得分的百分比抽成 2-按倍数的百分比抽成 3-按固定值抽成',
|
||
`type` tinyint NOT NULL COMMENT '0-大局系统抽成数据 1-小局系统抽成数据',
|
||
`commission_total` decimal(18, 4) NOT NULL COMMENT '总计分成数',
|
||
`commission_system` decimal(18, 4) NULL DEFAULT NULL COMMENT '系统(平台)分成数',
|
||
`commission_user` decimal(18, 4) NULL DEFAULT NULL COMMENT '用户(代理)分成数',
|
||
`commission_parent_user` decimal(18, 4) NULL DEFAULT NULL COMMENT '用户(代理)的上级分成数',
|
||
`commission_owner` decimal(18, 4) NULL DEFAULT NULL COMMENT '房主的分成数',
|
||
`commission_user_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '用户(代理)分成比例(百分比)(0~1)',
|
||
`commission_parent_user_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '上级用户(代理)分成比例(百分比)(0~1)',
|
||
`commission_owner_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '房主分成比例(百分比)(0~1)',
|
||
`create_time` timestamp NULL DEFAULT NULL COMMENT '时间',
|
||
`is_settle` int NULL DEFAULT 0 COMMENT '是否结算(0:否;1:是)',
|
||
`is_robot` int NULL DEFAULT 0 COMMENT '是否是机器人(0:否;1:是)',
|
||
`service_index` int UNSIGNED NULL DEFAULT NULL COMMENT '茶水费的计算序号',
|
||
`out_id` int NOT NULL COMMENT '外部id',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `uk_user_commission_202012_out_id`(`out_id` ASC) USING BTREE,
|
||
UNIQUE INDEX `pk_user_commission_202012`(`id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_service_index`(`agent_id` ASC, `channel_id` ASC, `service_index` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_user_id`(`agent_id` ASC, `channel_id` ASC, `user_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_target_id`(`agent_id` ASC, `channel_id` ASC, `target_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_target_mode_settle`(`target_mode` ASC, `is_settle` ASC, `commission_total` ASC, `create_time` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_user`(`agent_id` ASC, `channel_id` ASC, `player_id` ASC, `user_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_player_id`(`agent_id` ASC, `channel_id` ASC, `player_id` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 381152 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_user_commission_202209
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_user_commission_202209`;
|
||
CREATE TABLE `ct_user_commission_202209` (
|
||
`id` int NOT NULL AUTO_INCREMENT,
|
||
`agent_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '代理',
|
||
`channel_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '渠道',
|
||
`game_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '游戏',
|
||
`room_id` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '房间标识',
|
||
`player_id` int NOT NULL COMMENT '玩家id',
|
||
`user_id` int NULL DEFAULT NULL COMMENT '用户id(玩家绑定的代理)',
|
||
`parent_user_id` int NULL DEFAULT NULL COMMENT '用户id(玩家绑定的代理的上级代理)',
|
||
`room_code` int NOT NULL COMMENT '房号',
|
||
`short_number` int NULL DEFAULT NULL COMMENT '短号',
|
||
`used_card` int NOT NULL COMMENT '使用的房卡数',
|
||
`owner_id` int NOT NULL COMMENT '房主',
|
||
`room_type` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '房间类型',
|
||
`room_mode` tinyint(1) NOT NULL COMMENT '0-普通星星场房间 1-短号星星场房间 2-系统星星房间',
|
||
`commission_type` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '分成类型编号',
|
||
`grade` decimal(18, 4) NOT NULL COMMENT '玩家得分',
|
||
`source_mode` tinyint(1) NULL DEFAULT NULL COMMENT '0-不抽成 1-对大赢家进行抽成 2-对所有赢家抽成 3-对所有玩家抽成',
|
||
`target_mode` tinyint(1) NULL DEFAULT NULL COMMENT '0-抽成给系统 1-抽成给房主 2-抽成给指定玩家 3-抽成给指定玩家的代理账号 4-抽成给房主玩家的代理帐号',
|
||
`target_id` int NULL DEFAULT NULL COMMENT '目标玩家编号(获取抽水的玩家编号)',
|
||
`mode` int NOT NULL COMMENT '抽成模式 1-按得分的百分比抽成 2-按倍数的百分比抽成 3-按固定值抽成',
|
||
`type` tinyint NOT NULL COMMENT '0-大局系统抽成数据 1-小局系统抽成数据',
|
||
`commission_total` decimal(18, 4) NOT NULL COMMENT '总计分成数',
|
||
`commission_system` decimal(18, 4) NULL DEFAULT NULL COMMENT '系统(平台)分成数',
|
||
`commission_user` decimal(18, 4) NULL DEFAULT NULL COMMENT '用户(代理)分成数',
|
||
`commission_parent_user` decimal(18, 4) NULL DEFAULT NULL COMMENT '用户(代理)的上级分成数',
|
||
`commission_owner` decimal(18, 4) NULL DEFAULT NULL COMMENT '房主的分成数',
|
||
`commission_user_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '用户(代理)分成比例(百分比)(0~1)',
|
||
`commission_parent_user_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '上级用户(代理)分成比例(百分比)(0~1)',
|
||
`commission_owner_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '房主分成比例(百分比)(0~1)',
|
||
`create_time` timestamp NULL DEFAULT NULL COMMENT '时间',
|
||
`is_settle` int NULL DEFAULT 0 COMMENT '是否结算(0:否;1:是)',
|
||
`is_robot` int NULL DEFAULT 0 COMMENT '是否是机器人(0:否;1:是)',
|
||
`service_index` int UNSIGNED NULL DEFAULT NULL COMMENT '茶水费的计算序号',
|
||
`out_id` int NOT NULL COMMENT '外部id',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `uk_user_commission_202012_out_id`(`out_id` ASC) USING BTREE,
|
||
UNIQUE INDEX `pk_user_commission_202012`(`id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_service_index`(`agent_id` ASC, `channel_id` ASC, `service_index` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_user_id`(`agent_id` ASC, `channel_id` ASC, `user_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_target_id`(`agent_id` ASC, `channel_id` ASC, `target_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_target_mode_settle`(`target_mode` ASC, `is_settle` ASC, `commission_total` ASC, `create_time` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_user`(`agent_id` ASC, `channel_id` ASC, `player_id` ASC, `user_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_player_id`(`agent_id` ASC, `channel_id` ASC, `player_id` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 368864 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_user_commission_202210
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_user_commission_202210`;
|
||
CREATE TABLE `ct_user_commission_202210` (
|
||
`id` int NOT NULL AUTO_INCREMENT,
|
||
`agent_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '代理',
|
||
`channel_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '渠道',
|
||
`game_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '游戏',
|
||
`room_id` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '房间标识',
|
||
`player_id` int NOT NULL COMMENT '玩家id',
|
||
`user_id` int NULL DEFAULT NULL COMMENT '用户id(玩家绑定的代理)',
|
||
`parent_user_id` int NULL DEFAULT NULL COMMENT '用户id(玩家绑定的代理的上级代理)',
|
||
`room_code` int NOT NULL COMMENT '房号',
|
||
`short_number` int NULL DEFAULT NULL COMMENT '短号',
|
||
`used_card` int NOT NULL COMMENT '使用的房卡数',
|
||
`owner_id` int NOT NULL COMMENT '房主',
|
||
`room_type` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '房间类型',
|
||
`room_mode` tinyint(1) NOT NULL COMMENT '0-普通星星场房间 1-短号星星场房间 2-系统星星房间',
|
||
`commission_type` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '分成类型编号',
|
||
`grade` decimal(18, 4) NOT NULL COMMENT '玩家得分',
|
||
`source_mode` tinyint(1) NULL DEFAULT NULL COMMENT '0-不抽成 1-对大赢家进行抽成 2-对所有赢家抽成 3-对所有玩家抽成',
|
||
`target_mode` tinyint(1) NULL DEFAULT NULL COMMENT '0-抽成给系统 1-抽成给房主 2-抽成给指定玩家 3-抽成给指定玩家的代理账号 4-抽成给房主玩家的代理帐号',
|
||
`target_id` int NULL DEFAULT NULL COMMENT '目标玩家编号(获取抽水的玩家编号)',
|
||
`mode` int NOT NULL COMMENT '抽成模式 1-按得分的百分比抽成 2-按倍数的百分比抽成 3-按固定值抽成',
|
||
`type` tinyint NOT NULL COMMENT '0-大局系统抽成数据 1-小局系统抽成数据',
|
||
`commission_total` decimal(18, 4) NOT NULL COMMENT '总计分成数',
|
||
`commission_system` decimal(18, 4) NULL DEFAULT NULL COMMENT '系统(平台)分成数',
|
||
`commission_user` decimal(18, 4) NULL DEFAULT NULL COMMENT '用户(代理)分成数',
|
||
`commission_parent_user` decimal(18, 4) NULL DEFAULT NULL COMMENT '用户(代理)的上级分成数',
|
||
`commission_owner` decimal(18, 4) NULL DEFAULT NULL COMMENT '房主的分成数',
|
||
`commission_user_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '用户(代理)分成比例(百分比)(0~1)',
|
||
`commission_parent_user_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '上级用户(代理)分成比例(百分比)(0~1)',
|
||
`commission_owner_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '房主分成比例(百分比)(0~1)',
|
||
`create_time` timestamp NULL DEFAULT NULL COMMENT '时间',
|
||
`is_settle` int NULL DEFAULT 0 COMMENT '是否结算(0:否;1:是)',
|
||
`is_robot` int NULL DEFAULT 0 COMMENT '是否是机器人(0:否;1:是)',
|
||
`service_index` int UNSIGNED NULL DEFAULT NULL COMMENT '茶水费的计算序号',
|
||
`out_id` int NOT NULL COMMENT '外部id',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `uk_user_commission_202012_out_id`(`out_id` ASC) USING BTREE,
|
||
UNIQUE INDEX `pk_user_commission_202012`(`id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_service_index`(`agent_id` ASC, `channel_id` ASC, `service_index` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_user_id`(`agent_id` ASC, `channel_id` ASC, `user_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_target_id`(`agent_id` ASC, `channel_id` ASC, `target_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_target_mode_settle`(`target_mode` ASC, `is_settle` ASC, `commission_total` ASC, `create_time` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_user`(`agent_id` ASC, `channel_id` ASC, `player_id` ASC, `user_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_player_id`(`agent_id` ASC, `channel_id` ASC, `player_id` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 405728 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_user_commission_202211
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_user_commission_202211`;
|
||
CREATE TABLE `ct_user_commission_202211` (
|
||
`id` int NOT NULL AUTO_INCREMENT,
|
||
`agent_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '代理',
|
||
`channel_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '渠道',
|
||
`game_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '游戏',
|
||
`room_id` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '房间标识',
|
||
`player_id` int NOT NULL COMMENT '玩家id',
|
||
`user_id` int NULL DEFAULT NULL COMMENT '用户id(玩家绑定的代理)',
|
||
`parent_user_id` int NULL DEFAULT NULL COMMENT '用户id(玩家绑定的代理的上级代理)',
|
||
`room_code` int NOT NULL COMMENT '房号',
|
||
`short_number` int NULL DEFAULT NULL COMMENT '短号',
|
||
`used_card` int NOT NULL COMMENT '使用的房卡数',
|
||
`owner_id` int NOT NULL COMMENT '房主',
|
||
`room_type` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '房间类型',
|
||
`room_mode` tinyint(1) NOT NULL COMMENT '0-普通星星场房间 1-短号星星场房间 2-系统星星房间',
|
||
`commission_type` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '分成类型编号',
|
||
`grade` decimal(18, 4) NOT NULL COMMENT '玩家得分',
|
||
`source_mode` tinyint(1) NULL DEFAULT NULL COMMENT '0-不抽成 1-对大赢家进行抽成 2-对所有赢家抽成 3-对所有玩家抽成',
|
||
`target_mode` tinyint(1) NULL DEFAULT NULL COMMENT '0-抽成给系统 1-抽成给房主 2-抽成给指定玩家 3-抽成给指定玩家的代理账号 4-抽成给房主玩家的代理帐号',
|
||
`target_id` int NULL DEFAULT NULL COMMENT '目标玩家编号(获取抽水的玩家编号)',
|
||
`mode` int NOT NULL COMMENT '抽成模式 1-按得分的百分比抽成 2-按倍数的百分比抽成 3-按固定值抽成',
|
||
`type` tinyint NOT NULL COMMENT '0-大局系统抽成数据 1-小局系统抽成数据',
|
||
`commission_total` decimal(18, 4) NOT NULL COMMENT '总计分成数',
|
||
`commission_system` decimal(18, 4) NULL DEFAULT NULL COMMENT '系统(平台)分成数',
|
||
`commission_user` decimal(18, 4) NULL DEFAULT NULL COMMENT '用户(代理)分成数',
|
||
`commission_parent_user` decimal(18, 4) NULL DEFAULT NULL COMMENT '用户(代理)的上级分成数',
|
||
`commission_owner` decimal(18, 4) NULL DEFAULT NULL COMMENT '房主的分成数',
|
||
`commission_user_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '用户(代理)分成比例(百分比)(0~1)',
|
||
`commission_parent_user_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '上级用户(代理)分成比例(百分比)(0~1)',
|
||
`commission_owner_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '房主分成比例(百分比)(0~1)',
|
||
`create_time` timestamp NULL DEFAULT NULL COMMENT '时间',
|
||
`is_settle` int NULL DEFAULT 0 COMMENT '是否结算(0:否;1:是)',
|
||
`is_robot` int NULL DEFAULT 0 COMMENT '是否是机器人(0:否;1:是)',
|
||
`service_index` int UNSIGNED NULL DEFAULT NULL COMMENT '茶水费的计算序号',
|
||
`out_id` int NOT NULL COMMENT '外部id',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `uk_user_commission_202012_out_id`(`out_id` ASC) USING BTREE,
|
||
UNIQUE INDEX `pk_user_commission_202012`(`id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_service_index`(`agent_id` ASC, `channel_id` ASC, `service_index` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_user_id`(`agent_id` ASC, `channel_id` ASC, `user_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_target_id`(`agent_id` ASC, `channel_id` ASC, `target_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_target_mode_settle`(`target_mode` ASC, `is_settle` ASC, `commission_total` ASC, `create_time` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_user`(`agent_id` ASC, `channel_id` ASC, `player_id` ASC, `user_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_player_id`(`agent_id` ASC, `channel_id` ASC, `player_id` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 432352 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_user_commission_202212
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_user_commission_202212`;
|
||
CREATE TABLE `ct_user_commission_202212` (
|
||
`id` int NOT NULL AUTO_INCREMENT,
|
||
`agent_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '代理',
|
||
`channel_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '渠道',
|
||
`game_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '游戏',
|
||
`room_id` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '房间标识',
|
||
`player_id` int NOT NULL COMMENT '玩家id',
|
||
`user_id` int NULL DEFAULT NULL COMMENT '用户id(玩家绑定的代理)',
|
||
`parent_user_id` int NULL DEFAULT NULL COMMENT '用户id(玩家绑定的代理的上级代理)',
|
||
`room_code` int NOT NULL COMMENT '房号',
|
||
`short_number` int NULL DEFAULT NULL COMMENT '短号',
|
||
`used_card` int NOT NULL COMMENT '使用的房卡数',
|
||
`owner_id` int NOT NULL COMMENT '房主',
|
||
`room_type` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '房间类型',
|
||
`room_mode` tinyint(1) NOT NULL COMMENT '0-普通星星场房间 1-短号星星场房间 2-系统星星房间',
|
||
`commission_type` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '分成类型编号',
|
||
`grade` decimal(18, 4) NOT NULL COMMENT '玩家得分',
|
||
`source_mode` tinyint(1) NULL DEFAULT NULL COMMENT '0-不抽成 1-对大赢家进行抽成 2-对所有赢家抽成 3-对所有玩家抽成',
|
||
`target_mode` tinyint(1) NULL DEFAULT NULL COMMENT '0-抽成给系统 1-抽成给房主 2-抽成给指定玩家 3-抽成给指定玩家的代理账号 4-抽成给房主玩家的代理帐号',
|
||
`target_id` int NULL DEFAULT NULL COMMENT '目标玩家编号(获取抽水的玩家编号)',
|
||
`mode` int NOT NULL COMMENT '抽成模式 1-按得分的百分比抽成 2-按倍数的百分比抽成 3-按固定值抽成',
|
||
`type` tinyint NOT NULL COMMENT '0-大局系统抽成数据 1-小局系统抽成数据',
|
||
`commission_total` decimal(18, 4) NOT NULL COMMENT '总计分成数',
|
||
`commission_system` decimal(18, 4) NULL DEFAULT NULL COMMENT '系统(平台)分成数',
|
||
`commission_user` decimal(18, 4) NULL DEFAULT NULL COMMENT '用户(代理)分成数',
|
||
`commission_parent_user` decimal(18, 4) NULL DEFAULT NULL COMMENT '用户(代理)的上级分成数',
|
||
`commission_owner` decimal(18, 4) NULL DEFAULT NULL COMMENT '房主的分成数',
|
||
`commission_user_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '用户(代理)分成比例(百分比)(0~1)',
|
||
`commission_parent_user_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '上级用户(代理)分成比例(百分比)(0~1)',
|
||
`commission_owner_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '房主分成比例(百分比)(0~1)',
|
||
`create_time` timestamp NULL DEFAULT NULL COMMENT '时间',
|
||
`is_settle` int NULL DEFAULT 0 COMMENT '是否结算(0:否;1:是)',
|
||
`is_robot` int NULL DEFAULT 0 COMMENT '是否是机器人(0:否;1:是)',
|
||
`service_index` int UNSIGNED NULL DEFAULT NULL COMMENT '茶水费的计算序号',
|
||
`out_id` int NOT NULL COMMENT '外部id',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `uk_user_commission_202012_out_id`(`out_id` ASC) USING BTREE,
|
||
UNIQUE INDEX `pk_user_commission_202012`(`id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_service_index`(`agent_id` ASC, `channel_id` ASC, `service_index` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_user_id`(`agent_id` ASC, `channel_id` ASC, `user_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_target_id`(`agent_id` ASC, `channel_id` ASC, `target_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_target_mode_settle`(`target_mode` ASC, `is_settle` ASC, `commission_total` ASC, `create_time` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_user`(`agent_id` ASC, `channel_id` ASC, `player_id` ASC, `user_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_player_id`(`agent_id` ASC, `channel_id` ASC, `player_id` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 422111 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_user_commission_202301
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_user_commission_202301`;
|
||
CREATE TABLE `ct_user_commission_202301` (
|
||
`id` int NOT NULL AUTO_INCREMENT,
|
||
`agent_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '代理',
|
||
`channel_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '渠道',
|
||
`game_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '游戏',
|
||
`room_id` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '房间标识',
|
||
`player_id` int NOT NULL COMMENT '玩家id',
|
||
`user_id` int NULL DEFAULT NULL COMMENT '用户id(玩家绑定的代理)',
|
||
`parent_user_id` int NULL DEFAULT NULL COMMENT '用户id(玩家绑定的代理的上级代理)',
|
||
`room_code` int NOT NULL COMMENT '房号',
|
||
`short_number` int NULL DEFAULT NULL COMMENT '短号',
|
||
`used_card` int NOT NULL COMMENT '使用的房卡数',
|
||
`owner_id` int NOT NULL COMMENT '房主',
|
||
`room_type` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '房间类型',
|
||
`room_mode` tinyint(1) NOT NULL COMMENT '0-普通星星场房间 1-短号星星场房间 2-系统星星房间',
|
||
`commission_type` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '分成类型编号',
|
||
`grade` decimal(18, 4) NOT NULL COMMENT '玩家得分',
|
||
`source_mode` tinyint(1) NULL DEFAULT NULL COMMENT '0-不抽成 1-对大赢家进行抽成 2-对所有赢家抽成 3-对所有玩家抽成',
|
||
`target_mode` tinyint(1) NULL DEFAULT NULL COMMENT '0-抽成给系统 1-抽成给房主 2-抽成给指定玩家 3-抽成给指定玩家的代理账号 4-抽成给房主玩家的代理帐号',
|
||
`target_id` int NULL DEFAULT NULL COMMENT '目标玩家编号(获取抽水的玩家编号)',
|
||
`mode` int NOT NULL COMMENT '抽成模式 1-按得分的百分比抽成 2-按倍数的百分比抽成 3-按固定值抽成',
|
||
`type` tinyint NOT NULL COMMENT '0-大局系统抽成数据 1-小局系统抽成数据',
|
||
`commission_total` decimal(18, 4) NOT NULL COMMENT '总计分成数',
|
||
`commission_system` decimal(18, 4) NULL DEFAULT NULL COMMENT '系统(平台)分成数',
|
||
`commission_user` decimal(18, 4) NULL DEFAULT NULL COMMENT '用户(代理)分成数',
|
||
`commission_parent_user` decimal(18, 4) NULL DEFAULT NULL COMMENT '用户(代理)的上级分成数',
|
||
`commission_owner` decimal(18, 4) NULL DEFAULT NULL COMMENT '房主的分成数',
|
||
`commission_user_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '用户(代理)分成比例(百分比)(0~1)',
|
||
`commission_parent_user_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '上级用户(代理)分成比例(百分比)(0~1)',
|
||
`commission_owner_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '房主分成比例(百分比)(0~1)',
|
||
`create_time` timestamp NULL DEFAULT NULL COMMENT '时间',
|
||
`is_settle` int NULL DEFAULT 0 COMMENT '是否结算(0:否;1:是)',
|
||
`is_robot` int NULL DEFAULT 0 COMMENT '是否是机器人(0:否;1:是)',
|
||
`service_index` int UNSIGNED NULL DEFAULT NULL COMMENT '茶水费的计算序号',
|
||
`out_id` int NOT NULL COMMENT '外部id',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `uk_user_commission_202012_out_id`(`out_id` ASC) USING BTREE,
|
||
UNIQUE INDEX `pk_user_commission_202012`(`id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_service_index`(`agent_id` ASC, `channel_id` ASC, `service_index` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_user_id`(`agent_id` ASC, `channel_id` ASC, `user_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_target_id`(`agent_id` ASC, `channel_id` ASC, `target_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_target_mode_settle`(`target_mode` ASC, `is_settle` ASC, `commission_total` ASC, `create_time` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_user`(`agent_id` ASC, `channel_id` ASC, `player_id` ASC, `user_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_player_id`(`agent_id` ASC, `channel_id` ASC, `player_id` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 554357 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_user_commission_202302
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_user_commission_202302`;
|
||
CREATE TABLE `ct_user_commission_202302` (
|
||
`id` int NOT NULL AUTO_INCREMENT,
|
||
`agent_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '代理',
|
||
`channel_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '渠道',
|
||
`game_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '游戏',
|
||
`room_id` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '房间标识',
|
||
`player_id` int NOT NULL COMMENT '玩家id',
|
||
`user_id` int NULL DEFAULT NULL COMMENT '用户id(玩家绑定的代理)',
|
||
`parent_user_id` int NULL DEFAULT NULL COMMENT '用户id(玩家绑定的代理的上级代理)',
|
||
`room_code` int NOT NULL COMMENT '房号',
|
||
`short_number` int NULL DEFAULT NULL COMMENT '短号',
|
||
`used_card` int NOT NULL COMMENT '使用的房卡数',
|
||
`owner_id` int NOT NULL COMMENT '房主',
|
||
`room_type` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '房间类型',
|
||
`room_mode` tinyint(1) NOT NULL COMMENT '0-普通星星场房间 1-短号星星场房间 2-系统星星房间',
|
||
`commission_type` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '分成类型编号',
|
||
`grade` decimal(18, 4) NOT NULL COMMENT '玩家得分',
|
||
`source_mode` tinyint(1) NULL DEFAULT NULL COMMENT '0-不抽成 1-对大赢家进行抽成 2-对所有赢家抽成 3-对所有玩家抽成',
|
||
`target_mode` tinyint(1) NULL DEFAULT NULL COMMENT '0-抽成给系统 1-抽成给房主 2-抽成给指定玩家 3-抽成给指定玩家的代理账号 4-抽成给房主玩家的代理帐号',
|
||
`target_id` int NULL DEFAULT NULL COMMENT '目标玩家编号(获取抽水的玩家编号)',
|
||
`mode` int NOT NULL COMMENT '抽成模式 1-按得分的百分比抽成 2-按倍数的百分比抽成 3-按固定值抽成',
|
||
`type` tinyint NOT NULL COMMENT '0-大局系统抽成数据 1-小局系统抽成数据',
|
||
`commission_total` decimal(18, 4) NOT NULL COMMENT '总计分成数',
|
||
`commission_system` decimal(18, 4) NULL DEFAULT NULL COMMENT '系统(平台)分成数',
|
||
`commission_user` decimal(18, 4) NULL DEFAULT NULL COMMENT '用户(代理)分成数',
|
||
`commission_parent_user` decimal(18, 4) NULL DEFAULT NULL COMMENT '用户(代理)的上级分成数',
|
||
`commission_owner` decimal(18, 4) NULL DEFAULT NULL COMMENT '房主的分成数',
|
||
`commission_user_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '用户(代理)分成比例(百分比)(0~1)',
|
||
`commission_parent_user_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '上级用户(代理)分成比例(百分比)(0~1)',
|
||
`commission_owner_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '房主分成比例(百分比)(0~1)',
|
||
`create_time` timestamp NULL DEFAULT NULL COMMENT '时间',
|
||
`is_settle` int NULL DEFAULT 0 COMMENT '是否结算(0:否;1:是)',
|
||
`is_robot` int NULL DEFAULT 0 COMMENT '是否是机器人(0:否;1:是)',
|
||
`service_index` int UNSIGNED NULL DEFAULT NULL COMMENT '茶水费的计算序号',
|
||
`out_id` int NOT NULL COMMENT '外部id',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `uk_user_commission_202012_out_id`(`out_id` ASC) USING BTREE,
|
||
UNIQUE INDEX `pk_user_commission_202012`(`id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_service_index`(`agent_id` ASC, `channel_id` ASC, `service_index` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_user_id`(`agent_id` ASC, `channel_id` ASC, `user_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_target_id`(`agent_id` ASC, `channel_id` ASC, `target_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_target_mode_settle`(`target_mode` ASC, `is_settle` ASC, `commission_total` ASC, `create_time` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_user`(`agent_id` ASC, `channel_id` ASC, `player_id` ASC, `user_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_player_id`(`agent_id` ASC, `channel_id` ASC, `player_id` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 597851 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_user_commission_202303
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_user_commission_202303`;
|
||
CREATE TABLE `ct_user_commission_202303` (
|
||
`id` int NOT NULL AUTO_INCREMENT,
|
||
`agent_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '代理',
|
||
`channel_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '渠道',
|
||
`game_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '游戏',
|
||
`room_id` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '房间标识',
|
||
`player_id` int NOT NULL COMMENT '玩家id',
|
||
`user_id` int NULL DEFAULT NULL COMMENT '用户id(玩家绑定的代理)',
|
||
`parent_user_id` int NULL DEFAULT NULL COMMENT '用户id(玩家绑定的代理的上级代理)',
|
||
`room_code` int NOT NULL COMMENT '房号',
|
||
`short_number` int NULL DEFAULT NULL COMMENT '短号',
|
||
`used_card` int NOT NULL COMMENT '使用的房卡数',
|
||
`owner_id` int NOT NULL COMMENT '房主',
|
||
`room_type` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '房间类型',
|
||
`room_mode` tinyint(1) NOT NULL COMMENT '0-普通星星场房间 1-短号星星场房间 2-系统星星房间',
|
||
`commission_type` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '分成类型编号',
|
||
`grade` decimal(18, 4) NOT NULL COMMENT '玩家得分',
|
||
`source_mode` tinyint(1) NULL DEFAULT NULL COMMENT '0-不抽成 1-对大赢家进行抽成 2-对所有赢家抽成 3-对所有玩家抽成',
|
||
`target_mode` tinyint(1) NULL DEFAULT NULL COMMENT '0-抽成给系统 1-抽成给房主 2-抽成给指定玩家 3-抽成给指定玩家的代理账号 4-抽成给房主玩家的代理帐号',
|
||
`target_id` int NULL DEFAULT NULL COMMENT '目标玩家编号(获取抽水的玩家编号)',
|
||
`mode` int NOT NULL COMMENT '抽成模式 1-按得分的百分比抽成 2-按倍数的百分比抽成 3-按固定值抽成',
|
||
`type` tinyint NOT NULL COMMENT '0-大局系统抽成数据 1-小局系统抽成数据',
|
||
`commission_total` decimal(18, 4) NOT NULL COMMENT '总计分成数',
|
||
`commission_system` decimal(18, 4) NULL DEFAULT NULL COMMENT '系统(平台)分成数',
|
||
`commission_user` decimal(18, 4) NULL DEFAULT NULL COMMENT '用户(代理)分成数',
|
||
`commission_parent_user` decimal(18, 4) NULL DEFAULT NULL COMMENT '用户(代理)的上级分成数',
|
||
`commission_owner` decimal(18, 4) NULL DEFAULT NULL COMMENT '房主的分成数',
|
||
`commission_user_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '用户(代理)分成比例(百分比)(0~1)',
|
||
`commission_parent_user_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '上级用户(代理)分成比例(百分比)(0~1)',
|
||
`commission_owner_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '房主分成比例(百分比)(0~1)',
|
||
`create_time` timestamp NULL DEFAULT NULL COMMENT '时间',
|
||
`is_settle` int NULL DEFAULT 0 COMMENT '是否结算(0:否;1:是)',
|
||
`is_robot` int NULL DEFAULT 0 COMMENT '是否是机器人(0:否;1:是)',
|
||
`service_index` int UNSIGNED NULL DEFAULT NULL COMMENT '茶水费的计算序号',
|
||
`out_id` int NOT NULL COMMENT '外部id',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `uk_user_commission_202012_out_id`(`out_id` ASC) USING BTREE,
|
||
UNIQUE INDEX `pk_user_commission_202012`(`id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_service_index`(`agent_id` ASC, `channel_id` ASC, `service_index` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_user_id`(`agent_id` ASC, `channel_id` ASC, `user_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_target_id`(`agent_id` ASC, `channel_id` ASC, `target_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_target_mode_settle`(`target_mode` ASC, `is_settle` ASC, `commission_total` ASC, `create_time` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_user`(`agent_id` ASC, `channel_id` ASC, `player_id` ASC, `user_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_player_id`(`agent_id` ASC, `channel_id` ASC, `player_id` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 667992 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_user_commission_202304
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_user_commission_202304`;
|
||
CREATE TABLE `ct_user_commission_202304` (
|
||
`id` int NOT NULL AUTO_INCREMENT,
|
||
`agent_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '代理',
|
||
`channel_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '渠道',
|
||
`game_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '游戏',
|
||
`room_id` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '房间标识',
|
||
`player_id` int NOT NULL COMMENT '玩家id',
|
||
`user_id` int NULL DEFAULT NULL COMMENT '用户id(玩家绑定的代理)',
|
||
`parent_user_id` int NULL DEFAULT NULL COMMENT '用户id(玩家绑定的代理的上级代理)',
|
||
`room_code` int NOT NULL COMMENT '房号',
|
||
`short_number` int NULL DEFAULT NULL COMMENT '短号',
|
||
`used_card` int NOT NULL COMMENT '使用的房卡数',
|
||
`owner_id` int NOT NULL COMMENT '房主',
|
||
`room_type` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '房间类型',
|
||
`room_mode` tinyint(1) NOT NULL COMMENT '0-普通星星场房间 1-短号星星场房间 2-系统星星房间',
|
||
`commission_type` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '分成类型编号',
|
||
`grade` decimal(18, 4) NOT NULL COMMENT '玩家得分',
|
||
`source_mode` tinyint(1) NULL DEFAULT NULL COMMENT '0-不抽成 1-对大赢家进行抽成 2-对所有赢家抽成 3-对所有玩家抽成',
|
||
`target_mode` tinyint(1) NULL DEFAULT NULL COMMENT '0-抽成给系统 1-抽成给房主 2-抽成给指定玩家 3-抽成给指定玩家的代理账号 4-抽成给房主玩家的代理帐号',
|
||
`target_id` int NULL DEFAULT NULL COMMENT '目标玩家编号(获取抽水的玩家编号)',
|
||
`mode` int NOT NULL COMMENT '抽成模式 1-按得分的百分比抽成 2-按倍数的百分比抽成 3-按固定值抽成',
|
||
`type` tinyint NOT NULL COMMENT '0-大局系统抽成数据 1-小局系统抽成数据',
|
||
`commission_total` decimal(18, 4) NOT NULL COMMENT '总计分成数',
|
||
`commission_system` decimal(18, 4) NULL DEFAULT NULL COMMENT '系统(平台)分成数',
|
||
`commission_user` decimal(18, 4) NULL DEFAULT NULL COMMENT '用户(代理)分成数',
|
||
`commission_parent_user` decimal(18, 4) NULL DEFAULT NULL COMMENT '用户(代理)的上级分成数',
|
||
`commission_owner` decimal(18, 4) NULL DEFAULT NULL COMMENT '房主的分成数',
|
||
`commission_user_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '用户(代理)分成比例(百分比)(0~1)',
|
||
`commission_parent_user_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '上级用户(代理)分成比例(百分比)(0~1)',
|
||
`commission_owner_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '房主分成比例(百分比)(0~1)',
|
||
`create_time` timestamp NULL DEFAULT NULL COMMENT '时间',
|
||
`is_settle` int NULL DEFAULT 0 COMMENT '是否结算(0:否;1:是)',
|
||
`is_robot` int NULL DEFAULT 0 COMMENT '是否是机器人(0:否;1:是)',
|
||
`service_index` int UNSIGNED NULL DEFAULT NULL COMMENT '茶水费的计算序号',
|
||
`out_id` int NOT NULL COMMENT '外部id',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `uk_user_commission_202012_out_id`(`out_id` ASC) USING BTREE,
|
||
UNIQUE INDEX `pk_user_commission_202012`(`id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_service_index`(`agent_id` ASC, `channel_id` ASC, `service_index` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_user_id`(`agent_id` ASC, `channel_id` ASC, `user_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_target_id`(`agent_id` ASC, `channel_id` ASC, `target_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_target_mode_settle`(`target_mode` ASC, `is_settle` ASC, `commission_total` ASC, `create_time` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_user`(`agent_id` ASC, `channel_id` ASC, `player_id` ASC, `user_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_player_id`(`agent_id` ASC, `channel_id` ASC, `player_id` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 659289 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_user_commission_202305
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_user_commission_202305`;
|
||
CREATE TABLE `ct_user_commission_202305` (
|
||
`id` int NOT NULL AUTO_INCREMENT,
|
||
`agent_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '代理',
|
||
`channel_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '渠道',
|
||
`game_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '游戏',
|
||
`room_id` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '房间标识',
|
||
`player_id` int NOT NULL COMMENT '玩家id',
|
||
`user_id` int NULL DEFAULT NULL COMMENT '用户id(玩家绑定的代理)',
|
||
`parent_user_id` int NULL DEFAULT NULL COMMENT '用户id(玩家绑定的代理的上级代理)',
|
||
`room_code` int NOT NULL COMMENT '房号',
|
||
`short_number` int NULL DEFAULT NULL COMMENT '短号',
|
||
`used_card` int NOT NULL COMMENT '使用的房卡数',
|
||
`owner_id` int NOT NULL COMMENT '房主',
|
||
`room_type` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '房间类型',
|
||
`room_mode` tinyint(1) NOT NULL COMMENT '0-普通星星场房间 1-短号星星场房间 2-系统星星房间',
|
||
`commission_type` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '分成类型编号',
|
||
`grade` decimal(18, 4) NOT NULL COMMENT '玩家得分',
|
||
`source_mode` tinyint(1) NULL DEFAULT NULL COMMENT '0-不抽成 1-对大赢家进行抽成 2-对所有赢家抽成 3-对所有玩家抽成',
|
||
`target_mode` tinyint(1) NULL DEFAULT NULL COMMENT '0-抽成给系统 1-抽成给房主 2-抽成给指定玩家 3-抽成给指定玩家的代理账号 4-抽成给房主玩家的代理帐号',
|
||
`target_id` int NULL DEFAULT NULL COMMENT '目标玩家编号(获取抽水的玩家编号)',
|
||
`mode` int NOT NULL COMMENT '抽成模式 1-按得分的百分比抽成 2-按倍数的百分比抽成 3-按固定值抽成',
|
||
`type` tinyint NOT NULL COMMENT '0-大局系统抽成数据 1-小局系统抽成数据',
|
||
`commission_total` decimal(18, 4) NOT NULL COMMENT '总计分成数',
|
||
`commission_system` decimal(18, 4) NULL DEFAULT NULL COMMENT '系统(平台)分成数',
|
||
`commission_user` decimal(18, 4) NULL DEFAULT NULL COMMENT '用户(代理)分成数',
|
||
`commission_parent_user` decimal(18, 4) NULL DEFAULT NULL COMMENT '用户(代理)的上级分成数',
|
||
`commission_owner` decimal(18, 4) NULL DEFAULT NULL COMMENT '房主的分成数',
|
||
`commission_user_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '用户(代理)分成比例(百分比)(0~1)',
|
||
`commission_parent_user_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '上级用户(代理)分成比例(百分比)(0~1)',
|
||
`commission_owner_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '房主分成比例(百分比)(0~1)',
|
||
`create_time` timestamp NULL DEFAULT NULL COMMENT '时间',
|
||
`is_settle` int NULL DEFAULT 0 COMMENT '是否结算(0:否;1:是)',
|
||
`is_robot` int NULL DEFAULT 0 COMMENT '是否是机器人(0:否;1:是)',
|
||
`service_index` int UNSIGNED NULL DEFAULT NULL COMMENT '茶水费的计算序号',
|
||
`out_id` int NOT NULL COMMENT '外部id',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `uk_user_commission_202012_out_id`(`out_id` ASC) USING BTREE,
|
||
UNIQUE INDEX `pk_user_commission_202012`(`id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_service_index`(`agent_id` ASC, `channel_id` ASC, `service_index` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_user_id`(`agent_id` ASC, `channel_id` ASC, `user_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_target_id`(`agent_id` ASC, `channel_id` ASC, `target_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_target_mode_settle`(`target_mode` ASC, `is_settle` ASC, `commission_total` ASC, `create_time` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_user`(`agent_id` ASC, `channel_id` ASC, `player_id` ASC, `user_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_player_id`(`agent_id` ASC, `channel_id` ASC, `player_id` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 651608 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_user_commission_202306
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_user_commission_202306`;
|
||
CREATE TABLE `ct_user_commission_202306` (
|
||
`id` int NOT NULL AUTO_INCREMENT,
|
||
`agent_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '代理',
|
||
`channel_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '渠道',
|
||
`game_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '游戏',
|
||
`room_id` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '房间标识',
|
||
`player_id` int NOT NULL COMMENT '玩家id',
|
||
`user_id` int NULL DEFAULT NULL COMMENT '用户id(玩家绑定的代理)',
|
||
`parent_user_id` int NULL DEFAULT NULL COMMENT '用户id(玩家绑定的代理的上级代理)',
|
||
`room_code` int NOT NULL COMMENT '房号',
|
||
`short_number` int NULL DEFAULT NULL COMMENT '短号',
|
||
`used_card` int NOT NULL COMMENT '使用的房卡数',
|
||
`owner_id` int NOT NULL COMMENT '房主',
|
||
`room_type` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '房间类型',
|
||
`room_mode` tinyint(1) NOT NULL COMMENT '0-普通星星场房间 1-短号星星场房间 2-系统星星房间',
|
||
`commission_type` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '分成类型编号',
|
||
`grade` decimal(18, 4) NOT NULL COMMENT '玩家得分',
|
||
`source_mode` tinyint(1) NULL DEFAULT NULL COMMENT '0-不抽成 1-对大赢家进行抽成 2-对所有赢家抽成 3-对所有玩家抽成',
|
||
`target_mode` tinyint(1) NULL DEFAULT NULL COMMENT '0-抽成给系统 1-抽成给房主 2-抽成给指定玩家 3-抽成给指定玩家的代理账号 4-抽成给房主玩家的代理帐号',
|
||
`target_id` int NULL DEFAULT NULL COMMENT '目标玩家编号(获取抽水的玩家编号)',
|
||
`mode` int NOT NULL COMMENT '抽成模式 1-按得分的百分比抽成 2-按倍数的百分比抽成 3-按固定值抽成',
|
||
`type` tinyint NOT NULL COMMENT '0-大局系统抽成数据 1-小局系统抽成数据',
|
||
`commission_total` decimal(18, 4) NOT NULL COMMENT '总计分成数',
|
||
`commission_system` decimal(18, 4) NULL DEFAULT NULL COMMENT '系统(平台)分成数',
|
||
`commission_user` decimal(18, 4) NULL DEFAULT NULL COMMENT '用户(代理)分成数',
|
||
`commission_parent_user` decimal(18, 4) NULL DEFAULT NULL COMMENT '用户(代理)的上级分成数',
|
||
`commission_owner` decimal(18, 4) NULL DEFAULT NULL COMMENT '房主的分成数',
|
||
`commission_user_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '用户(代理)分成比例(百分比)(0~1)',
|
||
`commission_parent_user_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '上级用户(代理)分成比例(百分比)(0~1)',
|
||
`commission_owner_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '房主分成比例(百分比)(0~1)',
|
||
`create_time` timestamp NULL DEFAULT NULL COMMENT '时间',
|
||
`is_settle` int NULL DEFAULT 0 COMMENT '是否结算(0:否;1:是)',
|
||
`is_robot` int NULL DEFAULT 0 COMMENT '是否是机器人(0:否;1:是)',
|
||
`service_index` int UNSIGNED NULL DEFAULT NULL COMMENT '茶水费的计算序号',
|
||
`out_id` int NOT NULL COMMENT '外部id',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `uk_user_commission_202012_out_id`(`out_id` ASC) USING BTREE,
|
||
UNIQUE INDEX `pk_user_commission_202012`(`id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_service_index`(`agent_id` ASC, `channel_id` ASC, `service_index` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_user_id`(`agent_id` ASC, `channel_id` ASC, `user_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_target_id`(`agent_id` ASC, `channel_id` ASC, `target_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_target_mode_settle`(`target_mode` ASC, `is_settle` ASC, `commission_total` ASC, `create_time` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_user`(`agent_id` ASC, `channel_id` ASC, `player_id` ASC, `user_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_player_id`(`agent_id` ASC, `channel_id` ASC, `player_id` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 622425 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_user_commission_202307
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_user_commission_202307`;
|
||
CREATE TABLE `ct_user_commission_202307` (
|
||
`id` int NOT NULL AUTO_INCREMENT,
|
||
`agent_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '代理',
|
||
`channel_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '渠道',
|
||
`game_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '游戏',
|
||
`room_id` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '房间标识',
|
||
`player_id` int NOT NULL COMMENT '玩家id',
|
||
`user_id` int NULL DEFAULT NULL COMMENT '用户id(玩家绑定的代理)',
|
||
`parent_user_id` int NULL DEFAULT NULL COMMENT '用户id(玩家绑定的代理的上级代理)',
|
||
`room_code` int NOT NULL COMMENT '房号',
|
||
`short_number` int NULL DEFAULT NULL COMMENT '短号',
|
||
`used_card` int NOT NULL COMMENT '使用的房卡数',
|
||
`owner_id` int NOT NULL COMMENT '房主',
|
||
`room_type` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '房间类型',
|
||
`room_mode` tinyint(1) NOT NULL COMMENT '0-普通星星场房间 1-短号星星场房间 2-系统星星房间',
|
||
`commission_type` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '分成类型编号',
|
||
`grade` decimal(18, 4) NOT NULL COMMENT '玩家得分',
|
||
`source_mode` tinyint(1) NULL DEFAULT NULL COMMENT '0-不抽成 1-对大赢家进行抽成 2-对所有赢家抽成 3-对所有玩家抽成',
|
||
`target_mode` tinyint(1) NULL DEFAULT NULL COMMENT '0-抽成给系统 1-抽成给房主 2-抽成给指定玩家 3-抽成给指定玩家的代理账号 4-抽成给房主玩家的代理帐号',
|
||
`target_id` int NULL DEFAULT NULL COMMENT '目标玩家编号(获取抽水的玩家编号)',
|
||
`mode` int NOT NULL COMMENT '抽成模式 1-按得分的百分比抽成 2-按倍数的百分比抽成 3-按固定值抽成',
|
||
`type` tinyint NOT NULL COMMENT '0-大局系统抽成数据 1-小局系统抽成数据',
|
||
`commission_total` decimal(18, 4) NOT NULL COMMENT '总计分成数',
|
||
`commission_system` decimal(18, 4) NULL DEFAULT NULL COMMENT '系统(平台)分成数',
|
||
`commission_user` decimal(18, 4) NULL DEFAULT NULL COMMENT '用户(代理)分成数',
|
||
`commission_parent_user` decimal(18, 4) NULL DEFAULT NULL COMMENT '用户(代理)的上级分成数',
|
||
`commission_owner` decimal(18, 4) NULL DEFAULT NULL COMMENT '房主的分成数',
|
||
`commission_user_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '用户(代理)分成比例(百分比)(0~1)',
|
||
`commission_parent_user_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '上级用户(代理)分成比例(百分比)(0~1)',
|
||
`commission_owner_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '房主分成比例(百分比)(0~1)',
|
||
`create_time` timestamp NULL DEFAULT NULL COMMENT '时间',
|
||
`is_settle` int NULL DEFAULT 0 COMMENT '是否结算(0:否;1:是)',
|
||
`is_robot` int NULL DEFAULT 0 COMMENT '是否是机器人(0:否;1:是)',
|
||
`service_index` int UNSIGNED NULL DEFAULT NULL COMMENT '茶水费的计算序号',
|
||
`out_id` int NOT NULL COMMENT '外部id',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `uk_user_commission_202012_out_id`(`out_id` ASC) USING BTREE,
|
||
UNIQUE INDEX `pk_user_commission_202012`(`id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_service_index`(`agent_id` ASC, `channel_id` ASC, `service_index` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_user_id`(`agent_id` ASC, `channel_id` ASC, `user_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_target_id`(`agent_id` ASC, `channel_id` ASC, `target_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_target_mode_settle`(`target_mode` ASC, `is_settle` ASC, `commission_total` ASC, `create_time` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_user`(`agent_id` ASC, `channel_id` ASC, `player_id` ASC, `user_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_player_id`(`agent_id` ASC, `channel_id` ASC, `player_id` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 585560 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_user_commission_202308
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_user_commission_202308`;
|
||
CREATE TABLE `ct_user_commission_202308` (
|
||
`id` int NOT NULL AUTO_INCREMENT,
|
||
`agent_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '代理',
|
||
`channel_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '渠道',
|
||
`game_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '游戏',
|
||
`room_id` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '房间标识',
|
||
`player_id` int NOT NULL COMMENT '玩家id',
|
||
`user_id` int NULL DEFAULT NULL COMMENT '用户id(玩家绑定的代理)',
|
||
`parent_user_id` int NULL DEFAULT NULL COMMENT '用户id(玩家绑定的代理的上级代理)',
|
||
`room_code` int NOT NULL COMMENT '房号',
|
||
`short_number` int NULL DEFAULT NULL COMMENT '短号',
|
||
`used_card` int NOT NULL COMMENT '使用的房卡数',
|
||
`owner_id` int NOT NULL COMMENT '房主',
|
||
`room_type` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '房间类型',
|
||
`room_mode` tinyint(1) NOT NULL COMMENT '0-普通星星场房间 1-短号星星场房间 2-系统星星房间',
|
||
`commission_type` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '分成类型编号',
|
||
`grade` decimal(18, 4) NOT NULL COMMENT '玩家得分',
|
||
`source_mode` tinyint(1) NULL DEFAULT NULL COMMENT '0-不抽成 1-对大赢家进行抽成 2-对所有赢家抽成 3-对所有玩家抽成',
|
||
`target_mode` tinyint(1) NULL DEFAULT NULL COMMENT '0-抽成给系统 1-抽成给房主 2-抽成给指定玩家 3-抽成给指定玩家的代理账号 4-抽成给房主玩家的代理帐号',
|
||
`target_id` int NULL DEFAULT NULL COMMENT '目标玩家编号(获取抽水的玩家编号)',
|
||
`mode` int NOT NULL COMMENT '抽成模式 1-按得分的百分比抽成 2-按倍数的百分比抽成 3-按固定值抽成',
|
||
`type` tinyint NOT NULL COMMENT '0-大局系统抽成数据 1-小局系统抽成数据',
|
||
`commission_total` decimal(18, 4) NOT NULL COMMENT '总计分成数',
|
||
`commission_system` decimal(18, 4) NULL DEFAULT NULL COMMENT '系统(平台)分成数',
|
||
`commission_user` decimal(18, 4) NULL DEFAULT NULL COMMENT '用户(代理)分成数',
|
||
`commission_parent_user` decimal(18, 4) NULL DEFAULT NULL COMMENT '用户(代理)的上级分成数',
|
||
`commission_owner` decimal(18, 4) NULL DEFAULT NULL COMMENT '房主的分成数',
|
||
`commission_user_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '用户(代理)分成比例(百分比)(0~1)',
|
||
`commission_parent_user_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '上级用户(代理)分成比例(百分比)(0~1)',
|
||
`commission_owner_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '房主分成比例(百分比)(0~1)',
|
||
`create_time` timestamp NULL DEFAULT NULL COMMENT '时间',
|
||
`is_settle` int NULL DEFAULT 0 COMMENT '是否结算(0:否;1:是)',
|
||
`is_robot` int NULL DEFAULT 0 COMMENT '是否是机器人(0:否;1:是)',
|
||
`service_index` int UNSIGNED NULL DEFAULT NULL COMMENT '茶水费的计算序号',
|
||
`out_id` int NOT NULL COMMENT '外部id',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `uk_user_commission_202012_out_id`(`out_id` ASC) USING BTREE,
|
||
UNIQUE INDEX `pk_user_commission_202012`(`id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_service_index`(`agent_id` ASC, `channel_id` ASC, `service_index` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_user_id`(`agent_id` ASC, `channel_id` ASC, `user_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_target_id`(`agent_id` ASC, `channel_id` ASC, `target_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_target_mode_settle`(`target_mode` ASC, `is_settle` ASC, `commission_total` ASC, `create_time` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_user`(`agent_id` ASC, `channel_id` ASC, `player_id` ASC, `user_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_player_id`(`agent_id` ASC, `channel_id` ASC, `player_id` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 548696 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_user_commission_202309
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_user_commission_202309`;
|
||
CREATE TABLE `ct_user_commission_202309` (
|
||
`id` int NOT NULL AUTO_INCREMENT,
|
||
`agent_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '代理',
|
||
`channel_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '渠道',
|
||
`game_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '游戏',
|
||
`room_id` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '房间标识',
|
||
`player_id` int NOT NULL COMMENT '玩家id',
|
||
`user_id` int NULL DEFAULT NULL COMMENT '用户id(玩家绑定的代理)',
|
||
`parent_user_id` int NULL DEFAULT NULL COMMENT '用户id(玩家绑定的代理的上级代理)',
|
||
`room_code` int NOT NULL COMMENT '房号',
|
||
`short_number` int NULL DEFAULT NULL COMMENT '短号',
|
||
`used_card` int NOT NULL COMMENT '使用的房卡数',
|
||
`owner_id` int NOT NULL COMMENT '房主',
|
||
`room_type` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '房间类型',
|
||
`room_mode` tinyint(1) NOT NULL COMMENT '0-普通星星场房间 1-短号星星场房间 2-系统星星房间',
|
||
`commission_type` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '分成类型编号',
|
||
`grade` decimal(18, 4) NOT NULL COMMENT '玩家得分',
|
||
`source_mode` tinyint(1) NULL DEFAULT NULL COMMENT '0-不抽成 1-对大赢家进行抽成 2-对所有赢家抽成 3-对所有玩家抽成',
|
||
`target_mode` tinyint(1) NULL DEFAULT NULL COMMENT '0-抽成给系统 1-抽成给房主 2-抽成给指定玩家 3-抽成给指定玩家的代理账号 4-抽成给房主玩家的代理帐号',
|
||
`target_id` int NULL DEFAULT NULL COMMENT '目标玩家编号(获取抽水的玩家编号)',
|
||
`mode` int NOT NULL COMMENT '抽成模式 1-按得分的百分比抽成 2-按倍数的百分比抽成 3-按固定值抽成',
|
||
`type` tinyint NOT NULL COMMENT '0-大局系统抽成数据 1-小局系统抽成数据',
|
||
`commission_total` decimal(18, 4) NOT NULL COMMENT '总计分成数',
|
||
`commission_system` decimal(18, 4) NULL DEFAULT NULL COMMENT '系统(平台)分成数',
|
||
`commission_user` decimal(18, 4) NULL DEFAULT NULL COMMENT '用户(代理)分成数',
|
||
`commission_parent_user` decimal(18, 4) NULL DEFAULT NULL COMMENT '用户(代理)的上级分成数',
|
||
`commission_owner` decimal(18, 4) NULL DEFAULT NULL COMMENT '房主的分成数',
|
||
`commission_user_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '用户(代理)分成比例(百分比)(0~1)',
|
||
`commission_parent_user_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '上级用户(代理)分成比例(百分比)(0~1)',
|
||
`commission_owner_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '房主分成比例(百分比)(0~1)',
|
||
`create_time` timestamp NULL DEFAULT NULL COMMENT '时间',
|
||
`is_settle` int NULL DEFAULT 0 COMMENT '是否结算(0:否;1:是)',
|
||
`is_robot` int NULL DEFAULT 0 COMMENT '是否是机器人(0:否;1:是)',
|
||
`service_index` int UNSIGNED NULL DEFAULT NULL COMMENT '茶水费的计算序号',
|
||
`out_id` int NOT NULL COMMENT '外部id',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `uk_user_commission_202012_out_id`(`out_id` ASC) USING BTREE,
|
||
UNIQUE INDEX `pk_user_commission_202012`(`id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_service_index`(`agent_id` ASC, `channel_id` ASC, `service_index` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_user_id`(`agent_id` ASC, `channel_id` ASC, `user_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_target_id`(`agent_id` ASC, `channel_id` ASC, `target_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_target_mode_settle`(`target_mode` ASC, `is_settle` ASC, `commission_total` ASC, `create_time` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_user`(`agent_id` ASC, `channel_id` ASC, `player_id` ASC, `user_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_player_id`(`agent_id` ASC, `channel_id` ASC, `player_id` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 610649 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_user_commission_202310
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_user_commission_202310`;
|
||
CREATE TABLE `ct_user_commission_202310` (
|
||
`id` int NOT NULL AUTO_INCREMENT,
|
||
`agent_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '代理',
|
||
`channel_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '渠道',
|
||
`game_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '游戏',
|
||
`room_id` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '房间标识',
|
||
`player_id` int NOT NULL COMMENT '玩家id',
|
||
`user_id` int NULL DEFAULT NULL COMMENT '用户id(玩家绑定的代理)',
|
||
`parent_user_id` int NULL DEFAULT NULL COMMENT '用户id(玩家绑定的代理的上级代理)',
|
||
`room_code` int NOT NULL COMMENT '房号',
|
||
`short_number` int NULL DEFAULT NULL COMMENT '短号',
|
||
`used_card` int NOT NULL COMMENT '使用的房卡数',
|
||
`owner_id` int NOT NULL COMMENT '房主',
|
||
`room_type` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '房间类型',
|
||
`room_mode` tinyint(1) NOT NULL COMMENT '0-普通星星场房间 1-短号星星场房间 2-系统星星房间',
|
||
`commission_type` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '分成类型编号',
|
||
`grade` decimal(18, 4) NOT NULL COMMENT '玩家得分',
|
||
`source_mode` tinyint(1) NULL DEFAULT NULL COMMENT '0-不抽成 1-对大赢家进行抽成 2-对所有赢家抽成 3-对所有玩家抽成',
|
||
`target_mode` tinyint(1) NULL DEFAULT NULL COMMENT '0-抽成给系统 1-抽成给房主 2-抽成给指定玩家 3-抽成给指定玩家的代理账号 4-抽成给房主玩家的代理帐号',
|
||
`target_id` int NULL DEFAULT NULL COMMENT '目标玩家编号(获取抽水的玩家编号)',
|
||
`mode` int NOT NULL COMMENT '抽成模式 1-按得分的百分比抽成 2-按倍数的百分比抽成 3-按固定值抽成',
|
||
`type` tinyint NOT NULL COMMENT '0-大局系统抽成数据 1-小局系统抽成数据',
|
||
`commission_total` decimal(18, 4) NOT NULL COMMENT '总计分成数',
|
||
`commission_system` decimal(18, 4) NULL DEFAULT NULL COMMENT '系统(平台)分成数',
|
||
`commission_user` decimal(18, 4) NULL DEFAULT NULL COMMENT '用户(代理)分成数',
|
||
`commission_parent_user` decimal(18, 4) NULL DEFAULT NULL COMMENT '用户(代理)的上级分成数',
|
||
`commission_owner` decimal(18, 4) NULL DEFAULT NULL COMMENT '房主的分成数',
|
||
`commission_user_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '用户(代理)分成比例(百分比)(0~1)',
|
||
`commission_parent_user_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '上级用户(代理)分成比例(百分比)(0~1)',
|
||
`commission_owner_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '房主分成比例(百分比)(0~1)',
|
||
`create_time` timestamp NULL DEFAULT NULL COMMENT '时间',
|
||
`is_settle` int NULL DEFAULT 0 COMMENT '是否结算(0:否;1:是)',
|
||
`is_robot` int NULL DEFAULT 0 COMMENT '是否是机器人(0:否;1:是)',
|
||
`service_index` int UNSIGNED NULL DEFAULT NULL COMMENT '茶水费的计算序号',
|
||
`out_id` int NOT NULL COMMENT '外部id',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `uk_user_commission_202012_out_id`(`out_id` ASC) USING BTREE,
|
||
UNIQUE INDEX `pk_user_commission_202012`(`id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_service_index`(`agent_id` ASC, `channel_id` ASC, `service_index` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_user_id`(`agent_id` ASC, `channel_id` ASC, `user_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_target_id`(`agent_id` ASC, `channel_id` ASC, `target_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_target_mode_settle`(`target_mode` ASC, `is_settle` ASC, `commission_total` ASC, `create_time` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_user`(`agent_id` ASC, `channel_id` ASC, `player_id` ASC, `user_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_player_id`(`agent_id` ASC, `channel_id` ASC, `player_id` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 631128 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_user_commission_202311
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_user_commission_202311`;
|
||
CREATE TABLE `ct_user_commission_202311` (
|
||
`id` int NOT NULL AUTO_INCREMENT,
|
||
`agent_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '代理',
|
||
`channel_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '渠道',
|
||
`game_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '游戏',
|
||
`room_id` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '房间标识',
|
||
`player_id` int NOT NULL COMMENT '玩家id',
|
||
`user_id` int NULL DEFAULT NULL COMMENT '用户id(玩家绑定的代理)',
|
||
`parent_user_id` int NULL DEFAULT NULL COMMENT '用户id(玩家绑定的代理的上级代理)',
|
||
`room_code` int NOT NULL COMMENT '房号',
|
||
`short_number` int NULL DEFAULT NULL COMMENT '短号',
|
||
`used_card` int NOT NULL COMMENT '使用的房卡数',
|
||
`owner_id` int NOT NULL COMMENT '房主',
|
||
`room_type` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '房间类型',
|
||
`room_mode` tinyint(1) NOT NULL COMMENT '0-普通星星场房间 1-短号星星场房间 2-系统星星房间',
|
||
`commission_type` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '分成类型编号',
|
||
`grade` decimal(18, 4) NOT NULL COMMENT '玩家得分',
|
||
`source_mode` tinyint(1) NULL DEFAULT NULL COMMENT '0-不抽成 1-对大赢家进行抽成 2-对所有赢家抽成 3-对所有玩家抽成',
|
||
`target_mode` tinyint(1) NULL DEFAULT NULL COMMENT '0-抽成给系统 1-抽成给房主 2-抽成给指定玩家 3-抽成给指定玩家的代理账号 4-抽成给房主玩家的代理帐号',
|
||
`target_id` int NULL DEFAULT NULL COMMENT '目标玩家编号(获取抽水的玩家编号)',
|
||
`mode` int NOT NULL COMMENT '抽成模式 1-按得分的百分比抽成 2-按倍数的百分比抽成 3-按固定值抽成',
|
||
`type` tinyint NOT NULL COMMENT '0-大局系统抽成数据 1-小局系统抽成数据',
|
||
`commission_total` decimal(18, 4) NOT NULL COMMENT '总计分成数',
|
||
`commission_system` decimal(18, 4) NULL DEFAULT NULL COMMENT '系统(平台)分成数',
|
||
`commission_user` decimal(18, 4) NULL DEFAULT NULL COMMENT '用户(代理)分成数',
|
||
`commission_parent_user` decimal(18, 4) NULL DEFAULT NULL COMMENT '用户(代理)的上级分成数',
|
||
`commission_owner` decimal(18, 4) NULL DEFAULT NULL COMMENT '房主的分成数',
|
||
`commission_user_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '用户(代理)分成比例(百分比)(0~1)',
|
||
`commission_parent_user_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '上级用户(代理)分成比例(百分比)(0~1)',
|
||
`commission_owner_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '房主分成比例(百分比)(0~1)',
|
||
`create_time` timestamp NULL DEFAULT NULL COMMENT '时间',
|
||
`is_settle` int NULL DEFAULT 0 COMMENT '是否结算(0:否;1:是)',
|
||
`is_robot` int NULL DEFAULT 0 COMMENT '是否是机器人(0:否;1:是)',
|
||
`service_index` int UNSIGNED NULL DEFAULT NULL COMMENT '茶水费的计算序号',
|
||
`out_id` int NOT NULL COMMENT '外部id',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `uk_user_commission_202012_out_id`(`out_id` ASC) USING BTREE,
|
||
UNIQUE INDEX `pk_user_commission_202012`(`id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_service_index`(`agent_id` ASC, `channel_id` ASC, `service_index` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_user_id`(`agent_id` ASC, `channel_id` ASC, `user_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_target_id`(`agent_id` ASC, `channel_id` ASC, `target_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_target_mode_settle`(`target_mode` ASC, `is_settle` ASC, `commission_total` ASC, `create_time` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_user`(`agent_id` ASC, `channel_id` ASC, `player_id` ASC, `user_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_player_id`(`agent_id` ASC, `channel_id` ASC, `player_id` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 594265 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_user_commission_202312
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_user_commission_202312`;
|
||
CREATE TABLE `ct_user_commission_202312` (
|
||
`id` int NOT NULL AUTO_INCREMENT,
|
||
`agent_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '代理',
|
||
`channel_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '渠道',
|
||
`game_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '游戏',
|
||
`room_id` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '房间标识',
|
||
`player_id` int NOT NULL COMMENT '玩家id',
|
||
`user_id` int NULL DEFAULT NULL COMMENT '用户id(玩家绑定的代理)',
|
||
`parent_user_id` int NULL DEFAULT NULL COMMENT '用户id(玩家绑定的代理的上级代理)',
|
||
`room_code` int NOT NULL COMMENT '房号',
|
||
`short_number` int NULL DEFAULT NULL COMMENT '短号',
|
||
`used_card` int NOT NULL COMMENT '使用的房卡数',
|
||
`owner_id` int NOT NULL COMMENT '房主',
|
||
`room_type` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '房间类型',
|
||
`room_mode` tinyint(1) NOT NULL COMMENT '0-普通星星场房间 1-短号星星场房间 2-系统星星房间',
|
||
`commission_type` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '分成类型编号',
|
||
`grade` decimal(18, 4) NOT NULL COMMENT '玩家得分',
|
||
`source_mode` tinyint(1) NULL DEFAULT NULL COMMENT '0-不抽成 1-对大赢家进行抽成 2-对所有赢家抽成 3-对所有玩家抽成',
|
||
`target_mode` tinyint(1) NULL DEFAULT NULL COMMENT '0-抽成给系统 1-抽成给房主 2-抽成给指定玩家 3-抽成给指定玩家的代理账号 4-抽成给房主玩家的代理帐号',
|
||
`target_id` int NULL DEFAULT NULL COMMENT '目标玩家编号(获取抽水的玩家编号)',
|
||
`mode` int NOT NULL COMMENT '抽成模式 1-按得分的百分比抽成 2-按倍数的百分比抽成 3-按固定值抽成',
|
||
`type` tinyint NOT NULL COMMENT '0-大局系统抽成数据 1-小局系统抽成数据',
|
||
`commission_total` decimal(18, 4) NOT NULL COMMENT '总计分成数',
|
||
`commission_system` decimal(18, 4) NULL DEFAULT NULL COMMENT '系统(平台)分成数',
|
||
`commission_user` decimal(18, 4) NULL DEFAULT NULL COMMENT '用户(代理)分成数',
|
||
`commission_parent_user` decimal(18, 4) NULL DEFAULT NULL COMMENT '用户(代理)的上级分成数',
|
||
`commission_owner` decimal(18, 4) NULL DEFAULT NULL COMMENT '房主的分成数',
|
||
`commission_user_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '用户(代理)分成比例(百分比)(0~1)',
|
||
`commission_parent_user_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '上级用户(代理)分成比例(百分比)(0~1)',
|
||
`commission_owner_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '房主分成比例(百分比)(0~1)',
|
||
`create_time` timestamp NULL DEFAULT NULL COMMENT '时间',
|
||
`is_settle` int NULL DEFAULT 0 COMMENT '是否结算(0:否;1:是)',
|
||
`is_robot` int NULL DEFAULT 0 COMMENT '是否是机器人(0:否;1:是)',
|
||
`service_index` int UNSIGNED NULL DEFAULT NULL COMMENT '茶水费的计算序号',
|
||
`out_id` int NOT NULL COMMENT '外部id',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `uk_user_commission_202012_out_id`(`out_id` ASC) USING BTREE,
|
||
UNIQUE INDEX `pk_user_commission_202012`(`id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_service_index`(`agent_id` ASC, `channel_id` ASC, `service_index` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_user_id`(`agent_id` ASC, `channel_id` ASC, `user_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_target_id`(`agent_id` ASC, `channel_id` ASC, `target_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_target_mode_settle`(`target_mode` ASC, `is_settle` ASC, `commission_total` ASC, `create_time` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_user`(`agent_id` ASC, `channel_id` ASC, `player_id` ASC, `user_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202012_player_id`(`agent_id` ASC, `channel_id` ASC, `player_id` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 606040 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_user_commission_202401
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_user_commission_202401`;
|
||
CREATE TABLE `ct_user_commission_202401` (
|
||
`id` int NOT NULL AUTO_INCREMENT,
|
||
`agent_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '代理',
|
||
`channel_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '渠道',
|
||
`game_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '游戏',
|
||
`room_id` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '房间标识',
|
||
`player_id` int NOT NULL COMMENT '玩家id',
|
||
`user_id` int NULL DEFAULT NULL COMMENT '用户id(玩家绑定的代理)',
|
||
`parent_user_id` int NULL DEFAULT NULL COMMENT '用户id(玩家绑定的代理的上级代理)',
|
||
`room_code` int NOT NULL COMMENT '房号',
|
||
`short_number` int NULL DEFAULT NULL COMMENT '短号',
|
||
`used_card` int NOT NULL COMMENT '使用的房卡数',
|
||
`owner_id` int NOT NULL COMMENT '房主',
|
||
`room_type` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '房间类型',
|
||
`room_mode` tinyint NOT NULL COMMENT '0-普通星星场房间 1-短号星星场房间 2-系统星星房间',
|
||
`commission_type` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '分成类型编号',
|
||
`grade` decimal(18, 4) NOT NULL COMMENT '玩家得分',
|
||
`source_mode` tinyint NULL DEFAULT NULL COMMENT '0-不抽成 1-对大赢家进行抽成 2-对所有赢家抽成 3-对所有玩家抽成',
|
||
`target_mode` tinyint NULL DEFAULT NULL COMMENT '0-抽成给系统 1-抽成给房主 2-抽成给指定玩家 3-抽成给指定玩家的代理账号 4-抽成给房主玩家的代理帐号',
|
||
`target_id` int NULL DEFAULT NULL COMMENT '目标玩家编号(获取抽水的玩家编号)',
|
||
`mode` int NOT NULL COMMENT '抽成模式 1-按得分的百分比抽成 2-按倍数的百分比抽成 3-按固定值抽成',
|
||
`type` tinyint NOT NULL COMMENT '0-大局系统抽成数据 1-小局系统抽成数据',
|
||
`commission_total` decimal(18, 4) NOT NULL COMMENT '总计分成数',
|
||
`commission_system` decimal(18, 4) NULL DEFAULT NULL COMMENT '系统(平台)分成数',
|
||
`commission_user` decimal(18, 4) NULL DEFAULT NULL COMMENT '用户(代理)分成数',
|
||
`commission_parent_user` decimal(18, 4) NULL DEFAULT NULL COMMENT '用户(代理)的上级分成数',
|
||
`commission_owner` decimal(18, 4) NULL DEFAULT NULL COMMENT '房主的分成数',
|
||
`commission_user_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '用户(代理)分成比例(百分比)(0~1)',
|
||
`commission_parent_user_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '上级用户(代理)分成比例(百分比)(0~1)',
|
||
`commission_owner_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '房主分成比例(百分比)(0~1)',
|
||
`create_time` timestamp NULL DEFAULT NULL COMMENT '时间',
|
||
`is_settle` int NULL DEFAULT 0 COMMENT '是否结算(0:否;1:是)',
|
||
`is_robot` int NULL DEFAULT 0 COMMENT '是否是机器人(0:否;1:是)',
|
||
`service_index` int UNSIGNED NULL DEFAULT NULL COMMENT '茶水费的计算序号',
|
||
`out_id` int NOT NULL COMMENT '外部id',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `uk_user_commission_202012_out_id`(`out_id` ASC) USING BTREE,
|
||
UNIQUE INDEX `pk_user_commission_202012`(`id` ASC) USING BTREE
|
||
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_user_commission_202402
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_user_commission_202402`;
|
||
CREATE TABLE `ct_user_commission_202402` (
|
||
`id` int NOT NULL AUTO_INCREMENT,
|
||
`agent_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '代理',
|
||
`channel_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '渠道',
|
||
`game_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '游戏',
|
||
`room_id` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '房间标识',
|
||
`player_id` int NOT NULL COMMENT '玩家id',
|
||
`user_id` int NULL DEFAULT NULL COMMENT '用户id(玩家绑定的代理)',
|
||
`parent_user_id` int NULL DEFAULT NULL COMMENT '用户id(玩家绑定的代理的上级代理)',
|
||
`room_code` int NOT NULL COMMENT '房号',
|
||
`short_number` int NULL DEFAULT NULL COMMENT '短号',
|
||
`used_card` int NOT NULL COMMENT '使用的房卡数',
|
||
`owner_id` int NOT NULL COMMENT '房主',
|
||
`room_type` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '房间类型',
|
||
`room_mode` tinyint NOT NULL COMMENT '0-普通星星场房间 1-短号星星场房间 2-系统星星房间',
|
||
`commission_type` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '分成类型编号',
|
||
`grade` decimal(18, 4) NOT NULL COMMENT '玩家得分',
|
||
`source_mode` tinyint NULL DEFAULT NULL COMMENT '0-不抽成 1-对大赢家进行抽成 2-对所有赢家抽成 3-对所有玩家抽成',
|
||
`target_mode` tinyint NULL DEFAULT NULL COMMENT '0-抽成给系统 1-抽成给房主 2-抽成给指定玩家 3-抽成给指定玩家的代理账号 4-抽成给房主玩家的代理帐号',
|
||
`target_id` int NULL DEFAULT NULL COMMENT '目标玩家编号(获取抽水的玩家编号)',
|
||
`mode` int NOT NULL COMMENT '抽成模式 1-按得分的百分比抽成 2-按倍数的百分比抽成 3-按固定值抽成',
|
||
`type` tinyint NOT NULL COMMENT '0-大局系统抽成数据 1-小局系统抽成数据',
|
||
`commission_total` decimal(18, 4) NOT NULL COMMENT '总计分成数',
|
||
`commission_system` decimal(18, 4) NULL DEFAULT NULL COMMENT '系统(平台)分成数',
|
||
`commission_user` decimal(18, 4) NULL DEFAULT NULL COMMENT '用户(代理)分成数',
|
||
`commission_parent_user` decimal(18, 4) NULL DEFAULT NULL COMMENT '用户(代理)的上级分成数',
|
||
`commission_owner` decimal(18, 4) NULL DEFAULT NULL COMMENT '房主的分成数',
|
||
`commission_user_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '用户(代理)分成比例(百分比)(0~1)',
|
||
`commission_parent_user_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '上级用户(代理)分成比例(百分比)(0~1)',
|
||
`commission_owner_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '房主分成比例(百分比)(0~1)',
|
||
`create_time` timestamp NULL DEFAULT NULL COMMENT '时间',
|
||
`is_settle` int NULL DEFAULT 0 COMMENT '是否结算(0:否;1:是)',
|
||
`is_robot` int NULL DEFAULT 0 COMMENT '是否是机器人(0:否;1:是)',
|
||
`service_index` int UNSIGNED NULL DEFAULT NULL COMMENT '茶水费的计算序号',
|
||
`out_id` int NOT NULL COMMENT '外部id',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `uk_user_commission_202012_out_id`(`out_id` ASC) USING BTREE,
|
||
UNIQUE INDEX `pk_user_commission_202012`(`id` ASC) USING BTREE
|
||
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_user_commission_202403
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_user_commission_202403`;
|
||
CREATE TABLE `ct_user_commission_202403` (
|
||
`id` int NOT NULL AUTO_INCREMENT,
|
||
`agent_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '代理',
|
||
`channel_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '渠道',
|
||
`game_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '游戏',
|
||
`room_id` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '房间标识',
|
||
`player_id` int NOT NULL COMMENT '玩家id',
|
||
`user_id` int NULL DEFAULT NULL COMMENT '用户id(玩家绑定的代理)',
|
||
`parent_user_id` int NULL DEFAULT NULL COMMENT '用户id(玩家绑定的代理的上级代理)',
|
||
`room_code` int NOT NULL COMMENT '房号',
|
||
`short_number` int NULL DEFAULT NULL COMMENT '短号',
|
||
`used_card` int NOT NULL COMMENT '使用的房卡数',
|
||
`owner_id` int NOT NULL COMMENT '房主',
|
||
`room_type` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '房间类型',
|
||
`room_mode` tinyint NOT NULL COMMENT '0-普通星星场房间 1-短号星星场房间 2-系统星星房间',
|
||
`commission_type` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '分成类型编号',
|
||
`grade` decimal(18, 4) NOT NULL COMMENT '玩家得分',
|
||
`source_mode` tinyint NULL DEFAULT NULL COMMENT '0-不抽成 1-对大赢家进行抽成 2-对所有赢家抽成 3-对所有玩家抽成',
|
||
`target_mode` tinyint NULL DEFAULT NULL COMMENT '0-抽成给系统 1-抽成给房主 2-抽成给指定玩家 3-抽成给指定玩家的代理账号 4-抽成给房主玩家的代理帐号',
|
||
`target_id` int NULL DEFAULT NULL COMMENT '目标玩家编号(获取抽水的玩家编号)',
|
||
`mode` int NOT NULL COMMENT '抽成模式 1-按得分的百分比抽成 2-按倍数的百分比抽成 3-按固定值抽成',
|
||
`type` tinyint NOT NULL COMMENT '0-大局系统抽成数据 1-小局系统抽成数据',
|
||
`commission_total` decimal(18, 4) NOT NULL COMMENT '总计分成数',
|
||
`commission_system` decimal(18, 4) NULL DEFAULT NULL COMMENT '系统(平台)分成数',
|
||
`commission_user` decimal(18, 4) NULL DEFAULT NULL COMMENT '用户(代理)分成数',
|
||
`commission_parent_user` decimal(18, 4) NULL DEFAULT NULL COMMENT '用户(代理)的上级分成数',
|
||
`commission_owner` decimal(18, 4) NULL DEFAULT NULL COMMENT '房主的分成数',
|
||
`commission_user_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '用户(代理)分成比例(百分比)(0~1)',
|
||
`commission_parent_user_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '上级用户(代理)分成比例(百分比)(0~1)',
|
||
`commission_owner_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '房主分成比例(百分比)(0~1)',
|
||
`create_time` timestamp NULL DEFAULT NULL COMMENT '时间',
|
||
`is_settle` int NULL DEFAULT 0 COMMENT '是否结算(0:否;1:是)',
|
||
`is_robot` int NULL DEFAULT 0 COMMENT '是否是机器人(0:否;1:是)',
|
||
`service_index` int UNSIGNED NULL DEFAULT NULL COMMENT '茶水费的计算序号',
|
||
`out_id` int NOT NULL COMMENT '外部id',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `pk_user_commission_202403`(`id` ASC) USING BTREE,
|
||
UNIQUE INDEX `uk_user_commission_202403_out_id`(`out_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202403_user`(`agent_id` ASC, `channel_id` ASC, `player_id` ASC, `user_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202403_target_id`(`agent_id` ASC, `channel_id` ASC, `target_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202403_service_index`(`agent_id` ASC, `channel_id` ASC, `service_index` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202403_player_id`(`agent_id` ASC, `channel_id` ASC, `player_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202403_user_id`(`agent_id` ASC, `channel_id` ASC, `user_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202403_target_mode_settle`(`target_mode` ASC, `is_settle` ASC, `commission_total` ASC, `create_time` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 212980 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_user_commission_202404
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_user_commission_202404`;
|
||
CREATE TABLE `ct_user_commission_202404` (
|
||
`id` int NOT NULL AUTO_INCREMENT,
|
||
`agent_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '代理',
|
||
`channel_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '渠道',
|
||
`game_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '游戏',
|
||
`room_id` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '房间标识',
|
||
`player_id` int NOT NULL COMMENT '玩家id',
|
||
`user_id` int NULL DEFAULT NULL COMMENT '用户id(玩家绑定的代理)',
|
||
`parent_user_id` int NULL DEFAULT NULL COMMENT '用户id(玩家绑定的代理的上级代理)',
|
||
`room_code` int NOT NULL COMMENT '房号',
|
||
`short_number` int NULL DEFAULT NULL COMMENT '短号',
|
||
`used_card` int NOT NULL COMMENT '使用的房卡数',
|
||
`owner_id` int NOT NULL COMMENT '房主',
|
||
`room_type` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '房间类型',
|
||
`room_mode` tinyint NOT NULL COMMENT '0-普通星星场房间 1-短号星星场房间 2-系统星星房间',
|
||
`commission_type` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '分成类型编号',
|
||
`grade` decimal(18, 4) NOT NULL COMMENT '玩家得分',
|
||
`source_mode` tinyint NULL DEFAULT NULL COMMENT '0-不抽成 1-对大赢家进行抽成 2-对所有赢家抽成 3-对所有玩家抽成',
|
||
`target_mode` tinyint NULL DEFAULT NULL COMMENT '0-抽成给系统 1-抽成给房主 2-抽成给指定玩家 3-抽成给指定玩家的代理账号 4-抽成给房主玩家的代理帐号',
|
||
`target_id` int NULL DEFAULT NULL COMMENT '目标玩家编号(获取抽水的玩家编号)',
|
||
`mode` int NOT NULL COMMENT '抽成模式 1-按得分的百分比抽成 2-按倍数的百分比抽成 3-按固定值抽成',
|
||
`type` tinyint NOT NULL COMMENT '0-大局系统抽成数据 1-小局系统抽成数据',
|
||
`commission_total` decimal(18, 4) NOT NULL COMMENT '总计分成数',
|
||
`commission_system` decimal(18, 4) NULL DEFAULT NULL COMMENT '系统(平台)分成数',
|
||
`commission_user` decimal(18, 4) NULL DEFAULT NULL COMMENT '用户(代理)分成数',
|
||
`commission_parent_user` decimal(18, 4) NULL DEFAULT NULL COMMENT '用户(代理)的上级分成数',
|
||
`commission_owner` decimal(18, 4) NULL DEFAULT NULL COMMENT '房主的分成数',
|
||
`commission_user_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '用户(代理)分成比例(百分比)(0~1)',
|
||
`commission_parent_user_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '上级用户(代理)分成比例(百分比)(0~1)',
|
||
`commission_owner_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '房主分成比例(百分比)(0~1)',
|
||
`create_time` timestamp NULL DEFAULT NULL COMMENT '时间',
|
||
`is_settle` int NULL DEFAULT 0 COMMENT '是否结算(0:否;1:是)',
|
||
`is_robot` int NULL DEFAULT 0 COMMENT '是否是机器人(0:否;1:是)',
|
||
`service_index` int UNSIGNED NULL DEFAULT NULL COMMENT '茶水费的计算序号',
|
||
`out_id` int NOT NULL COMMENT '外部id',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `pk_user_commission_202404`(`id` ASC) USING BTREE,
|
||
UNIQUE INDEX `uk_user_commission_202404_out_id`(`out_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202404_player_id`(`agent_id` ASC, `channel_id` ASC, `player_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202404_user_id`(`agent_id` ASC, `channel_id` ASC, `user_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202404_service_index`(`agent_id` ASC, `channel_id` ASC, `service_index` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202404_target_mode_settle`(`target_mode` ASC, `is_settle` ASC, `commission_total` ASC, `create_time` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202404_target_id`(`agent_id` ASC, `channel_id` ASC, `target_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202404_user`(`agent_id` ASC, `channel_id` ASC, `player_id` ASC, `user_id` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 118777 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_user_commission_202405
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_user_commission_202405`;
|
||
CREATE TABLE `ct_user_commission_202405` (
|
||
`id` int NOT NULL AUTO_INCREMENT,
|
||
`agent_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '代理',
|
||
`channel_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '渠道',
|
||
`game_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '游戏',
|
||
`room_id` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '房间标识',
|
||
`player_id` int NOT NULL COMMENT '玩家id',
|
||
`user_id` int NULL DEFAULT NULL COMMENT '用户id(玩家绑定的代理)',
|
||
`parent_user_id` int NULL DEFAULT NULL COMMENT '用户id(玩家绑定的代理的上级代理)',
|
||
`room_code` int NOT NULL COMMENT '房号',
|
||
`short_number` int NULL DEFAULT NULL COMMENT '短号',
|
||
`used_card` int NOT NULL COMMENT '使用的房卡数',
|
||
`owner_id` int NOT NULL COMMENT '房主',
|
||
`room_type` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '房间类型',
|
||
`room_mode` tinyint(1) NOT NULL COMMENT '0-普通星星场房间 1-短号星星场房间 2-系统星星房间',
|
||
`commission_type` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '分成类型编号',
|
||
`grade` decimal(18, 4) NOT NULL COMMENT '玩家得分',
|
||
`source_mode` tinyint(1) NULL DEFAULT NULL COMMENT '0-不抽成 1-对大赢家进行抽成 2-对所有赢家抽成 3-对所有玩家抽成',
|
||
`target_mode` tinyint(1) NULL DEFAULT NULL COMMENT '0-抽成给系统 1-抽成给房主 2-抽成给指定玩家 3-抽成给指定玩家的代理账号 4-抽成给房主玩家的代理帐号',
|
||
`target_id` int NULL DEFAULT NULL COMMENT '目标玩家编号(获取抽水的玩家编号)',
|
||
`mode` int NOT NULL COMMENT '抽成模式 1-按得分的百分比抽成 2-按倍数的百分比抽成 3-按固定值抽成',
|
||
`type` tinyint NOT NULL COMMENT '0-大局系统抽成数据 1-小局系统抽成数据',
|
||
`commission_total` decimal(18, 4) NOT NULL COMMENT '总计分成数',
|
||
`commission_system` decimal(18, 4) NULL DEFAULT NULL COMMENT '系统(平台)分成数',
|
||
`commission_user` decimal(18, 4) NULL DEFAULT NULL COMMENT '用户(代理)分成数',
|
||
`commission_parent_user` decimal(18, 4) NULL DEFAULT NULL COMMENT '用户(代理)的上级分成数',
|
||
`commission_owner` decimal(18, 4) NULL DEFAULT NULL COMMENT '房主的分成数',
|
||
`commission_user_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '用户(代理)分成比例(百分比)(0~1)',
|
||
`commission_parent_user_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '上级用户(代理)分成比例(百分比)(0~1)',
|
||
`commission_owner_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '房主分成比例(百分比)(0~1)',
|
||
`create_time` timestamp NULL DEFAULT NULL COMMENT '时间',
|
||
`is_settle` int NULL DEFAULT 0 COMMENT '是否结算(0:否;1:是)',
|
||
`is_robot` int NULL DEFAULT 0 COMMENT '是否是机器人(0:否;1:是)',
|
||
`service_index` int UNSIGNED NULL DEFAULT NULL COMMENT '茶水费的计算序号',
|
||
`out_id` int NOT NULL COMMENT '外部id',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `pk_user_commission_202405`(`id` ASC) USING BTREE,
|
||
UNIQUE INDEX `uk_user_commission_202405_out_id`(`out_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202405_target_mode_settle`(`target_mode` ASC, `is_settle` ASC, `commission_total` ASC, `create_time` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202405_user`(`agent_id` ASC, `channel_id` ASC, `player_id` ASC, `user_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202405_target_id`(`agent_id` ASC, `channel_id` ASC, `target_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202405_user_id`(`agent_id` ASC, `channel_id` ASC, `user_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202405_player_id`(`agent_id` ASC, `channel_id` ASC, `player_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202405_service_index`(`agent_id` ASC, `channel_id` ASC, `service_index` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 606040 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_user_commission_202406
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_user_commission_202406`;
|
||
CREATE TABLE `ct_user_commission_202406` (
|
||
`id` int NOT NULL AUTO_INCREMENT,
|
||
`agent_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '代理',
|
||
`channel_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '渠道',
|
||
`game_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '游戏',
|
||
`room_id` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '房间标识',
|
||
`player_id` int NOT NULL COMMENT '玩家id',
|
||
`user_id` int NULL DEFAULT NULL COMMENT '用户id(玩家绑定的代理)',
|
||
`parent_user_id` int NULL DEFAULT NULL COMMENT '用户id(玩家绑定的代理的上级代理)',
|
||
`room_code` int NOT NULL COMMENT '房号',
|
||
`short_number` int NULL DEFAULT NULL COMMENT '短号',
|
||
`used_card` int NOT NULL COMMENT '使用的房卡数',
|
||
`owner_id` int NOT NULL COMMENT '房主',
|
||
`room_type` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '房间类型',
|
||
`room_mode` tinyint(1) NOT NULL COMMENT '0-普通星星场房间 1-短号星星场房间 2-系统星星房间',
|
||
`commission_type` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '分成类型编号',
|
||
`grade` decimal(18, 4) NOT NULL COMMENT '玩家得分',
|
||
`source_mode` tinyint(1) NULL DEFAULT NULL COMMENT '0-不抽成 1-对大赢家进行抽成 2-对所有赢家抽成 3-对所有玩家抽成',
|
||
`target_mode` tinyint(1) NULL DEFAULT NULL COMMENT '0-抽成给系统 1-抽成给房主 2-抽成给指定玩家 3-抽成给指定玩家的代理账号 4-抽成给房主玩家的代理帐号',
|
||
`target_id` int NULL DEFAULT NULL COMMENT '目标玩家编号(获取抽水的玩家编号)',
|
||
`mode` int NOT NULL COMMENT '抽成模式 1-按得分的百分比抽成 2-按倍数的百分比抽成 3-按固定值抽成',
|
||
`type` tinyint NOT NULL COMMENT '0-大局系统抽成数据 1-小局系统抽成数据',
|
||
`commission_total` decimal(18, 4) NOT NULL COMMENT '总计分成数',
|
||
`commission_system` decimal(18, 4) NULL DEFAULT NULL COMMENT '系统(平台)分成数',
|
||
`commission_user` decimal(18, 4) NULL DEFAULT NULL COMMENT '用户(代理)分成数',
|
||
`commission_parent_user` decimal(18, 4) NULL DEFAULT NULL COMMENT '用户(代理)的上级分成数',
|
||
`commission_owner` decimal(18, 4) NULL DEFAULT NULL COMMENT '房主的分成数',
|
||
`commission_user_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '用户(代理)分成比例(百分比)(0~1)',
|
||
`commission_parent_user_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '上级用户(代理)分成比例(百分比)(0~1)',
|
||
`commission_owner_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '房主分成比例(百分比)(0~1)',
|
||
`create_time` timestamp NULL DEFAULT NULL COMMENT '时间',
|
||
`is_settle` int NULL DEFAULT 0 COMMENT '是否结算(0:否;1:是)',
|
||
`is_robot` int NULL DEFAULT 0 COMMENT '是否是机器人(0:否;1:是)',
|
||
`service_index` int UNSIGNED NULL DEFAULT NULL COMMENT '茶水费的计算序号',
|
||
`out_id` int NOT NULL COMMENT '外部id',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `pk_user_commission_202406`(`id` ASC) USING BTREE,
|
||
UNIQUE INDEX `uk_user_commission_202406_out_id`(`out_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202406_target_mode_settle`(`target_mode` ASC, `is_settle` ASC, `commission_total` ASC, `create_time` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202406_target_id`(`agent_id` ASC, `channel_id` ASC, `target_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202406_user`(`agent_id` ASC, `channel_id` ASC, `player_id` ASC, `user_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202406_service_index`(`agent_id` ASC, `channel_id` ASC, `service_index` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202406_player_id`(`agent_id` ASC, `channel_id` ASC, `player_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202406_user_id`(`agent_id` ASC, `channel_id` ASC, `user_id` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 606040 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_user_commission_202407
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_user_commission_202407`;
|
||
CREATE TABLE `ct_user_commission_202407` (
|
||
`id` int NOT NULL AUTO_INCREMENT,
|
||
`agent_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '代理',
|
||
`channel_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '渠道',
|
||
`game_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '游戏',
|
||
`room_id` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '房间标识',
|
||
`player_id` int NOT NULL COMMENT '玩家id',
|
||
`user_id` int NULL DEFAULT NULL COMMENT '用户id(玩家绑定的代理)',
|
||
`parent_user_id` int NULL DEFAULT NULL COMMENT '用户id(玩家绑定的代理的上级代理)',
|
||
`room_code` int NOT NULL COMMENT '房号',
|
||
`short_number` int NULL DEFAULT NULL COMMENT '短号',
|
||
`used_card` int NOT NULL COMMENT '使用的房卡数',
|
||
`owner_id` int NOT NULL COMMENT '房主',
|
||
`room_type` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '房间类型',
|
||
`room_mode` tinyint(1) NOT NULL COMMENT '0-普通星星场房间 1-短号星星场房间 2-系统星星房间',
|
||
`commission_type` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '分成类型编号',
|
||
`grade` decimal(18, 4) NOT NULL COMMENT '玩家得分',
|
||
`source_mode` tinyint(1) NULL DEFAULT NULL COMMENT '0-不抽成 1-对大赢家进行抽成 2-对所有赢家抽成 3-对所有玩家抽成',
|
||
`target_mode` tinyint(1) NULL DEFAULT NULL COMMENT '0-抽成给系统 1-抽成给房主 2-抽成给指定玩家 3-抽成给指定玩家的代理账号 4-抽成给房主玩家的代理帐号',
|
||
`target_id` int NULL DEFAULT NULL COMMENT '目标玩家编号(获取抽水的玩家编号)',
|
||
`mode` int NOT NULL COMMENT '抽成模式 1-按得分的百分比抽成 2-按倍数的百分比抽成 3-按固定值抽成',
|
||
`type` tinyint NOT NULL COMMENT '0-大局系统抽成数据 1-小局系统抽成数据',
|
||
`commission_total` decimal(18, 4) NOT NULL COMMENT '总计分成数',
|
||
`commission_system` decimal(18, 4) NULL DEFAULT NULL COMMENT '系统(平台)分成数',
|
||
`commission_user` decimal(18, 4) NULL DEFAULT NULL COMMENT '用户(代理)分成数',
|
||
`commission_parent_user` decimal(18, 4) NULL DEFAULT NULL COMMENT '用户(代理)的上级分成数',
|
||
`commission_owner` decimal(18, 4) NULL DEFAULT NULL COMMENT '房主的分成数',
|
||
`commission_user_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '用户(代理)分成比例(百分比)(0~1)',
|
||
`commission_parent_user_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '上级用户(代理)分成比例(百分比)(0~1)',
|
||
`commission_owner_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '房主分成比例(百分比)(0~1)',
|
||
`create_time` timestamp NULL DEFAULT NULL COMMENT '时间',
|
||
`is_settle` int NULL DEFAULT 0 COMMENT '是否结算(0:否;1:是)',
|
||
`is_robot` int NULL DEFAULT 0 COMMENT '是否是机器人(0:否;1:是)',
|
||
`service_index` int UNSIGNED NULL DEFAULT NULL COMMENT '茶水费的计算序号',
|
||
`out_id` int NOT NULL COMMENT '外部id',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `uk_user_commission_202407_out_id`(`out_id` ASC) USING BTREE,
|
||
UNIQUE INDEX `pk_user_commission_202407`(`id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202407_player_id`(`agent_id` ASC, `channel_id` ASC, `player_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202407_service_index`(`agent_id` ASC, `channel_id` ASC, `service_index` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202407_user_id`(`agent_id` ASC, `channel_id` ASC, `user_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202407_user`(`agent_id` ASC, `channel_id` ASC, `player_id` ASC, `user_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202407_target_mode_settle`(`target_mode` ASC, `is_settle` ASC, `commission_total` ASC, `create_time` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202407_target_id`(`agent_id` ASC, `channel_id` ASC, `target_id` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 606040 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_user_commission_202408
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_user_commission_202408`;
|
||
CREATE TABLE `ct_user_commission_202408` (
|
||
`id` int NOT NULL AUTO_INCREMENT,
|
||
`agent_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '代理',
|
||
`channel_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '渠道',
|
||
`game_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '游戏',
|
||
`room_id` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '房间标识',
|
||
`player_id` int NOT NULL COMMENT '玩家id',
|
||
`user_id` int NULL DEFAULT NULL COMMENT '用户id(玩家绑定的代理)',
|
||
`parent_user_id` int NULL DEFAULT NULL COMMENT '用户id(玩家绑定的代理的上级代理)',
|
||
`room_code` int NOT NULL COMMENT '房号',
|
||
`short_number` int NULL DEFAULT NULL COMMENT '短号',
|
||
`used_card` int NOT NULL COMMENT '使用的房卡数',
|
||
`owner_id` int NOT NULL COMMENT '房主',
|
||
`room_type` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '房间类型',
|
||
`room_mode` tinyint(1) NOT NULL COMMENT '0-普通星星场房间 1-短号星星场房间 2-系统星星房间',
|
||
`commission_type` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '分成类型编号',
|
||
`grade` decimal(18, 4) NOT NULL COMMENT '玩家得分',
|
||
`source_mode` tinyint(1) NULL DEFAULT NULL COMMENT '0-不抽成 1-对大赢家进行抽成 2-对所有赢家抽成 3-对所有玩家抽成',
|
||
`target_mode` tinyint(1) NULL DEFAULT NULL COMMENT '0-抽成给系统 1-抽成给房主 2-抽成给指定玩家 3-抽成给指定玩家的代理账号 4-抽成给房主玩家的代理帐号',
|
||
`target_id` int NULL DEFAULT NULL COMMENT '目标玩家编号(获取抽水的玩家编号)',
|
||
`mode` int NOT NULL COMMENT '抽成模式 1-按得分的百分比抽成 2-按倍数的百分比抽成 3-按固定值抽成',
|
||
`type` tinyint NOT NULL COMMENT '0-大局系统抽成数据 1-小局系统抽成数据',
|
||
`commission_total` decimal(18, 4) NOT NULL COMMENT '总计分成数',
|
||
`commission_system` decimal(18, 4) NULL DEFAULT NULL COMMENT '系统(平台)分成数',
|
||
`commission_user` decimal(18, 4) NULL DEFAULT NULL COMMENT '用户(代理)分成数',
|
||
`commission_parent_user` decimal(18, 4) NULL DEFAULT NULL COMMENT '用户(代理)的上级分成数',
|
||
`commission_owner` decimal(18, 4) NULL DEFAULT NULL COMMENT '房主的分成数',
|
||
`commission_user_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '用户(代理)分成比例(百分比)(0~1)',
|
||
`commission_parent_user_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '上级用户(代理)分成比例(百分比)(0~1)',
|
||
`commission_owner_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '房主分成比例(百分比)(0~1)',
|
||
`create_time` timestamp NULL DEFAULT NULL COMMENT '时间',
|
||
`is_settle` int NULL DEFAULT 0 COMMENT '是否结算(0:否;1:是)',
|
||
`is_robot` int NULL DEFAULT 0 COMMENT '是否是机器人(0:否;1:是)',
|
||
`service_index` int UNSIGNED NULL DEFAULT NULL COMMENT '茶水费的计算序号',
|
||
`out_id` int NOT NULL COMMENT '外部id',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `pk_user_commission_202408`(`id` ASC) USING BTREE,
|
||
UNIQUE INDEX `uk_user_commission_202408_out_id`(`out_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202408_service_index`(`agent_id` ASC, `channel_id` ASC, `service_index` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202408_target_id`(`agent_id` ASC, `channel_id` ASC, `target_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202408_user_id`(`agent_id` ASC, `channel_id` ASC, `user_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202408_target_mode_settle`(`target_mode` ASC, `is_settle` ASC, `commission_total` ASC, `create_time` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202408_player_id`(`agent_id` ASC, `channel_id` ASC, `player_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202408_user`(`agent_id` ASC, `channel_id` ASC, `player_id` ASC, `user_id` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 606040 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_user_commission_202409
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_user_commission_202409`;
|
||
CREATE TABLE `ct_user_commission_202409` (
|
||
`id` int NOT NULL AUTO_INCREMENT,
|
||
`agent_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '代理',
|
||
`channel_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '渠道',
|
||
`game_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '游戏',
|
||
`room_id` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '房间标识',
|
||
`player_id` int NOT NULL COMMENT '玩家id',
|
||
`user_id` int NULL DEFAULT NULL COMMENT '用户id(玩家绑定的代理)',
|
||
`parent_user_id` int NULL DEFAULT NULL COMMENT '用户id(玩家绑定的代理的上级代理)',
|
||
`room_code` int NOT NULL COMMENT '房号',
|
||
`short_number` int NULL DEFAULT NULL COMMENT '短号',
|
||
`used_card` int NOT NULL COMMENT '使用的房卡数',
|
||
`owner_id` int NOT NULL COMMENT '房主',
|
||
`room_type` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '房间类型',
|
||
`room_mode` tinyint(1) NOT NULL COMMENT '0-普通星星场房间 1-短号星星场房间 2-系统星星房间',
|
||
`commission_type` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '分成类型编号',
|
||
`grade` decimal(18, 4) NOT NULL COMMENT '玩家得分',
|
||
`source_mode` tinyint(1) NULL DEFAULT NULL COMMENT '0-不抽成 1-对大赢家进行抽成 2-对所有赢家抽成 3-对所有玩家抽成',
|
||
`target_mode` tinyint(1) NULL DEFAULT NULL COMMENT '0-抽成给系统 1-抽成给房主 2-抽成给指定玩家 3-抽成给指定玩家的代理账号 4-抽成给房主玩家的代理帐号',
|
||
`target_id` int NULL DEFAULT NULL COMMENT '目标玩家编号(获取抽水的玩家编号)',
|
||
`mode` int NOT NULL COMMENT '抽成模式 1-按得分的百分比抽成 2-按倍数的百分比抽成 3-按固定值抽成',
|
||
`type` tinyint NOT NULL COMMENT '0-大局系统抽成数据 1-小局系统抽成数据',
|
||
`commission_total` decimal(18, 4) NOT NULL COMMENT '总计分成数',
|
||
`commission_system` decimal(18, 4) NULL DEFAULT NULL COMMENT '系统(平台)分成数',
|
||
`commission_user` decimal(18, 4) NULL DEFAULT NULL COMMENT '用户(代理)分成数',
|
||
`commission_parent_user` decimal(18, 4) NULL DEFAULT NULL COMMENT '用户(代理)的上级分成数',
|
||
`commission_owner` decimal(18, 4) NULL DEFAULT NULL COMMENT '房主的分成数',
|
||
`commission_user_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '用户(代理)分成比例(百分比)(0~1)',
|
||
`commission_parent_user_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '上级用户(代理)分成比例(百分比)(0~1)',
|
||
`commission_owner_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '房主分成比例(百分比)(0~1)',
|
||
`create_time` timestamp NULL DEFAULT NULL COMMENT '时间',
|
||
`is_settle` int NULL DEFAULT 0 COMMENT '是否结算(0:否;1:是)',
|
||
`is_robot` int NULL DEFAULT 0 COMMENT '是否是机器人(0:否;1:是)',
|
||
`service_index` int UNSIGNED NULL DEFAULT NULL COMMENT '茶水费的计算序号',
|
||
`out_id` int NOT NULL COMMENT '外部id',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `uk_user_commission_202409_out_id`(`out_id` ASC) USING BTREE,
|
||
UNIQUE INDEX `pk_user_commission_202409`(`id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202409_target_id`(`agent_id` ASC, `channel_id` ASC, `target_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202409_player_id`(`agent_id` ASC, `channel_id` ASC, `player_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202409_service_index`(`agent_id` ASC, `channel_id` ASC, `service_index` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202409_target_mode_settle`(`target_mode` ASC, `is_settle` ASC, `commission_total` ASC, `create_time` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202409_user`(`agent_id` ASC, `channel_id` ASC, `player_id` ASC, `user_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202409_user_id`(`agent_id` ASC, `channel_id` ASC, `user_id` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 606040 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_user_commission_202410
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_user_commission_202410`;
|
||
CREATE TABLE `ct_user_commission_202410` (
|
||
`id` int NOT NULL AUTO_INCREMENT,
|
||
`agent_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '代理',
|
||
`channel_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '渠道',
|
||
`game_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '游戏',
|
||
`room_id` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '房间标识',
|
||
`player_id` int NOT NULL COMMENT '玩家id',
|
||
`user_id` int NULL DEFAULT NULL COMMENT '用户id(玩家绑定的代理)',
|
||
`parent_user_id` int NULL DEFAULT NULL COMMENT '用户id(玩家绑定的代理的上级代理)',
|
||
`room_code` int NOT NULL COMMENT '房号',
|
||
`short_number` int NULL DEFAULT NULL COMMENT '短号',
|
||
`used_card` int NOT NULL COMMENT '使用的房卡数',
|
||
`owner_id` int NOT NULL COMMENT '房主',
|
||
`room_type` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '房间类型',
|
||
`room_mode` tinyint(1) NOT NULL COMMENT '0-普通星星场房间 1-短号星星场房间 2-系统星星房间',
|
||
`commission_type` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '分成类型编号',
|
||
`grade` decimal(18, 4) NOT NULL COMMENT '玩家得分',
|
||
`source_mode` tinyint(1) NULL DEFAULT NULL COMMENT '0-不抽成 1-对大赢家进行抽成 2-对所有赢家抽成 3-对所有玩家抽成',
|
||
`target_mode` tinyint(1) NULL DEFAULT NULL COMMENT '0-抽成给系统 1-抽成给房主 2-抽成给指定玩家 3-抽成给指定玩家的代理账号 4-抽成给房主玩家的代理帐号',
|
||
`target_id` int NULL DEFAULT NULL COMMENT '目标玩家编号(获取抽水的玩家编号)',
|
||
`mode` int NOT NULL COMMENT '抽成模式 1-按得分的百分比抽成 2-按倍数的百分比抽成 3-按固定值抽成',
|
||
`type` tinyint NOT NULL COMMENT '0-大局系统抽成数据 1-小局系统抽成数据',
|
||
`commission_total` decimal(18, 4) NOT NULL COMMENT '总计分成数',
|
||
`commission_system` decimal(18, 4) NULL DEFAULT NULL COMMENT '系统(平台)分成数',
|
||
`commission_user` decimal(18, 4) NULL DEFAULT NULL COMMENT '用户(代理)分成数',
|
||
`commission_parent_user` decimal(18, 4) NULL DEFAULT NULL COMMENT '用户(代理)的上级分成数',
|
||
`commission_owner` decimal(18, 4) NULL DEFAULT NULL COMMENT '房主的分成数',
|
||
`commission_user_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '用户(代理)分成比例(百分比)(0~1)',
|
||
`commission_parent_user_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '上级用户(代理)分成比例(百分比)(0~1)',
|
||
`commission_owner_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '房主分成比例(百分比)(0~1)',
|
||
`create_time` timestamp NULL DEFAULT NULL COMMENT '时间',
|
||
`is_settle` int NULL DEFAULT 0 COMMENT '是否结算(0:否;1:是)',
|
||
`is_robot` int NULL DEFAULT 0 COMMENT '是否是机器人(0:否;1:是)',
|
||
`service_index` int UNSIGNED NULL DEFAULT NULL COMMENT '茶水费的计算序号',
|
||
`out_id` int NOT NULL COMMENT '外部id',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `uk_user_commission_202410_out_id`(`out_id` ASC) USING BTREE,
|
||
UNIQUE INDEX `pk_user_commission_202410`(`id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202410_service_index`(`agent_id` ASC, `channel_id` ASC, `service_index` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202410_user`(`agent_id` ASC, `channel_id` ASC, `player_id` ASC, `user_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202410_user_id`(`agent_id` ASC, `channel_id` ASC, `user_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202410_target_mode_settle`(`target_mode` ASC, `is_settle` ASC, `commission_total` ASC, `create_time` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202410_target_id`(`agent_id` ASC, `channel_id` ASC, `target_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202410_player_id`(`agent_id` ASC, `channel_id` ASC, `player_id` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 606040 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_user_commission_202411
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_user_commission_202411`;
|
||
CREATE TABLE `ct_user_commission_202411` (
|
||
`id` int NOT NULL AUTO_INCREMENT,
|
||
`agent_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '代理',
|
||
`channel_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '渠道',
|
||
`game_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '游戏',
|
||
`room_id` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '房间标识',
|
||
`player_id` int NOT NULL COMMENT '玩家id',
|
||
`user_id` int NULL DEFAULT NULL COMMENT '用户id(玩家绑定的代理)',
|
||
`parent_user_id` int NULL DEFAULT NULL COMMENT '用户id(玩家绑定的代理的上级代理)',
|
||
`room_code` int NOT NULL COMMENT '房号',
|
||
`short_number` int NULL DEFAULT NULL COMMENT '短号',
|
||
`used_card` int NOT NULL COMMENT '使用的房卡数',
|
||
`owner_id` int NOT NULL COMMENT '房主',
|
||
`room_type` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '房间类型',
|
||
`room_mode` tinyint(1) NOT NULL COMMENT '0-普通星星场房间 1-短号星星场房间 2-系统星星房间',
|
||
`commission_type` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '分成类型编号',
|
||
`grade` decimal(18, 4) NOT NULL COMMENT '玩家得分',
|
||
`source_mode` tinyint(1) NULL DEFAULT NULL COMMENT '0-不抽成 1-对大赢家进行抽成 2-对所有赢家抽成 3-对所有玩家抽成',
|
||
`target_mode` tinyint(1) NULL DEFAULT NULL COMMENT '0-抽成给系统 1-抽成给房主 2-抽成给指定玩家 3-抽成给指定玩家的代理账号 4-抽成给房主玩家的代理帐号',
|
||
`target_id` int NULL DEFAULT NULL COMMENT '目标玩家编号(获取抽水的玩家编号)',
|
||
`mode` int NOT NULL COMMENT '抽成模式 1-按得分的百分比抽成 2-按倍数的百分比抽成 3-按固定值抽成',
|
||
`type` tinyint NOT NULL COMMENT '0-大局系统抽成数据 1-小局系统抽成数据',
|
||
`commission_total` decimal(18, 4) NOT NULL COMMENT '总计分成数',
|
||
`commission_system` decimal(18, 4) NULL DEFAULT NULL COMMENT '系统(平台)分成数',
|
||
`commission_user` decimal(18, 4) NULL DEFAULT NULL COMMENT '用户(代理)分成数',
|
||
`commission_parent_user` decimal(18, 4) NULL DEFAULT NULL COMMENT '用户(代理)的上级分成数',
|
||
`commission_owner` decimal(18, 4) NULL DEFAULT NULL COMMENT '房主的分成数',
|
||
`commission_user_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '用户(代理)分成比例(百分比)(0~1)',
|
||
`commission_parent_user_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '上级用户(代理)分成比例(百分比)(0~1)',
|
||
`commission_owner_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '房主分成比例(百分比)(0~1)',
|
||
`create_time` timestamp NULL DEFAULT NULL COMMENT '时间',
|
||
`is_settle` int NULL DEFAULT 0 COMMENT '是否结算(0:否;1:是)',
|
||
`is_robot` int NULL DEFAULT 0 COMMENT '是否是机器人(0:否;1:是)',
|
||
`service_index` int UNSIGNED NULL DEFAULT NULL COMMENT '茶水费的计算序号',
|
||
`out_id` int NOT NULL COMMENT '外部id',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `uk_user_commission_202411_out_id`(`out_id` ASC) USING BTREE,
|
||
UNIQUE INDEX `pk_user_commission_202411`(`id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202411_player_id`(`agent_id` ASC, `channel_id` ASC, `player_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202411_target_mode_settle`(`target_mode` ASC, `is_settle` ASC, `commission_total` ASC, `create_time` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202411_user_id`(`agent_id` ASC, `channel_id` ASC, `user_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202411_user`(`agent_id` ASC, `channel_id` ASC, `player_id` ASC, `user_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202411_target_id`(`agent_id` ASC, `channel_id` ASC, `target_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202411_service_index`(`agent_id` ASC, `channel_id` ASC, `service_index` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 606040 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_user_commission_202412
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_user_commission_202412`;
|
||
CREATE TABLE `ct_user_commission_202412` (
|
||
`id` int NOT NULL AUTO_INCREMENT,
|
||
`agent_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '代理',
|
||
`channel_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '渠道',
|
||
`game_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '游戏',
|
||
`room_id` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '房间标识',
|
||
`player_id` int NOT NULL COMMENT '玩家id',
|
||
`user_id` int NULL DEFAULT NULL COMMENT '用户id(玩家绑定的代理)',
|
||
`parent_user_id` int NULL DEFAULT NULL COMMENT '用户id(玩家绑定的代理的上级代理)',
|
||
`room_code` int NOT NULL COMMENT '房号',
|
||
`short_number` int NULL DEFAULT NULL COMMENT '短号',
|
||
`used_card` int NOT NULL COMMENT '使用的房卡数',
|
||
`owner_id` int NOT NULL COMMENT '房主',
|
||
`room_type` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '房间类型',
|
||
`room_mode` tinyint(1) NOT NULL COMMENT '0-普通星星场房间 1-短号星星场房间 2-系统星星房间',
|
||
`commission_type` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '分成类型编号',
|
||
`grade` decimal(18, 4) NOT NULL COMMENT '玩家得分',
|
||
`source_mode` tinyint(1) NULL DEFAULT NULL COMMENT '0-不抽成 1-对大赢家进行抽成 2-对所有赢家抽成 3-对所有玩家抽成',
|
||
`target_mode` tinyint(1) NULL DEFAULT NULL COMMENT '0-抽成给系统 1-抽成给房主 2-抽成给指定玩家 3-抽成给指定玩家的代理账号 4-抽成给房主玩家的代理帐号',
|
||
`target_id` int NULL DEFAULT NULL COMMENT '目标玩家编号(获取抽水的玩家编号)',
|
||
`mode` int NOT NULL COMMENT '抽成模式 1-按得分的百分比抽成 2-按倍数的百分比抽成 3-按固定值抽成',
|
||
`type` tinyint NOT NULL COMMENT '0-大局系统抽成数据 1-小局系统抽成数据',
|
||
`commission_total` decimal(18, 4) NOT NULL COMMENT '总计分成数',
|
||
`commission_system` decimal(18, 4) NULL DEFAULT NULL COMMENT '系统(平台)分成数',
|
||
`commission_user` decimal(18, 4) NULL DEFAULT NULL COMMENT '用户(代理)分成数',
|
||
`commission_parent_user` decimal(18, 4) NULL DEFAULT NULL COMMENT '用户(代理)的上级分成数',
|
||
`commission_owner` decimal(18, 4) NULL DEFAULT NULL COMMENT '房主的分成数',
|
||
`commission_user_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '用户(代理)分成比例(百分比)(0~1)',
|
||
`commission_parent_user_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '上级用户(代理)分成比例(百分比)(0~1)',
|
||
`commission_owner_rate` decimal(10, 4) NULL DEFAULT 0.0000 COMMENT '房主分成比例(百分比)(0~1)',
|
||
`create_time` timestamp NULL DEFAULT NULL COMMENT '时间',
|
||
`is_settle` int NULL DEFAULT 0 COMMENT '是否结算(0:否;1:是)',
|
||
`is_robot` int NULL DEFAULT 0 COMMENT '是否是机器人(0:否;1:是)',
|
||
`service_index` int UNSIGNED NULL DEFAULT NULL COMMENT '茶水费的计算序号',
|
||
`out_id` int NOT NULL COMMENT '外部id',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `uk_user_commission_202412_out_id`(`out_id` ASC) USING BTREE,
|
||
UNIQUE INDEX `pk_user_commission_202412`(`id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202412_user`(`agent_id` ASC, `channel_id` ASC, `player_id` ASC, `user_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202412_player_id`(`agent_id` ASC, `channel_id` ASC, `player_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202412_service_index`(`agent_id` ASC, `channel_id` ASC, `service_index` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202412_target_mode_settle`(`target_mode` ASC, `is_settle` ASC, `commission_total` ASC, `create_time` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202412_target_id`(`agent_id` ASC, `channel_id` ASC, `target_id` ASC) USING BTREE,
|
||
INDEX `nk_user_commission_202412_user_id`(`agent_id` ASC, `channel_id` ASC, `user_id` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 606040 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_user_info
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_user_info`;
|
||
CREATE TABLE `ct_user_info` (
|
||
`id` int UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '用户号',
|
||
`name` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '名称(昵称)',
|
||
`phone` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '电话(手机号)',
|
||
`avatar` varchar(400) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '用户头像',
|
||
`loginname` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '登录账户',
|
||
`loginpass` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '登录密码',
|
||
`loginsalt` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '加密盐',
|
||
`create_time` int NULL DEFAULT NULL COMMENT '创建时间',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `pk_user_info`(`id` ASC) USING BTREE,
|
||
UNIQUE INDEX `uk_user_info`(`phone` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 472 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_user_process_log
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_user_process_log`;
|
||
CREATE TABLE `ct_user_process_log` (
|
||
`id` int NOT NULL AUTO_INCREMENT,
|
||
`from_agent` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '来源代理',
|
||
`from_channel` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '来源渠道',
|
||
`from_user` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '来源用户',
|
||
`to_agent` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '目标代理',
|
||
`to_channel` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '目标渠道',
|
||
`to_user` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '目标用户',
|
||
`oper_type` int NULL DEFAULT NULL COMMENT '操作类型(\r\n1:购买房卡;\r\n2:代理转卡;\r\n3:索要房卡;\r\n4:索要星星;\r\n11:购买星星;\r\n12:代理转星星;\r\n13:索要星星;\r\n21:成为代理;\r\n31:封禁代理; \r\n32:解封代理;\r\n33:封禁玩家;\r\n34:解封玩家;\r\n41:解除绑定我的玩家;\r\n42:解绑绑定的代理;\r\n101:绑定代理;\r\n102:玩家加入俱乐部;\r\n110:代理设置短号;\r\n111:添加或删除白名单;\r\n112:代理绑定关系迁移;\r\n201:设置渠道分成比例\r\n)',
|
||
`oper_data` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '操作数据',
|
||
`remark` varchar(2000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注',
|
||
`oper_time` int NULL DEFAULT NULL COMMENT '操作时间',
|
||
`is_process` int NULL DEFAULT 0 COMMENT '是否处理(0:否;1:是)',
|
||
`money` int NULL DEFAULT 0 COMMENT '人民币',
|
||
`parentid` int NULL DEFAULT 0 COMMENT '上级',
|
||
PRIMARY KEY (`id`) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 1065153 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for ct_withdraw_record
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `ct_withdraw_record`;
|
||
CREATE TABLE `ct_withdraw_record` (
|
||
`id` int UNSIGNED NOT NULL AUTO_INCREMENT,
|
||
`order_number` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '订单号(年月日+10随机数)',
|
||
`agent_id` varchar(40) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '代理商id',
|
||
`channel_id` varchar(40) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '渠道编号',
|
||
`sales_id` int UNSIGNED NOT NULL COMMENT '个人代理id',
|
||
`request_currency` int UNSIGNED NOT NULL DEFAULT 0 COMMENT '申请体现游戏币数量',
|
||
`request_time` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT '订单创建时间(申请时间)',
|
||
`audit_time` timestamp NULL DEFAULT NULL COMMENT '审核操作时间',
|
||
`status` int NOT NULL DEFAULT 0 COMMENT '当前状态(0: 待审核;1: 已审核; 2: 已驳回; -1: 已撤销)',
|
||
`remark` varchar(400) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注(被撤回时, 撤回理由可保存在内)',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `uk_withdraw_record`(`order_number` ASC) USING BTREE,
|
||
UNIQUE INDEX `pk_withdraw_record`(`id` ASC) USING BTREE,
|
||
INDEX `nk_withdraw_record`(`order_number` ASC, `agent_id` ASC, `channel_id` ASC, `sales_id` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 145 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for error
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `error`;
|
||
CREATE TABLE `error` (
|
||
`idx` int NOT NULL AUTO_INCREMENT,
|
||
`erro_agentid` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '代理商id',
|
||
`erro_playerid` int NOT NULL COMMENT '玩家id',
|
||
`erro_gameid` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '游戏id',
|
||
`erro_msg` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '错误信息',
|
||
`erro_packet` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '收到的包',
|
||
`erro_time` datetime NULL DEFAULT NULL COMMENT '时间',
|
||
PRIMARY KEY (`idx`) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 116 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci COMMENT = '错误日志表' ROW_FORMAT = DYNAMIC;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for game_buybill
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `game_buybill`;
|
||
CREATE TABLE `game_buybill` (
|
||
`idx` int NOT NULL AUTO_INCREMENT,
|
||
`gabu_agentid` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '代理商id',
|
||
`gabu_playerid` int NOT NULL COMMENT '玩家id',
|
||
`gabu_channelid` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '渠道商id',
|
||
`gabu_billcode` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '订单号',
|
||
`gabu_productid` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '产品id',
|
||
`gabu_payid` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '支付id',
|
||
`gabu_amount` int NOT NULL COMMENT '产品中的房卡数量',
|
||
`gabu_money` decimal(10, 2) NOT NULL COMMENT '产品中的所需金额',
|
||
`gabu_createtime` datetime NOT NULL COMMENT '下单时间',
|
||
`gabu_paystate` tinyint(1) NULL DEFAULT 0 COMMENT '支付状态 0-未支付 1-已支付',
|
||
`gabu_paymoney` decimal(10, 2) NULL DEFAULT NULL COMMENT '实际支付金额',
|
||
`gabu_paytime` datetime NULL DEFAULT NULL COMMENT '支付时间',
|
||
`gabu_paytype` tinyint(1) NOT NULL COMMENT '支付方式 1-苹果 2-微信 3-支付宝',
|
||
`gabu_transid` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '支付流水号',
|
||
`gabu_outtradeNo` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '商家订单号',
|
||
PRIMARY KEY (`idx`) USING BTREE,
|
||
INDEX `game_buybill_index`(`gabu_agentid` ASC, `gabu_channelid` ASC, `gabu_billcode` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 11 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci COMMENT = '玩家购卡记录表' ROW_FORMAT = DYNAMIC;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for game_product
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `game_product`;
|
||
CREATE TABLE `game_product` (
|
||
`idx` int NOT NULL AUTO_INCREMENT,
|
||
`gapr_agentid` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '代理商id',
|
||
`gapr_productid` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '产品id',
|
||
`gapr_payid` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '支付id',
|
||
`gapr_name` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '产品名称',
|
||
`gapr_amount` int NOT NULL COMMENT '房卡数量',
|
||
`gapr_money` decimal(10, 2) NOT NULL COMMENT '所需金额',
|
||
`gapr_memo` varchar(200) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '描述',
|
||
`gapr_state` tinyint(1) NULL DEFAULT 0 COMMENT '状态 0-启用 1-禁用',
|
||
PRIMARY KEY (`idx`) USING BTREE,
|
||
INDEX `game_product_index`(`gapr_agentid` ASC, `gapr_productid` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 241 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci COMMENT = '房卡产品表' ROW_FORMAT = DYNAMIC;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for order_star
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `order_star`;
|
||
CREATE TABLE `order_star` (
|
||
`idx` int NOT NULL AUTO_INCREMENT,
|
||
`agent_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '代理商id',
|
||
`channel_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '渠道id',
|
||
`order_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '订单id',
|
||
`product_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '产品id',
|
||
`star_amount` int NOT NULL DEFAULT 0 COMMENT '产品中星星数量',
|
||
`product_money` decimal(10, 2) NOT NULL COMMENT '产品需要的金额',
|
||
`create_time` datetime NOT NULL COMMENT '订单生成时间',
|
||
`status` tinyint(1) NOT NULL DEFAULT 0 COMMENT '订单状态,0、未付款,1、已付款',
|
||
`pay_money` decimal(10, 2) NOT NULL DEFAULT 0.00 COMMENT '实际支付金额',
|
||
`pay_time` datetime NULL DEFAULT NULL COMMENT '付款时间',
|
||
`order_type` tinyint(1) NULL DEFAULT 0 COMMENT '订单类型,0、个人订单,1、代理购买',
|
||
`player_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '玩家id',
|
||
`player_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '玩家昵称',
|
||
`wei_trans_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '微信流水id',
|
||
`wei_trade_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '微信订单id',
|
||
`app_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '支付appid',
|
||
`dev_key` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '开发者key',
|
||
`business_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '支付businessid',
|
||
`sign_key` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '签名key',
|
||
`pushrate1` int NULL DEFAULT 0,
|
||
`pushmoney1` decimal(10, 2) NULL DEFAULT 0.00,
|
||
`pushrate2` int NULL DEFAULT 0,
|
||
`pushmoney2` decimal(10, 2) NULL DEFAULT NULL,
|
||
`pushstate` tinyint(1) NULL DEFAULT 0,
|
||
`pushsalesid1` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
||
`pushsalesid2` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
||
`sales_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
||
`sales_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '代理昵称',
|
||
`open_id` varchar(60) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
||
`union_id` varchar(60) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '微信id',
|
||
`parent_order` varchar(60) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '关联的上级订单号',
|
||
PRIMARY KEY (`idx`) USING BTREE,
|
||
INDEX `nk_order_star_player_id`(`agent_id` ASC, `channel_id` ASC, `player_id` ASC) USING BTREE,
|
||
INDEX `nk_order_star_player_id_2`(`agent_id` ASC, `player_id` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 651 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for player
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `player`;
|
||
CREATE TABLE `player` (
|
||
`idx` int NOT NULL AUTO_INCREMENT,
|
||
`play_agentid` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '代理商id',
|
||
`play_playerid` int NOT NULL COMMENT '玩家id',
|
||
`play_channelid` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL,
|
||
`play_openid` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '微信openid',
|
||
`play_unionid` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '微信unionid',
|
||
`play_nickname` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '玩家昵称',
|
||
`play_avatar` varchar(200) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '头像',
|
||
`play_sex` tinyint(1) NULL DEFAULT NULL COMMENT '性别',
|
||
`play_province` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '省',
|
||
`play_city` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '城市',
|
||
`play_roomcard` int UNSIGNED NULL DEFAULT 8 COMMENT '房卡数量',
|
||
`play_bean` int NULL DEFAULT 0,
|
||
`play_regtime` datetime NOT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '注册时间',
|
||
`play_lasttime` datetime NOT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '最后登录时间',
|
||
`play_logindate` int NULL DEFAULT 1 COMMENT '累积登录天数',
|
||
`play_usecard` int NULL DEFAULT 0 COMMENT '累积使用房卡数量',
|
||
`play_taskaward` int NULL DEFAULT 0 COMMENT '累积任务奖励房卡数量',
|
||
`play_type` tinyint(1) NULL DEFAULT 0 COMMENT '用户类型 0:普通用户 1:vip开房不扣房卡',
|
||
`play_score` int NULL DEFAULT 0,
|
||
`play_a_country` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '国',
|
||
`play_a_province` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '省',
|
||
`play_a_city` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '市',
|
||
`play_a_citycode` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '城市代码',
|
||
`play_a_district` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '区',
|
||
`play_a_street` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '街道',
|
||
`play_a_address` varchar(400) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '地址',
|
||
`play_invitecode` int NULL DEFAULT NULL,
|
||
`play_status` tinyint(1) NULL DEFAULT 0 COMMENT '玩家状态,0、正常,1、被封',
|
||
`status_change_time` datetime NULL DEFAULT NULL COMMENT '最后状态改变时间',
|
||
`play_longitude` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '经度',
|
||
`play_latitude` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '纬度',
|
||
`play_marketid` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
||
`play_phoneinfo` varchar(4000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '手机信息',
|
||
`play_whitelist` varchar(4000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '白名单',
|
||
`play_bankpower` tinyint(1) NULL DEFAULT 1 COMMENT '银行权限(0:无;1:有)',
|
||
`play_bank` int NULL DEFAULT 0 COMMENT '银行',
|
||
`play_bankpwd` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '银行密码',
|
||
`phone` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '绑定的手机号',
|
||
PRIMARY KEY (`idx`) USING BTREE,
|
||
UNIQUE INDEX `uk_play_playerid`(`play_agentid` ASC, `play_playerid` ASC) USING BTREE,
|
||
UNIQUE INDEX `player_index2`(`play_agentid` ASC, `play_channelid` ASC, `play_unionid` ASC) USING BTREE,
|
||
UNIQUE INDEX `player_index1`(`play_agentid` ASC, `play_channelid` ASC, `play_playerid` ASC) USING BTREE,
|
||
INDEX `nk_player_invitecode`(`play_agentid` ASC, `play_channelid` ASC, `play_invitecode` ASC) USING BTREE,
|
||
INDEX `nk_play_invitecode`(`play_invitecode` ASC) USING BTREE,
|
||
INDEX `nk_player`(`play_agentid` ASC, `play_playerid` ASC, `play_channelid` ASC, `play_openid` ASC, `play_unionid` ASC, `play_status` ASC) USING BTREE,
|
||
INDEX `nk_play_playerid`(`play_playerid` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 137960 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci COMMENT = '玩家表' ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for player_bean_use_record
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `player_bean_use_record`;
|
||
CREATE TABLE `player_bean_use_record` (
|
||
`id` int NOT NULL AUTO_INCREMENT,
|
||
`agent_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '代理id',
|
||
`channel_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '渠道id',
|
||
`player_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '玩家id',
|
||
`game_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '游戏id',
|
||
`use_type` tinyint(1) NOT NULL DEFAULT 0 COMMENT '0、比赛场报名,1、其他',
|
||
`amount` int NOT NULL DEFAULT 0 COMMENT '数量',
|
||
`create_time` datetime NULL DEFAULT NULL COMMENT '时间',
|
||
PRIMARY KEY (`id`) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for player_club
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `player_club`;
|
||
CREATE TABLE `player_club` (
|
||
`idx` int NOT NULL AUTO_INCREMENT,
|
||
`agent_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '代理商id',
|
||
`channel_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '渠道id',
|
||
`union_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '微信id',
|
||
`player_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '玩家id',
|
||
`club_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '参加的俱乐部id',
|
||
`sales_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '俱乐部代理id',
|
||
`create_time` datetime NOT NULL,
|
||
PRIMARY KEY (`idx`) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for player_grade
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `player_grade`;
|
||
CREATE TABLE `player_grade` (
|
||
`idx` int NOT NULL AUTO_INCREMENT,
|
||
`plgr_agentid` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '代理商id',
|
||
`plgr_playerid` int NOT NULL COMMENT '玩家id',
|
||
`plgr_gameid` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '游戏id',
|
||
`plgr_roomcode` int NOT NULL COMMENT '房号',
|
||
`plgr_ownerid` int NULL DEFAULT NULL COMMENT '房主id',
|
||
`plgr_roomtype` varchar(200) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '房间类型',
|
||
`plgr_createtime` datetime NOT NULL COMMENT '开房时间',
|
||
`plgr_makewartime` datetime NOT NULL COMMENT '开战时间',
|
||
`plgr_overtime` datetime NOT NULL COMMENT '结束时间',
|
||
`plgr_roomcard` int NULL DEFAULT NULL,
|
||
`plgr_ownercard` int NULL DEFAULT NULL,
|
||
`plgr_gameinfo1` varchar(10000) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT '' COMMENT '一局游戏的完整数据 json格式',
|
||
`plgr_gameinfo2` mediumtext CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL COMMENT '一局游戏的完整数据 json格式',
|
||
`plgr_shortcode` int NULL DEFAULT NULL,
|
||
`plgr_deducttype` tinyint(1) NULL DEFAULT NULL,
|
||
`plgr_deductcard` int NULL DEFAULT NULL,
|
||
`plgr_asetcount` int NULL DEFAULT NULL,
|
||
PRIMARY KEY (`idx`) USING BTREE,
|
||
INDEX `player_grade2_index`(`plgr_agentid` ASC, `plgr_playerid` ASC, `plgr_gameid` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci COMMENT = '玩家战绩表' ROW_FORMAT = DYNAMIC;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for player_opinion
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `player_opinion`;
|
||
CREATE TABLE `player_opinion` (
|
||
`idx` int NOT NULL AUTO_INCREMENT,
|
||
`plop_agentid` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '代理商id',
|
||
`plop_playerid` int NOT NULL COMMENT '玩家id',
|
||
`plop_gameid` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '游戏id',
|
||
`plop_content` varchar(2000) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '反馈意见',
|
||
`plop_time` datetime NULL DEFAULT NULL COMMENT '反馈时间',
|
||
PRIMARY KEY (`idx`) USING BTREE,
|
||
INDEX `player_opinion_index`(`plop_agentid` ASC, `plop_playerid` ASC, `plop_gameid` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 1419 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci COMMENT = '玩家反馈意见表' ROW_FORMAT = DYNAMIC;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for player_short_num
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `player_short_num`;
|
||
CREATE TABLE `player_short_num` (
|
||
`id` int NOT NULL AUTO_INCREMENT,
|
||
`agent_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '代理商id',
|
||
`channel_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '渠道id',
|
||
`sales_id` int UNSIGNED NULL DEFAULT NULL COMMENT '操作的代理id',
|
||
`player_id` int UNSIGNED NOT NULL COMMENT '玩家id',
|
||
`open_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
||
`union_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
||
`short_str` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '玩家的短号',
|
||
`max_room` int NOT NULL DEFAULT 0 COMMENT '最大房间数',
|
||
`change_time` datetime NULL DEFAULT NULL COMMENT '修改时间',
|
||
`create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
|
||
`des_one` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '短号描述1',
|
||
`des_two` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '短号描述2',
|
||
`lower_limit` int NULL DEFAULT 0 COMMENT '下限',
|
||
`collection_code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '支付宝收款码',
|
||
`announcement` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '公告',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `pk_player_short_num`(`id` ASC) USING BTREE,
|
||
INDEX `nk_player_short_num_agent_channel_player`(`agent_id` ASC, `channel_id` ASC, `player_id` ASC) USING BTREE,
|
||
INDEX `nk_player_short_num_agent_player`(`agent_id` ASC, `player_id` ASC) USING BTREE,
|
||
INDEX `nk_player_short_num_agent_sales`(`agent_id` ASC, `sales_id` ASC) USING BTREE,
|
||
INDEX `nk_player_short_num_agent_channel_sales`(`agent_id` ASC, `channel_id` ASC, `sales_id` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 821 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for report_agent_day
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `report_agent_day`;
|
||
CREATE TABLE `report_agent_day` (
|
||
`idx` int NOT NULL AUTO_INCREMENT,
|
||
`read_agentid` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '代理商id',
|
||
`read_day` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '日期',
|
||
`read_newplayer` int NULL DEFAULT 0 COMMENT '新增玩家数量',
|
||
`read_newsalesman` int NULL DEFAULT 0 COMMENT '新增个人代理数量',
|
||
`read_playeraward` int NULL DEFAULT 0 COMMENT '玩家得到的奖励房卡数量',
|
||
`read_salesmoney` decimal(10, 2) NULL DEFAULT 0.00 COMMENT '房卡销售金额',
|
||
PRIMARY KEY (`idx`) USING BTREE,
|
||
UNIQUE INDEX `report_agent_day_index`(`read_agentid` ASC, `read_day` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 15831 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci COMMENT = '代理商的日报表' ROW_FORMAT = DYNAMIC;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for report_game_day
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `report_game_day`;
|
||
CREATE TABLE `report_game_day` (
|
||
`idx` int NOT NULL AUTO_INCREMENT,
|
||
`regd_agentid` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '代理商id',
|
||
`regd_gameid` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '游戏id',
|
||
`regd_day` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '日期',
|
||
`regd_newplayer` int NULL DEFAULT 0 COMMENT '新增玩家数量',
|
||
`regd_useroomcard` int NULL DEFAULT 0 COMMENT '消耗房卡数量',
|
||
`regd_asetcount` int NULL DEFAULT 0 COMMENT '玩家一共玩了多少游戏局(每人一大局算1)',
|
||
`regd_maxplayer` int NULL DEFAULT 0 COMMENT '最大在线玩家数量',
|
||
`regd_maxplayertime` datetime NULL DEFAULT NULL COMMENT '最大在线玩家数量出现的时间',
|
||
`regd_maxroom` int NULL DEFAULT 0 COMMENT '最大开房数量',
|
||
`regd_maxroomtime` datetime NULL DEFAULT NULL COMMENT '最大开房数量出现的时间',
|
||
PRIMARY KEY (`idx`) USING BTREE,
|
||
UNIQUE INDEX `report_game_day_index`(`regd_agentid` ASC, `regd_gameid` ASC, `regd_day` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 52633 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci COMMENT = '游戏的日报表' ROW_FORMAT = DYNAMIC;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for report_user
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `report_user`;
|
||
CREATE TABLE `report_user` (
|
||
`id` int NOT NULL AUTO_INCREMENT,
|
||
`agent_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '代理编号',
|
||
`channnel_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '渠道id',
|
||
`open_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
||
`union_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
||
`sales_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '代理id',
|
||
`status` tinyint(1) NULL DEFAULT 0 COMMENT '0、正常,1、可用',
|
||
PRIMARY KEY (`id`) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for sales_ask_bill
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `sales_ask_bill`;
|
||
CREATE TABLE `sales_ask_bill` (
|
||
`idx` int NOT NULL AUTO_INCREMENT,
|
||
`saab_agentid` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '代理商id',
|
||
`channel_id` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '渠道id',
|
||
`saab_type` tinyint(1) NOT NULL COMMENT '索取类型 0-玩家索取房卡 1-个人代理索取房卡 2-玩家索取星星 3-个人代理索取星星',
|
||
`saab_askid` int NOT NULL COMMENT '发起者id(玩家id或个人代理id)',
|
||
`saab_asknickname` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '发起者昵称',
|
||
`saab_askavatar` varchar(200) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '发起者头像',
|
||
`saab_salesid` int NOT NULL COMMENT '受理者id(个人代理id)',
|
||
`saab_amount` int NOT NULL COMMENT '索要房卡数量',
|
||
`saab_state` tinyint(1) NOT NULL COMMENT '状态 0-等待发卡 1-已确认发卡 2-发起者已取消 3-受理者已驳回',
|
||
`saab_asktime` datetime NOT NULL COMMENT '发起索取的时间',
|
||
`saab_dealtime` datetime NULL DEFAULT NULL COMMENT '确认发卡或取消或驳回的时间',
|
||
PRIMARY KEY (`idx`) USING BTREE,
|
||
INDEX `sales_ask_bill_index`(`saab_agentid` ASC, `saab_type` ASC, `saab_askid` ASC, `saab_salesid` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci COMMENT = '索要房卡记录表' ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for sales_award
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `sales_award`;
|
||
CREATE TABLE `sales_award` (
|
||
`idx` int NOT NULL AUTO_INCREMENT,
|
||
`saaw_agentid` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '代理商id',
|
||
`saaw_salesid` int NOT NULL COMMENT '个人代理id',
|
||
`saaw_childid` int NOT NULL COMMENT '子个人代理id',
|
||
`saaw_type` tinyint(1) NOT NULL COMMENT '奖励类型 0-发展子代理 1-子代理充值',
|
||
`saaw_buybill` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '子个人代理购卡订单号',
|
||
`saaw_award` int NOT NULL COMMENT '个人代理的奖励房卡数量',
|
||
`saaw_state` tinyint(1) NULL DEFAULT 0 COMMENT '奖励领取状态 0-未领取 1-已领取',
|
||
`saaw_createtime` datetime NULL DEFAULT NULL COMMENT '奖励的生成时间',
|
||
`saaw_gettime` datetime NULL DEFAULT NULL COMMENT '奖励的领取时间',
|
||
PRIMARY KEY (`idx`) USING BTREE,
|
||
INDEX `sales_award_index`(`saaw_agentid` ASC, `saaw_salesid` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 1059 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci COMMENT = '子代理充值奖励表' ROW_FORMAT = DYNAMIC;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for sales_bonus_list
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `sales_bonus_list`;
|
||
CREATE TABLE `sales_bonus_list` (
|
||
`id` int NOT NULL AUTO_INCREMENT,
|
||
`agent_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '代理商id',
|
||
`channel_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '渠道id',
|
||
`phone` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '用户手机号',
|
||
`weichat` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '微信id',
|
||
`send_card` int NOT NULL DEFAULT 0 COMMENT '送的房卡',
|
||
`power` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '权限',
|
||
`sales_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '成为代理后的代理id',
|
||
`is_send` tinyint(1) NOT NULL DEFAULT 0 COMMENT '0、没有送,1、送了',
|
||
`send_time` datetime NULL DEFAULT NULL COMMENT '赠送房卡时间',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `uk_bonus_list_phone`(`agent_id` ASC, `channel_id` ASC, `phone` ASC) USING BTREE,
|
||
UNIQUE INDEX `pk_bonus_list_id`(`id` ASC) USING BTREE,
|
||
UNIQUE INDEX `uk_bonus_list_sales_id`(`agent_id` ASC, `channel_id` ASC, `sales_id` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 15801 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for sales_buybill
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `sales_buybill`;
|
||
CREATE TABLE `sales_buybill` (
|
||
`idx` int NOT NULL AUTO_INCREMENT,
|
||
`sabu_agentid` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '代理商id',
|
||
`sabu_openid` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '微信openid',
|
||
`sabu_channelid` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL,
|
||
`sabu_billcode` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '订单号',
|
||
`sabu_productid` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '产品id',
|
||
`sabu_amount` int NOT NULL COMMENT '产品中的房卡数量',
|
||
`sabu_money` decimal(10, 2) NOT NULL COMMENT '产品中的所需金额',
|
||
`sabu_createtime` datetime NOT NULL COMMENT '下单时间',
|
||
`sabu_paystate` tinyint(1) NULL DEFAULT 0 COMMENT '支付状态 0-未支付 1-已支付',
|
||
`sabu_paymoney` decimal(10, 2) NULL DEFAULT NULL COMMENT '实际支付金额',
|
||
`sabu_paytime` datetime NULL DEFAULT NULL COMMENT '支付时间',
|
||
`sabu_billtype` tinyint(1) NOT NULL COMMENT '订单类型 0-个人玩家购卡 1-个人代理购卡',
|
||
`sabu_playerid` int NULL DEFAULT NULL COMMENT '充值者id',
|
||
`sabu_playername` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '充值者昵称',
|
||
`sabu_transid` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '微信支付流水号',
|
||
`sabu_outtradeNo` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '微信支付商家订单号',
|
||
`sabu_appid` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL,
|
||
`sabu_devkey` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL,
|
||
`sabu_business_id` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL,
|
||
`sabu_signkey` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '微信支付签名',
|
||
`sabu_pushrate1` int NULL DEFAULT NULL,
|
||
`sabu_pushmoney1` decimal(10, 2) NULL DEFAULT NULL,
|
||
`sabu_pushrate2` int NULL DEFAULT NULL,
|
||
`sabu_pushmoney2` decimal(10, 2) NULL DEFAULT NULL,
|
||
`sabu_pushstate` tinyint(1) NULL DEFAULT 0,
|
||
`sabu_pushsalesid1` int NULL DEFAULT NULL,
|
||
`sabu_pushsalesid2` int NULL DEFAULT NULL,
|
||
`sales_id` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '代理id',
|
||
`sales_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '代理昵称',
|
||
`parent_order` varchar(60) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '关联的上级订单号',
|
||
PRIMARY KEY (`idx`) USING BTREE,
|
||
UNIQUE INDEX `pk_buybill`(`idx` ASC) USING BTREE,
|
||
INDEX `nk_buybill_sales_id`(`sabu_agentid` ASC, `sabu_channelid` ASC, `sales_id` ASC) USING BTREE,
|
||
INDEX `nk_buybill_open_id`(`sabu_agentid` ASC, `sabu_openid` ASC, `sabu_channelid` ASC) USING BTREE,
|
||
INDEX `nk_buybill_player_id_2`(`sabu_agentid` ASC, `sabu_playerid` ASC) USING BTREE,
|
||
INDEX `nk_buybill_agent`(`sabu_agentid` ASC, `sabu_channelid` ASC) USING BTREE,
|
||
INDEX `nk_buybill_player_id`(`sabu_agentid` ASC, `sabu_channelid` ASC, `sabu_playerid` ASC) USING BTREE,
|
||
INDEX `uk_buybill`(`sabu_agentid` ASC, `sabu_channelid` ASC, `sabu_billcode` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 57612 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci COMMENT = '用户购卡记录表' ROW_FORMAT = DYNAMIC;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for sales_notice
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `sales_notice`;
|
||
CREATE TABLE `sales_notice` (
|
||
`idx` int NOT NULL AUTO_INCREMENT,
|
||
`sano_agentid` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '代理商id',
|
||
`sano_noticeid` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '公告id',
|
||
`sano_title` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '标题',
|
||
`sano_time` datetime NOT NULL COMMENT '发布时间',
|
||
`sano_begintime` datetime NULL DEFAULT NULL COMMENT '开始显示时间',
|
||
`sano_endtime` datetime NULL DEFAULT NULL COMMENT '结束显示时间',
|
||
`sano_content` varchar(4000) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '内容',
|
||
PRIMARY KEY (`idx`) USING BTREE,
|
||
INDEX `sales_notice_index`(`sano_agentid` ASC, `sano_noticeid` ASC) USING BTREE
|
||
) ENGINE = InnoDB CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci COMMENT = '个人代理公告' ROW_FORMAT = DYNAMIC;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for sales_operate_log
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `sales_operate_log`;
|
||
CREATE TABLE `sales_operate_log` (
|
||
`id` int NOT NULL AUTO_INCREMENT,
|
||
`agent_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '代理商id',
|
||
`channel_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '渠道编号',
|
||
`sales_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '代理商编号',
|
||
`player_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
||
`to_agent_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '被操作的代理商id',
|
||
`to_channel_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
||
`to_player_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '被操作的id',
|
||
`operate_type` int NOT NULL DEFAULT 0 COMMENT '0、解绑绑定的玩家,1、解除玩家绑定的代理,21总代理扣玩家房卡,22总代理扣玩家星星,23总代理扣代理房卡,24总代理扣代理星星',
|
||
`operate_data` varchar(2000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '操作数据',
|
||
`create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
|
||
PRIMARY KEY (`id`) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 19244 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '代理操作记录表' ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for sales_product
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `sales_product`;
|
||
CREATE TABLE `sales_product` (
|
||
`idx` int UNSIGNED NOT NULL AUTO_INCREMENT,
|
||
`sapr_agentid` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '代理商id',
|
||
`sapr_productid` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '产品id',
|
||
`sapr_type` tinyint(1) NOT NULL COMMENT '产品类型 0-针对个人玩家的产品 1-针对个人代理的产品',
|
||
`sapr_name` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '产品名称',
|
||
`sapr_amount` int NOT NULL COMMENT '房卡数量',
|
||
`sapr_money` decimal(10, 2) NOT NULL COMMENT '所需金额',
|
||
`sapr_memo` varchar(200) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '描述',
|
||
`sapr_state` tinyint(1) NULL DEFAULT 0 COMMENT '状态 0-启用 1-禁用',
|
||
`product_type` int NOT NULL DEFAULT 0 COMMENT '0、房卡,1、星星,2、钻石',
|
||
`parent_id` int UNSIGNED NULL DEFAULT NULL COMMENT '上级关联id',
|
||
`sort` int UNSIGNED NULL DEFAULT 0 COMMENT '排序',
|
||
`make_vip` int UNSIGNED NULL DEFAULT 0 COMMENT '是否成为vip标志(好友房) 0-不赠送 1-赠送',
|
||
PRIMARY KEY (`idx`) USING BTREE,
|
||
INDEX `sales_product_index`(`sapr_agentid` ASC, `sapr_productid` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 4601 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci COMMENT = '房卡产品表' ROW_FORMAT = DYNAMIC;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for sales_sellbill
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `sales_sellbill`;
|
||
CREATE TABLE `sales_sellbill` (
|
||
`idx` int NOT NULL AUTO_INCREMENT,
|
||
`sase_agentid` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '代理商id',
|
||
`sase_openid` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '微信openid',
|
||
`channel_id` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '渠道id',
|
||
`from_sales` int NULL DEFAULT NULL COMMENT '来源代理号',
|
||
`sase_playerid` int NOT NULL COMMENT '玩家id',
|
||
`sase_amount` int NOT NULL COMMENT '售卡数量',
|
||
`sase_selltime` datetime NOT NULL COMMENT '售卡时间',
|
||
PRIMARY KEY (`idx`) USING BTREE,
|
||
UNIQUE INDEX `pk_sellbill`(`idx` ASC) USING BTREE,
|
||
INDEX `nk_sellbill_2`(`sase_agentid` ASC, `channel_id` ASC, `sase_playerid` ASC) USING BTREE,
|
||
INDEX `nk_sellbill_3`(`sase_agentid` ASC, `sase_openid` ASC, `channel_id` ASC, `sase_playerid` ASC) USING BTREE,
|
||
INDEX `nk_sellbill_1`(`sase_agentid` ASC, `sase_openid` ASC, `channel_id` ASC) USING BTREE,
|
||
INDEX `sales_sellbill_index`(`sase_agentid` ASC, `sase_openid` ASC) USING BTREE,
|
||
INDEX `nk_sellbill_agent`(`sase_agentid` ASC, `channel_id` ASC) USING BTREE,
|
||
INDEX `nk_sellbill_from_sales`(`sase_agentid` ASC, `channel_id` ASC, `from_sales` ASC) USING BTREE,
|
||
INDEX `nk_sase_selltime`(`sase_selltime` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 918574 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci COMMENT = '个人代理售卡记录表' ROW_FORMAT = DYNAMIC;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for sales_sellbill_bean
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `sales_sellbill_bean`;
|
||
CREATE TABLE `sales_sellbill_bean` (
|
||
`idx` int NOT NULL AUTO_INCREMENT,
|
||
`ssbe_agentid` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '代理商id',
|
||
`channel_id` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '渠道id',
|
||
`from_sales` int NULL DEFAULT NULL COMMENT '来源代理号',
|
||
`ssbe_openid` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '微信openid',
|
||
`ssbe_playerid` int NOT NULL COMMENT '玩家id',
|
||
`ssbe_amount` int NOT NULL COMMENT '充值数量',
|
||
`ssbe_selltime` datetime NOT NULL COMMENT '充值时间',
|
||
PRIMARY KEY (`idx`) USING BTREE,
|
||
UNIQUE INDEX `pk_sellbill_bean`(`idx` ASC) USING BTREE,
|
||
INDEX `nk_sellbill_bean_to_player`(`ssbe_agentid` ASC, `channel_id` ASC, `ssbe_playerid` ASC) USING BTREE,
|
||
INDEX `nk_sellbill_bean_from_sales`(`ssbe_agentid` ASC, `channel_id` ASC, `from_sales` ASC) USING BTREE,
|
||
INDEX `nk_sellbill_bean_agent`(`ssbe_agentid` ASC, `channel_id` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 11929 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci COMMENT = '个人代理充星星记录表' ROW_FORMAT = DYNAMIC;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for sales_sms_code
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `sales_sms_code`;
|
||
CREATE TABLE `sales_sms_code` (
|
||
`id` int NOT NULL AUTO_INCREMENT,
|
||
`agent_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '代理商id',
|
||
`channnel_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '渠道id',
|
||
`sales_id` int UNSIGNED NULL DEFAULT NULL COMMENT '代理编号',
|
||
`phone` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '联系电话',
|
||
`code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '验证码',
|
||
`status` tinyint(1) NULL DEFAULT 0 COMMENT '0、有效,1、失效',
|
||
`create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
|
||
`is_bind` int NULL DEFAULT 0 COMMENT '是否绑定(0:否;1:是)',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `pk_sales_sms_code`(`id` ASC) USING BTREE,
|
||
UNIQUE INDEX `uk_sales_sms_code`(`agent_id` ASC, `channnel_id` ASC, `phone` ASC, `code` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 1121 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for sales_transferbill
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `sales_transferbill`;
|
||
CREATE TABLE `sales_transferbill` (
|
||
`idx` int NOT NULL AUTO_INCREMENT,
|
||
`satr_agentid` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '代理商id',
|
||
`satr_openid` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '微信openid',
|
||
`channel_id` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '渠道id',
|
||
`from_sales` int NULL DEFAULT NULL COMMENT '来源代理号',
|
||
`satr_salesid` int NOT NULL COMMENT '个人代理id',
|
||
`satr_amount` int NOT NULL COMMENT '转卡数量',
|
||
`satr_transfertime` datetime NOT NULL COMMENT '转卡时间',
|
||
PRIMARY KEY (`idx`) USING BTREE,
|
||
INDEX `nk_transferbill_agent`(`satr_agentid` ASC, `channel_id` ASC) USING BTREE,
|
||
INDEX `nk_transferbill_openid`(`satr_agentid` ASC, `channel_id` ASC, `satr_openid` ASC) USING BTREE,
|
||
INDEX `nk_transferbill_salesid`(`satr_agentid` ASC, `channel_id` ASC, `satr_salesid` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 53383 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci COMMENT = '个人代理转卡记录表' ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for sales_user
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `sales_user`;
|
||
CREATE TABLE `sales_user` (
|
||
`idx` int NOT NULL AUTO_INCREMENT,
|
||
`user_id` int NULL DEFAULT NULL COMMENT '用户号',
|
||
`saus_agentid` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '代理商id',
|
||
`saus_channelid` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL,
|
||
`saus_openid` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '微信openid',
|
||
`saus_unionid` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '微信unionid',
|
||
`saus_nickname` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '昵称',
|
||
`saus_avatar` varchar(200) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '头像',
|
||
`saus_sex` tinyint(1) NULL DEFAULT NULL COMMENT '性别',
|
||
`saus_province` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '省',
|
||
`saus_city` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '城市',
|
||
`saus_firsttime` datetime NOT NULL COMMENT '第一次登登录时间',
|
||
`saus_lasttime` datetime NOT NULL COMMENT '最后一次登录时间',
|
||
`saus_salesman` tinyint(1) NULL DEFAULT 0 COMMENT '0:普通用户 1:个人代理',
|
||
`saus_salesid` int NULL DEFAULT NULL COMMENT '个人代理id',
|
||
`saus_level` int NULL DEFAULT 0,
|
||
`saus_parentid` int NULL DEFAULT NULL COMMENT '上级个人代理id',
|
||
`saus_salestype` tinyint(1) NULL DEFAULT 1,
|
||
`saus_roomcard` int UNSIGNED NULL DEFAULT 0 COMMENT '房卡数量',
|
||
`saus_bean` decimal(18, 4) UNSIGNED NULL DEFAULT 0.0000 COMMENT '金币数',
|
||
`saus_saletime` datetime NULL DEFAULT NULL COMMENT '成为个人代理时间',
|
||
`saus_tel` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL,
|
||
`saus_wechat` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL,
|
||
`saus_invitecode` int NULL DEFAULT NULL,
|
||
`saus_power` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL,
|
||
`saus_pushrate1` int NULL DEFAULT 33,
|
||
`saus_pushrate2` int NULL DEFAULT 8,
|
||
`saus_pushmoney1` decimal(10, 2) NULL DEFAULT 0.00,
|
||
`saus_pushmoney2` decimal(10, 2) NULL DEFAULT 0.00,
|
||
`saus_status` int NULL DEFAULT 0 COMMENT '0、正常,1、封禁',
|
||
`password` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '用户密码',
|
||
`global_power` tinyint(1) NULL DEFAULT 0 COMMENT '0、没有权限,1、有封禁权限',
|
||
`club_precent` decimal(10, 2) NULL DEFAULT 0.00 COMMENT '俱乐部抽成',
|
||
`is_send_star` tinyint(1) NULL DEFAULT 0 COMMENT '0、未赠送,1、已赠送',
|
||
`currency_total` decimal(18, 4) UNSIGNED NULL DEFAULT 0.0000 COMMENT '总计分成游戏币',
|
||
`currency_withdraw` decimal(18, 4) UNSIGNED NULL DEFAULT 0.0000 COMMENT '可提现游戏币',
|
||
`currency_freeze` decimal(18, 4) UNSIGNED NULL DEFAULT 0.0000 COMMENT '被冻结的游戏币',
|
||
`saus_realname` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '真实姓名',
|
||
`saus_alipay` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '支付宝账户',
|
||
`saus_kaihu_name` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '开户人姓名',
|
||
`saus_kaihu_bank` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '开户银行',
|
||
`saus_kaihu_zhihang` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '开户支行',
|
||
`saus_kaihu_count` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '银行账号',
|
||
`saus_commit_auth` int NULL DEFAULT 2 COMMENT '提现权限(1、开启 2、关闭)',
|
||
`statistic_type` int NULL DEFAULT 0 COMMENT '用户类型(-1:不计入统计口径;0:统计为普通用户口径;1:统计为平台用户口径)',
|
||
`player_id` int NULL DEFAULT NULL COMMENT '关联的玩家编号',
|
||
`is_vip` int UNSIGNED NULL DEFAULT 0 COMMENT '是否vip标志(短号房)',
|
||
`diamond` int UNSIGNED NULL DEFAULT 0 COMMENT '账户钻石数',
|
||
`announcement` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '公告',
|
||
PRIMARY KEY (`idx`) USING BTREE,
|
||
UNIQUE INDEX `uk_sales_user_id`(`idx` ASC) USING BTREE,
|
||
UNIQUE INDEX `uk_sales_user_salesid`(`saus_agentid` ASC, `saus_channelid` ASC, `saus_salesid` ASC) USING BTREE,
|
||
UNIQUE INDEX `uk_sales_user_playerid`(`saus_agentid` ASC, `saus_channelid` ASC, `player_id` ASC) USING BTREE,
|
||
UNIQUE INDEX `uk_sales_user_unionid`(`saus_agentid` ASC, `saus_channelid` ASC, `saus_unionid` ASC) USING BTREE,
|
||
UNIQUE INDEX `uk_sales_user_openid`(`saus_agentid` ASC, `saus_channelid` ASC, `saus_openid` ASC) USING BTREE,
|
||
UNIQUE INDEX `uk_sales_user_userid`(`user_id` ASC, `saus_agentid` ASC, `saus_channelid` ASC) USING BTREE,
|
||
INDEX `nk_sales_user_salesid`(`saus_agentid` ASC, `saus_channelid` ASC, `saus_salesid` ASC, `saus_openid` ASC, `saus_unionid` ASC, `saus_status` ASC, `password` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 69461 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci COMMENT = '公众号用户表' ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for task
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `task`;
|
||
CREATE TABLE `task` (
|
||
`idx` int NOT NULL AUTO_INCREMENT,
|
||
`task_agentid` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '代理商id',
|
||
`task_taskid` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '任务id',
|
||
`task_type` tinyint(1) NOT NULL COMMENT '类型 0-针对玩家的每日任务 1-针对玩家的限时任务 2-针对玩家的不限时不限量任务(奖励=tapl_finish*task_award) 3-针对玩家的不限时不限量任务(奖励=tapl_finish)',
|
||
`task_title` varchar(40) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '标题',
|
||
`task_memo` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '描述',
|
||
`task_total` int NOT NULL COMMENT '任务量',
|
||
`task_award` int NOT NULL COMMENT '完成任务的奖励房卡数量',
|
||
`task_begintime` datetime NULL DEFAULT NULL COMMENT '限时任务的开始时间',
|
||
`task_endtime` datetime NULL DEFAULT NULL COMMENT '限时任务的截止时间',
|
||
PRIMARY KEY (`idx`) USING BTREE,
|
||
UNIQUE INDEX `task_index`(`task_agentid` ASC, `task_taskid` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 152 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci COMMENT = '任务表' ROW_FORMAT = DYNAMIC;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for task_player
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `task_player`;
|
||
CREATE TABLE `task_player` (
|
||
`idx` int NOT NULL AUTO_INCREMENT,
|
||
`tapl_agentid` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '代理商id',
|
||
`tapl_playerid` int NOT NULL COMMENT '玩家id',
|
||
`tapl_taskid` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '任务id',
|
||
`tapl_finish` int NULL DEFAULT 0 COMMENT '任务完成量',
|
||
`tapl_state` tinyint(1) NULL DEFAULT 0 COMMENT '任务状态 0-待完成 1-已完成 2-奖励已领取',
|
||
`tapl_createtime` datetime NOT NULL COMMENT '任务领取时间',
|
||
`tapl_finishtime` datetime NULL DEFAULT NULL COMMENT '任务完成时间',
|
||
`tapl_awardtime` datetime NULL DEFAULT NULL COMMENT '奖励领取时间',
|
||
PRIMARY KEY (`idx`) USING BTREE,
|
||
UNIQUE INDEX `task_player_index`(`tapl_agentid` ASC, `tapl_playerid` ASC, `tapl_taskid` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 268239 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci COMMENT = '玩家任务完成表' ROW_FORMAT = DYNAMIC;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for tmp_operation
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `tmp_operation`;
|
||
CREATE TABLE `tmp_operation` (
|
||
`from_user` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
||
`to_user` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
||
`card` int NULL DEFAULT NULL
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 29 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for trans_diamond_record
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `trans_diamond_record`;
|
||
CREATE TABLE `trans_diamond_record` (
|
||
`id` int NOT NULL AUTO_INCREMENT,
|
||
`agent_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '代理商id',
|
||
`channel_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '渠道id',
|
||
`from` int UNSIGNED NOT NULL COMMENT '发送者id',
|
||
`to` int UNSIGNED NOT NULL COMMENT '获得者id',
|
||
`amount` int NOT NULL DEFAULT 0 COMMENT '数量',
|
||
`oper_time` int UNSIGNED NOT NULL COMMENT '操作时间',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `pk_trans_diamond_record`(`id` ASC) USING BTREE,
|
||
INDEX `nk_trans_diamond_record_to`(`agent_id` ASC, `channel_id` ASC, `to` ASC) USING BTREE,
|
||
INDEX `nk_trans_diamond_record_from`(`agent_id` ASC, `channel_id` ASC, `from` ASC) USING BTREE
|
||
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for trans_star_record
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `trans_star_record`;
|
||
CREATE TABLE `trans_star_record` (
|
||
`id` int NOT NULL AUTO_INCREMENT,
|
||
`agent_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '代理商id',
|
||
`channel_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '渠道id',
|
||
`union_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '微信id',
|
||
`open_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
||
`send_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '发送者id',
|
||
`get_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '获得者id',
|
||
`type` tinyint(1) NULL DEFAULT 0 COMMENT '0、转让星星',
|
||
`amount` int NULL DEFAULT 0 COMMENT '数量',
|
||
`op_time` datetime NULL DEFAULT NULL COMMENT '操作时间',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE INDEX `pk_trans_star_record`(`id` ASC) USING BTREE,
|
||
INDEX `nk_trans_star_record_sales_to`(`agent_id` ASC, `channel_id` ASC, `get_id` ASC) USING BTREE,
|
||
INDEX `nk_trans_star_record_sales_from`(`agent_id` ASC, `channel_id` ASC, `send_id` ASC) USING BTREE,
|
||
INDEX `nk_trans_star_record_agent`(`agent_id` ASC, `channel_id` ASC) USING BTREE
|
||
) ENGINE = InnoDB AUTO_INCREMENT = 728 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
||
-- ----------------------------
|
||
-- View structure for cv_manager_channel_info
|
||
-- ----------------------------
|
||
DROP VIEW IF EXISTS `cv_manager_channel_info`;
|
||
CREATE ALGORITHM = UNDEFINED SQL SECURITY INVOKER VIEW `cv_manager_channel_info` AS select `a`.`login_id` AS `login_id`,`b`.`id` AS `list_id`,`b`.`agent_id` AS `agent_id`,`b`.`channel_id` AS `channel_id`,`b`.`nickname` AS `list_name`,1 AS `is_manager` from (`ct_manager_info` `a` join `ct_channel_list` `b`) where (`a`.`level` = 0) union all select `a`.`login_id` AS `login_id`,`c`.`id` AS `id`,`c`.`agent_id` AS `agent_id`,`c`.`channel_id` AS `channel_id`,`c`.`nickname` AS `nickname`,1 AS `is_manager` from ((`ct_manager_info` `a` left join `ct_manager_channel_info` `b` on((`a`.`id` = `b`.`manager_id`))) left join `ct_channel_list` `c` on((`b`.`list_id` = `c`.`id`))) where (`a`.`level` <> 0) union all select `a`.`saus_salesid` AS `saus_salesid`,`b`.`id` AS `id`,`b`.`agent_id` AS `agent_id`,`b`.`channel_id` AS `channel_id`,`b`.`nickname` AS `nickname`,0 AS `0` from (`sales_user` `a` left join `ct_channel_list` `b` on(((`a`.`saus_agentid` = `b`.`agent_id`) and (`a`.`saus_channelid` = `b`.`channel_id`)))) where (`a`.`saus_salesman` = 1);
|
||
|
||
-- ----------------------------
|
||
-- View structure for cv_sales_transfer_record
|
||
-- ----------------------------
|
||
DROP VIEW IF EXISTS `cv_sales_transfer_record`;
|
||
CREATE ALGORITHM = UNDEFINED SQL SECURITY INVOKER VIEW `cv_sales_transfer_record` AS select `a`.`sase_agentid` AS `agent_id`,`a`.`channel_id` AS `channel_id`,`b`.`saus_salesid` AS `from_user`,`b`.`saus_nickname` AS `from_user_name`,`a`.`sase_playerid` AS `to_user`,`c`.`play_nickname` AS `to_user_name`,`a`.`sase_amount` AS `amount`,`a`.`sase_selltime` AS `transfer_time`,1 AS `type` from ((`sales_sellbill` `a` left join `sales_user` `b` on(((`a`.`sase_agentid` = `b`.`saus_agentid`) and (`a`.`channel_id` = `b`.`saus_channelid`) and (`a`.`sase_openid` = `b`.`saus_openid`)))) left join `player` `c` on(((`a`.`sase_agentid` = `c`.`play_agentid`) and (`a`.`channel_id` = `c`.`play_channelid`) and (`a`.`sase_playerid` = `c`.`play_playerid`)))) union all select `a`.`satr_agentid` AS `agent_id`,`a`.`channel_id` AS `channel_id`,`b`.`saus_salesid` AS `from_user`,`b`.`saus_nickname` AS `from_user_name`,`a`.`satr_salesid` AS `to_user`,`c`.`saus_nickname` AS `to_user_name`,`a`.`satr_amount` AS `amount`,`a`.`satr_transfertime` AS `transfer_time`,2 AS `type` from ((`sales_transferbill` `a` left join `sales_user` `b` on(((`a`.`satr_agentid` = `b`.`saus_agentid`) and (`a`.`channel_id` = `b`.`saus_channelid`) and (`a`.`satr_openid` = `b`.`saus_openid`)))) left join `sales_user` `c` on(((`a`.`satr_agentid` = `c`.`saus_agentid`) and (`a`.`channel_id` = `c`.`saus_channelid`) and (`a`.`satr_salesid` = `c`.`saus_salesid`))));
|
||
|
||
-- ----------------------------
|
||
-- Function structure for cf_GetSalesChildList
|
||
-- ----------------------------
|
||
DROP FUNCTION IF EXISTS `cf_GetSalesChildList`;
|
||
delimiter ;;
|
||
CREATE FUNCTION `cf_GetSalesChildList`(`agent_id` varchar(100) charset utf8mb4 collate utf8mb4_general_ci ,`channel_id` varchar(100) charset utf8mb4 collate utf8mb4_general_ci ,`sales_id` varchar(100) charset utf8mb4 collate utf8mb4_general_ci)
|
||
RETURNS text CHARSET utf8mb3
|
||
SQL SECURITY INVOKER
|
||
begin
|
||
declare szChild text default '0';
|
||
declare szIndex text default sales_id;
|
||
|
||
while szIndex is not null do
|
||
set szChild = concat(szChild, ',', szIndex);
|
||
select
|
||
group_concat(saus_salesid)
|
||
into
|
||
szIndex
|
||
from
|
||
sales_user
|
||
where
|
||
saus_agentid = agent_id and
|
||
saus_channelid = channel_id and
|
||
find_in_set(saus_parentid, szIndex);
|
||
end while;
|
||
|
||
return szChild;
|
||
end
|
||
;;
|
||
delimiter ;
|
||
|
||
-- ----------------------------
|
||
-- Procedure structure for cp_agent_login
|
||
-- ----------------------------
|
||
DROP PROCEDURE IF EXISTS `cp_agent_login`;
|
||
delimiter ;;
|
||
CREATE PROCEDURE `cp_agent_login`(IN `user` varchar(100) charset utf8mb4 collate utf8mb4_general_ci ,IN `pwd` varchar(100) charset utf8mb4 collate utf8mb4_general_ci)
|
||
SQL SECURITY INVOKER
|
||
COMMENT '运营商登录'
|
||
label_cp: begin
|
||
declare result tinyint(1); -- 0:成功 >0:失败
|
||
declare error varchar(100); -- 失败描述
|
||
declare agentid varchar(32); -- 代理商id
|
||
declare agentname varchar(100); -- 代理商名称
|
||
declare paymenttotal decimal(10,2); -- 收益总流水
|
||
declare sharingrate int(11); -- 分成比例
|
||
declare profittotal decimal(10,2); -- 收益总金额
|
||
declare playercount int(11); -- 玩家总数
|
||
declare newplayer int(11); -- 当月新增玩家数量
|
||
declare salecount int(11); -- 个人代理总数
|
||
declare newsale int(11); -- 当月新增个人代理数量
|
||
|
||
set result = 0;
|
||
|
||
-- 总流水、分成比例、总收益
|
||
select agen_agentid, agen_name, agen_selftotal, agen_sharingrate, cast(agen_selftotal * agen_sharingrate / 100 as decimal(10,2))
|
||
into agentid, agentname, paymenttotal, sharingrate, profittotal
|
||
from agent
|
||
where agen_user = user and agen_pwd = pwd;
|
||
|
||
if isnull(agentid) then
|
||
set result = 1;
|
||
set error = '账号或密码错误';
|
||
select result, error;
|
||
leave label_cp;
|
||
end if;
|
||
|
||
-- 玩家总人数统计
|
||
select count(1) into playercount
|
||
from player
|
||
where play_agentid = agentid;
|
||
|
||
-- 当月新增玩家人数
|
||
select count(1) into newplayer
|
||
from player
|
||
where play_agentid = agentid
|
||
and play_regtime >= date_add(curdate(), interval - day(curdate()) + 1 day);
|
||
|
||
-- 统计个人代理总数
|
||
select count(1) into salecount
|
||
from sales_user
|
||
where saus_agentid = agentid
|
||
and saus_salesman = 1;
|
||
|
||
-- 统计当月新增个人代理数量
|
||
select count(1) into newsale
|
||
from sales_user
|
||
where saus_agentid = agentid
|
||
and saus_salesman = 1
|
||
and saus_saletime >= date_add(curdate(), interval - day(curdate()) + 1 day);
|
||
|
||
select result, error, agentid, agentname, paymenttotal, sharingrate, profittotal, playercount, newplayer, salecount, newsale;
|
||
end
|
||
;;
|
||
delimiter ;
|
||
|
||
-- ----------------------------
|
||
-- Procedure structure for cp_agent_player_game
|
||
-- ----------------------------
|
||
DROP PROCEDURE IF EXISTS `cp_agent_player_game`;
|
||
delimiter ;;
|
||
CREATE PROCEDURE `cp_agent_player_game`(IN `agentid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci)
|
||
SQL SECURITY INVOKER
|
||
COMMENT '按游戏统计玩家数量和房卡消耗数量'
|
||
begin
|
||
select agpl_gameid as gameid, game_name as gamename, count(1) as playercount, sum(agpl_usecard) as useroomcard
|
||
from agent_game_player
|
||
inner join game on game_gameid = agpl_gameid
|
||
where agpl_agentid = agentid
|
||
group by gameid, gamename;
|
||
end
|
||
;;
|
||
delimiter ;
|
||
|
||
-- ----------------------------
|
||
-- Procedure structure for cp_agent_player_max
|
||
-- ----------------------------
|
||
DROP PROCEDURE IF EXISTS `cp_agent_player_max`;
|
||
delimiter ;;
|
||
CREATE PROCEDURE `cp_agent_player_max`(IN `agentid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci)
|
||
SQL SECURITY INVOKER
|
||
COMMENT '按月度统计同时在线玩家数量峰值和房间峰值'
|
||
begin
|
||
-- 最近12个月按月度统计同时在线玩家数量峰值和房间峰值
|
||
select date_format(aggo_datetime, "%Y-%m") as month, max(aggo_onlineplayer) as maxplayer, max(aggo_onlineroom) as maxroom
|
||
from agent_game_online
|
||
where aggo_agentid = agentid
|
||
group by month
|
||
order by month desc limit 12;
|
||
end
|
||
;;
|
||
delimiter ;
|
||
|
||
-- ----------------------------
|
||
-- Procedure structure for cp_agent_player_month
|
||
-- ----------------------------
|
||
DROP PROCEDURE IF EXISTS `cp_agent_player_month`;
|
||
delimiter ;;
|
||
CREATE PROCEDURE `cp_agent_player_month`(IN `agentid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci)
|
||
SQL SECURITY INVOKER
|
||
COMMENT '按月度统计新增玩家数量'
|
||
begin
|
||
-- 最近12个月按月度统计新增玩家数量
|
||
select date_format(play_regtime, "%Y-%m") as month, count(1) as newplayer
|
||
from player
|
||
where play_agentid = agentid
|
||
group by month
|
||
order by month desc limit 12;
|
||
end
|
||
;;
|
||
delimiter ;
|
||
|
||
-- ----------------------------
|
||
-- Procedure structure for cp_agent_profit_month
|
||
-- ----------------------------
|
||
DROP PROCEDURE IF EXISTS `cp_agent_profit_month`;
|
||
delimiter ;;
|
||
CREATE PROCEDURE `cp_agent_profit_month`(IN `agentid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci)
|
||
SQL SECURITY INVOKER
|
||
COMMENT '按月度统计流水'
|
||
begin
|
||
-- 最近12个月按月度统计收益
|
||
select date_format(sabu_paytime, "%Y-%m" ) as month, sum(sabu_paymoney) as money
|
||
from sales_buybill
|
||
where sabu_agentid = agentid
|
||
and sabu_paystate = 1
|
||
group by month
|
||
order by month desc limit 12;
|
||
end
|
||
;;
|
||
delimiter ;
|
||
|
||
-- ----------------------------
|
||
-- Procedure structure for cp_agent_profit_product
|
||
-- ----------------------------
|
||
DROP PROCEDURE IF EXISTS `cp_agent_profit_product`;
|
||
delimiter ;;
|
||
CREATE PROCEDURE `cp_agent_profit_product`(IN `agentid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci)
|
||
SQL SECURITY INVOKER
|
||
COMMENT '按产品统计流水'
|
||
begin
|
||
select sales_product.idx as idx, sabu_productid as productid,
|
||
concat(sapr_money, '元', sapr_amount, '张') as productname,
|
||
sum(sabu_paymoney) as money, count(1) as times
|
||
from sales_buybill
|
||
inner join sales_product on sapr_agentid = sabu_agentid
|
||
and sapr_productid = sabu_productid
|
||
where sabu_agentid = agentid
|
||
and sabu_paystate = 1
|
||
group by idx, productid, productname
|
||
order by idx;
|
||
end
|
||
;;
|
||
delimiter ;
|
||
|
||
-- ----------------------------
|
||
-- Procedure structure for cp_agent_sale_month
|
||
-- ----------------------------
|
||
DROP PROCEDURE IF EXISTS `cp_agent_sale_month`;
|
||
delimiter ;;
|
||
CREATE PROCEDURE `cp_agent_sale_month`(IN `agentid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci)
|
||
SQL SECURITY INVOKER
|
||
COMMENT '按月度统计新增个人代理数量'
|
||
begin
|
||
-- 最近12个月按月度统计新增个人代理数量
|
||
select date_format(saus_saletime, "%Y-%m") as month, count(1) as newsale
|
||
from sales_user
|
||
where saus_agentid = agentid
|
||
and saus_salesman = 1
|
||
and saus_saletime is not null
|
||
group by month
|
||
order by month desc limit 12;
|
||
end
|
||
;;
|
||
delimiter ;
|
||
|
||
-- ----------------------------
|
||
-- Procedure structure for cp_agent_updatepwd
|
||
-- ----------------------------
|
||
DROP PROCEDURE IF EXISTS `cp_agent_updatepwd`;
|
||
delimiter ;;
|
||
CREATE PROCEDURE `cp_agent_updatepwd`(IN `agentid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci ,IN `oldpwd` varchar(100) charset utf8mb4 collate utf8mb4_general_ci ,IN `newpwd` varchar(100) charset utf8mb4 collate utf8mb4_general_ci)
|
||
SQL SECURITY INVOKER
|
||
COMMENT '修改运营商登录密码'
|
||
label_cp: begin
|
||
declare result tinyint(1); -- 0:成功 >0:失败
|
||
declare error varchar(100); -- 失败描述
|
||
|
||
set result = 0;
|
||
|
||
if not exists(select 1 from agent where agen_agentid = agentid and agen_pwd = oldpwd) then
|
||
set result = 1;
|
||
set error = '原密码不正确';
|
||
select result, error;
|
||
leave label_cp;
|
||
end if;
|
||
|
||
update agent set agen_pwd = newpwd where agen_agentid = agentid;
|
||
|
||
select result, error;
|
||
end
|
||
;;
|
||
delimiter ;
|
||
|
||
-- ----------------------------
|
||
-- Procedure structure for cp_check_1_agent
|
||
-- ----------------------------
|
||
DROP PROCEDURE IF EXISTS `cp_check_1_agent`;
|
||
delimiter ;;
|
||
CREATE PROCEDURE `cp_check_1_agent`(IN `agentid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci ,OUT `result` tinyint(1) ,OUT `error` varchar(100) charset utf8mb4 collate utf8mb4_general_ci ,OUT `agentname` varchar(100) charset utf8mb4 collate utf8mb4_general_ci)
|
||
SQL SECURITY INVOKER
|
||
COMMENT '检验代理商是否存在'
|
||
begin
|
||
set result = 0;
|
||
set error = '';
|
||
set agentname = null;
|
||
|
||
select agen_name into agentname from agent where agen_agentid = agentid;
|
||
if isnull(agentname) then
|
||
set result = 1;
|
||
set error = '运营商不存在';
|
||
end if;
|
||
end
|
||
;;
|
||
delimiter ;
|
||
|
||
-- ----------------------------
|
||
-- Procedure structure for cp_check_2_player
|
||
-- ----------------------------
|
||
DROP PROCEDURE IF EXISTS `cp_check_2_player`;
|
||
delimiter ;;
|
||
CREATE PROCEDURE `cp_check_2_player`(IN `agentid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci ,IN `playerid` int(8) ,OUT `result` tinyint(1) ,OUT `error` varchar(100) charset utf8mb4 collate utf8mb4_general_ci ,OUT `playername` varchar(100) charset utf8mb4 collate utf8mb4_general_ci ,OUT `roomcard` int(11))
|
||
SQL SECURITY INVOKER
|
||
COMMENT '检验代理商是否存在'
|
||
begin
|
||
set result = 0;
|
||
set error = '';
|
||
set playername = null;
|
||
set roomcard = 0;
|
||
|
||
select play_nickname, play_roomcard into playername, roomcard
|
||
from player where play_agentid = agentid and play_playerid = playerid;
|
||
|
||
if isnull(playername) then
|
||
set result = 2;
|
||
set error = '玩家不存在';
|
||
end if;
|
||
end
|
||
;;
|
||
delimiter ;
|
||
|
||
-- ----------------------------
|
||
-- Procedure structure for cp_check_3_game
|
||
-- ----------------------------
|
||
DROP PROCEDURE IF EXISTS `cp_check_3_game`;
|
||
delimiter ;;
|
||
CREATE PROCEDURE `cp_check_3_game`(IN `agentid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci ,IN `gameid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci ,OUT `result` tinyint(1) ,OUT `error` varchar(100) charset utf8mb4 collate utf8mb4_general_ci ,OUT `gamename` varchar(100) charset utf8mb4 collate utf8mb4_general_ci)
|
||
SQL SECURITY INVOKER
|
||
COMMENT '检验代理商是否存在'
|
||
begin
|
||
set result = 0;
|
||
set error = '';
|
||
set gamename = null;
|
||
|
||
select game_name into gamename from game where game_agentid = agentid and game_gameid = gameid;
|
||
if isnull(gamename) then
|
||
set result = 3;
|
||
set error = '游戏不存在';
|
||
end if;
|
||
end
|
||
;;
|
||
delimiter ;
|
||
|
||
-- ----------------------------
|
||
-- Procedure structure for cp_check_4_salesuser
|
||
-- ----------------------------
|
||
DROP PROCEDURE IF EXISTS `cp_check_4_salesuser`;
|
||
delimiter ;;
|
||
CREATE PROCEDURE `cp_check_4_salesuser`(IN `agentid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci ,IN `openid` varchar(100) charset utf8mb4 collate utf8mb4_general_ci ,OUT `result` tinyint(1) ,OUT `error` varchar(100) charset utf8mb4 collate utf8mb4_general_ci ,OUT `username` varchar(100) charset utf8mb4 collate utf8mb4_general_ci ,OUT `salesman` tinyint(1))
|
||
SQL SECURITY INVOKER
|
||
COMMENT '微信公众号用户是否存在'
|
||
begin
|
||
set result = 0;
|
||
set error = '';
|
||
set username = null;
|
||
set salesman = null;
|
||
|
||
select saus_nickname, saus_salesman into username, salesman
|
||
from sales_user where saus_agentid = agentid and saus_openid = openid;
|
||
|
||
if isnull(username) then
|
||
set result = 4;
|
||
set error = '用户不存在';
|
||
end if;
|
||
end
|
||
;;
|
||
delimiter ;
|
||
|
||
-- ----------------------------
|
||
-- Procedure structure for cp_check_5_product
|
||
-- ----------------------------
|
||
DROP PROCEDURE IF EXISTS `cp_check_5_product`;
|
||
delimiter ;;
|
||
CREATE PROCEDURE `cp_check_5_product`(IN `agentid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci ,IN `productid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci ,OUT `result` tinyint(1) ,OUT `error` varchar(100) charset utf8mb4 collate utf8mb4_general_ci ,OUT `productname` varchar(100) charset utf8mb4 collate utf8mb4_general_ci ,OUT `productamount` int(11) ,OUT `productmoney` decimal(10,2))
|
||
SQL SECURITY INVOKER
|
||
COMMENT '检验代理商是否存在'
|
||
begin
|
||
set result = 0;
|
||
set error = '';
|
||
set productname = null;
|
||
set productamount = 0;
|
||
set productmoney = 0;
|
||
|
||
select sapr_name, sapr_amount, sapr_money into productname, productamount, productmoney
|
||
from sales_product where sapr_agentid = agentid and sapr_productid = productid;
|
||
|
||
if isnull(productname) then
|
||
set result = 5;
|
||
set error = '房卡产品不存在';
|
||
end if;
|
||
end
|
||
;;
|
||
delimiter ;
|
||
|
||
-- ----------------------------
|
||
-- Procedure structure for cp_check_6_buybill
|
||
-- ----------------------------
|
||
DROP PROCEDURE IF EXISTS `cp_check_6_buybill`;
|
||
delimiter ;;
|
||
CREATE PROCEDURE `cp_check_6_buybill`(IN `agentid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci ,IN `billcode` varchar(50) charset utf8mb4 collate utf8mb4_general_ci ,OUT `result` tinyint(1) ,OUT `error` varchar(100) charset utf8mb4 collate utf8mb4_general_ci ,OUT `billtype` tinyint(1) ,OUT `playerid` int(8) ,OUT `playername` varchar(100) charset utf8mb4 collate utf8mb4_general_ci ,OUT `amount` int(11) ,OUT `money` decimal(10,2) ,OUT `paystate` tinyint(1))
|
||
SQL SECURITY INVOKER
|
||
COMMENT '检验购卡订单是否存在'
|
||
begin
|
||
set result = 0;
|
||
set error = '';
|
||
set billtype = null;
|
||
set playerid = null;
|
||
set playername = null;
|
||
set money = null;
|
||
set amount = null;
|
||
|
||
select sabu_billtype, sabu_playerid, sabu_playername, sabu_amount, sabu_money, sabu_paystate
|
||
into billtype, playerid, playername, amount, money, paystate
|
||
from sales_buybill where sabu_agentid = agentid and sabu_billcode = billcode;
|
||
|
||
if isnull(billtype) then
|
||
set result = 6;
|
||
set error = '订单不存在';
|
||
end if;
|
||
end
|
||
;;
|
||
delimiter ;
|
||
|
||
-- ----------------------------
|
||
-- Procedure structure for cp_check_7_salesman
|
||
-- ----------------------------
|
||
DROP PROCEDURE IF EXISTS `cp_check_7_salesman`;
|
||
delimiter ;;
|
||
CREATE PROCEDURE `cp_check_7_salesman`(IN `agentid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci ,IN `openid` varchar(100) charset utf8mb4 collate utf8mb4_general_ci ,OUT `result` tinyint(1) ,OUT `error` varchar(100) charset utf8mb4 collate utf8mb4_general_ci ,OUT `roomcard` int(11))
|
||
SQL SECURITY INVOKER
|
||
COMMENT '微信公众号用户是否存在'
|
||
begin
|
||
set result = 0;
|
||
set error = '';
|
||
set roomcard = null;
|
||
|
||
select saus_roomcard into roomcard
|
||
from sales_user
|
||
where saus_agentid = agentid and saus_openid = openid and saus_salesman = 1;
|
||
|
||
if isnull(roomcard) then
|
||
set result = 7;
|
||
set error = '不是个人代理';
|
||
end if;
|
||
end
|
||
;;
|
||
delimiter ;
|
||
|
||
-- ----------------------------
|
||
-- Procedure structure for cp_check_8_task
|
||
-- ----------------------------
|
||
DROP PROCEDURE IF EXISTS `cp_check_8_task`;
|
||
delimiter ;;
|
||
CREATE PROCEDURE `cp_check_8_task`(IN `agentid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci ,IN `taskid` varchar(100) charset utf8mb4 collate utf8mb4_general_ci ,OUT `result` tinyint(1) ,OUT `error` varchar(100) charset utf8mb4 collate utf8mb4_general_ci ,OUT `tasktype` tinyint(1) ,OUT `total` int(8) ,OUT `award` int(8))
|
||
SQL SECURITY INVOKER
|
||
COMMENT '任务是否存在和有效'
|
||
begin
|
||
set result = 0;
|
||
set error = '';
|
||
set award = null;
|
||
|
||
select task_type, task_total, task_award into tasktype, total, award
|
||
from task
|
||
where task_agentid = agentid
|
||
and task_taskid = taskid
|
||
and ((task_type = 0)
|
||
or ((task_type = 1) and
|
||
(task_begintime is null or now() >= task_begintime) and
|
||
(task_endtime is null or now() <= task_endtime)
|
||
)
|
||
or (task_type = 2)
|
||
or (task_type = 3)
|
||
);
|
||
|
||
if isnull(award) then
|
||
set result = 8;
|
||
set error = '任务不存在或已过期';
|
||
end if;
|
||
end
|
||
;;
|
||
delimiter ;
|
||
|
||
-- ----------------------------
|
||
-- Procedure structure for cp_check_9_salesman
|
||
-- ----------------------------
|
||
DROP PROCEDURE IF EXISTS `cp_check_9_salesman`;
|
||
delimiter ;;
|
||
CREATE PROCEDURE `cp_check_9_salesman`(IN `agentid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci ,IN `salesid` int(8) ,OUT `result` tinyint(1) ,OUT `error` varchar(100) charset utf8mb4 collate utf8mb4_general_ci ,OUT `salesname` varchar(100) charset utf8mb4 collate utf8mb4_general_ci ,OUT `roomcard` int(11))
|
||
SQL SECURITY INVOKER
|
||
COMMENT '个人代理是否存在'
|
||
begin
|
||
set result = 0;
|
||
set error = '';
|
||
set salesname = null;
|
||
set roomcard = null;
|
||
|
||
select saus_nickname, saus_roomcard into salesname, roomcard
|
||
from sales_user
|
||
where saus_agentid = agentid and saus_salesid = salesid and saus_salesman = 1;
|
||
|
||
if isnull(roomcard) then
|
||
set result = 9;
|
||
set error = '代理id不存在';
|
||
end if;
|
||
end
|
||
;;
|
||
delimiter ;
|
||
|
||
-- ----------------------------
|
||
-- Procedure structure for cp_game_binding_invitecode
|
||
-- ----------------------------
|
||
DROP PROCEDURE IF EXISTS `cp_game_binding_invitecode`;
|
||
delimiter ;;
|
||
CREATE PROCEDURE `cp_game_binding_invitecode`(IN `agentid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci ,IN `playerid` int(8) ,IN `invitecode` int(8))
|
||
SQL SECURITY INVOKER
|
||
COMMENT '玩家登录游戏记录地理位置'
|
||
label_cp: begin
|
||
declare result tinyint(1); -- 0:成功 >0:失败
|
||
declare error varchar(100); -- 失败描述
|
||
declare agentname varchar(100); -- 代理商名称
|
||
declare playerchannelid varchar(32); -- 渠道商id
|
||
declare playerunionid varchar(50); -- 玩家的unionid
|
||
declare playername varchar(100); -- 玩家昵称
|
||
declare playerroomcard int(11); -- 玩家房卡数量
|
||
declare salesid int(8); -- 邀请码对应的代理id
|
||
declare _invitecode int(8); -- 已经绑定的邀请码
|
||
|
||
set result = 0;
|
||
|
||
-- 检验agentid
|
||
call cp_check_1_agent(agentid, result, error, agentname);
|
||
if result > 0 then
|
||
select result, error;
|
||
leave label_cp;
|
||
end if;
|
||
|
||
-- 检验playerid
|
||
call cp_check_2_player(agentid, playerid, result, error, playername, playerroomcard);
|
||
if result > 0 then
|
||
select result, error;
|
||
leave label_cp;
|
||
end if;
|
||
|
||
-- 检验邀请码
|
||
if not exists(select 1 from sales_user where saus_agentid = agentid and saus_salesid = invitecode and saus_salesman = 1) then
|
||
set result = 10;
|
||
set error = '邀请码不存在';
|
||
select result, error;
|
||
leave label_cp;
|
||
end if;
|
||
|
||
-- 检查是否已经绑定了邀请码
|
||
select play_invitecode into _invitecode
|
||
from player
|
||
where play_agentid = agentid
|
||
and play_playerid = playerid;
|
||
|
||
if isnull(_invitecode) then
|
||
update player set play_invitecode = invitecode
|
||
where play_agentid = agentid
|
||
and play_playerid = playerid;
|
||
|
||
-- 完成绑定邀请码任务
|
||
call cp_game_task_finish(agentid, playerid, 'UEFsfbv29YnlacKLo0mjomK48Bv82hGv', 1, 0);
|
||
|
||
set result = 0;
|
||
set error = '绑定邀请码成功';
|
||
|
||
select play_channelid, play_unionid into playerchannelid, playerunionid
|
||
from player
|
||
where play_agentid = agentid
|
||
and play_playerid = playerid;
|
||
|
||
insert into ct_user_process_log(uspl_agentid, uspl_channelid, uspl_playerid, uspl_unionid, uspl_opt, uspl_optdata, uspl_opttime)
|
||
values(agentid, playerchannelid, playerid, playerunionid, 2, invitecode, now());
|
||
else
|
||
set result = 21;
|
||
set error = '已经绑定过邀请码,不能再次绑定';
|
||
end if;
|
||
|
||
select result, error;
|
||
end
|
||
;;
|
||
delimiter ;
|
||
|
||
-- ----------------------------
|
||
-- Procedure structure for cp_game_deduct_roomcard
|
||
-- ----------------------------
|
||
DROP PROCEDURE IF EXISTS `cp_game_deduct_roomcard`;
|
||
delimiter ;;
|
||
CREATE PROCEDURE `cp_game_deduct_roomcard`(IN `agentid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci ,IN `playerid` int(8) ,IN `deduct` int(8) ,IN `gameid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci)
|
||
SQL SECURITY INVOKER
|
||
COMMENT '第一小局结算后扣除房主开房所需的房卡'
|
||
begin
|
||
declare error int default 0;
|
||
|
||
-- 如果出现异常也继续执行
|
||
declare continue handler for sqlexception set error = 1;
|
||
|
||
-- 启动事务
|
||
start transaction;
|
||
|
||
if deduct > 0 then
|
||
update player set play_roomcard = play_roomcard - deduct,
|
||
play_usecard = play_usecard + deduct
|
||
where play_agentid = agentid
|
||
and play_playerid = playerid;
|
||
|
||
update agent_game_player set agpl_usecard = agpl_usecard + deduct
|
||
where agpl_agentid = agentid
|
||
and agpl_gameid = gameid
|
||
and agpl_playerid = playerid;
|
||
|
||
-- 按日期统计房卡消耗数量
|
||
call cp_report_game_day(agentid, gameid, now(), 1, deduct, null);
|
||
end if;
|
||
|
||
-- 运行没有异常,提交事务
|
||
if error = 1 then
|
||
rollback;
|
||
else
|
||
commit;
|
||
end if;
|
||
|
||
select playerid, play_roomcard as roomcard, deduct
|
||
from player
|
||
where play_agentid = agentid and play_playerid = playerid;
|
||
end
|
||
;;
|
||
delimiter ;
|
||
|
||
-- ----------------------------
|
||
-- Procedure structure for cp_game_del_timeout_task
|
||
-- ----------------------------
|
||
DROP PROCEDURE IF EXISTS `cp_game_del_timeout_task`;
|
||
delimiter ;;
|
||
CREATE PROCEDURE `cp_game_del_timeout_task`(IN `agentid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci)
|
||
SQL SECURITY INVOKER
|
||
COMMENT '删除过期任务'
|
||
begin
|
||
if isnull(agentid) then
|
||
delete task_player
|
||
from task_player, task
|
||
where task_agentid = tapl_agentid
|
||
and task_taskid = tapl_taskid
|
||
-- 每日任务
|
||
and ((task_type = 0 and datediff(tapl_createtime, curdate()) <> 0)
|
||
-- 限时任务
|
||
or (task_type = 1 and ((task_begintime is not null and tapl_createtime < task_begintime)
|
||
or (task_endtime is not null and tapl_createtime > task_endtime)
|
||
)
|
||
)
|
||
);
|
||
else
|
||
-- 删除所有人的过期任务
|
||
delete task_player
|
||
from task_player, task
|
||
where tapl_agentid = agentid
|
||
and task_agentid = agentid
|
||
and task_taskid = tapl_taskid
|
||
-- 每日任务
|
||
and ((task_type = 0 and datediff(tapl_createtime, curdate()) <> 0)
|
||
-- 限时任务
|
||
or (task_type = 1 and ((task_begintime is not null and tapl_createtime < task_begintime)
|
||
or (task_endtime is not null and tapl_createtime > task_endtime)
|
||
)
|
||
)
|
||
);
|
||
end if;
|
||
end
|
||
;;
|
||
delimiter ;
|
||
|
||
-- ----------------------------
|
||
-- Procedure structure for cp_game_get_player_invitecode
|
||
-- ----------------------------
|
||
DROP PROCEDURE IF EXISTS `cp_game_get_player_invitecode`;
|
||
delimiter ;;
|
||
CREATE PROCEDURE `cp_game_get_player_invitecode`(IN `agentid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci ,IN `playerid` int(8) ,IN `unionid` varchar(100) charset utf8mb4 collate utf8mb4_general_ci)
|
||
SQL SECURITY INVOKER
|
||
COMMENT '获取玩家绑定的邀请码'
|
||
begin
|
||
declare invitecode int(8);
|
||
|
||
select play_invitecode into invitecode
|
||
from player
|
||
where play_agentid = agentid
|
||
and play_playerid = playerid;
|
||
|
||
if isnull(invitecode) then
|
||
call cp_game_get_player_invitecode_insales(agentid, playerid, unionid, invitecode);
|
||
end if;
|
||
|
||
select invitecode;
|
||
end
|
||
;;
|
||
delimiter ;
|
||
|
||
-- ----------------------------
|
||
-- Procedure structure for cp_game_get_player_invitecode_insales
|
||
-- ----------------------------
|
||
DROP PROCEDURE IF EXISTS `cp_game_get_player_invitecode_insales`;
|
||
delimiter ;;
|
||
CREATE PROCEDURE `cp_game_get_player_invitecode_insales`(IN `agentid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci ,IN `playerid` int(8) ,IN `unionid` varchar(100) charset utf8mb4 collate utf8mb4_general_ci ,OUT `invitecode` int(8))
|
||
SQL SECURITY INVOKER
|
||
COMMENT '获取玩家绑定的邀请码'
|
||
begin
|
||
-- 看是否自动绑定过邀请码
|
||
if isnull(invitecode) then
|
||
select saus_invitecode into invitecode
|
||
from sales_user
|
||
where saus_agentid = agentid
|
||
and saus_unionid = unionid;
|
||
|
||
if not isnull(invitecode) then
|
||
update player set play_invitecode = invitecode
|
||
where play_agentid = agentid
|
||
and play_playerid = playerid;
|
||
|
||
-- 完成绑定邀请码任务
|
||
call cp_game_task_finish(agentid, playerid, 'UEFsfbv29YnlacKLo0mjomK48Bv82hGv', 1, 0);
|
||
end if;
|
||
end if;
|
||
end
|
||
;;
|
||
delimiter ;
|
||
|
||
-- ----------------------------
|
||
-- Procedure structure for cp_game_get_player_taskstate
|
||
-- ----------------------------
|
||
DROP PROCEDURE IF EXISTS `cp_game_get_player_taskstate`;
|
||
delimiter ;;
|
||
CREATE PROCEDURE `cp_game_get_player_taskstate`(IN `agentid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci ,IN `playerid` int(8) ,OUT `taskstate` tinyint(1))
|
||
SQL SECURITY INVOKER
|
||
COMMENT '删除过期任务,获取玩家当天的任务状态'
|
||
begin
|
||
-- 获取玩家的任务状态
|
||
set taskstate = 0;
|
||
|
||
if exists(select 1 from task_player
|
||
where tapl_agentid = agentid
|
||
and tapl_playerid = playerid
|
||
and tapl_state = 1
|
||
) then
|
||
-- 有任务已完成可领取奖励
|
||
set taskstate = 2;
|
||
elseif exists(select 1 from task
|
||
where task_agentid = agentid
|
||
and ((task_type = 0)
|
||
or (task_type = 1 and
|
||
(task_begintime is null or now() >= task_begintime) and
|
||
(task_endtime is null or now() <= task_endtime)
|
||
)
|
||
)
|
||
and not exists(select 1 from task_player
|
||
where tapl_agentid = agentid
|
||
and tapl_playerid = playerid
|
||
and tapl_taskid = task_taskid)
|
||
) then
|
||
-- 有任务未完成
|
||
set taskstate = 1;
|
||
elseif exists(select 1 from task_player, task
|
||
where tapl_agentid = agentid
|
||
and tapl_playerid = playerid
|
||
and tapl_state = 0
|
||
and task_agentid = agentid
|
||
and task_taskid = tapl_taskid
|
||
and task_type in (0, 1)
|
||
) then
|
||
-- 有任务未完成
|
||
set taskstate = 1;
|
||
end if;
|
||
end
|
||
;;
|
||
delimiter ;
|
||
|
||
-- ----------------------------
|
||
-- Procedure structure for cp_game_grade_del
|
||
-- ----------------------------
|
||
DROP PROCEDURE IF EXISTS `cp_game_grade_del`;
|
||
delimiter ;;
|
||
CREATE PROCEDURE `cp_game_grade_del`()
|
||
SQL SECURITY INVOKER
|
||
COMMENT '删除超时战绩'
|
||
begin
|
||
-- 删除24小时之前的战绩记录
|
||
delete from player_grade
|
||
where (unix_timestamp(now()) - unix_timestamp(plgr_makewartime)) > 24 * 60 * 60;
|
||
end
|
||
;;
|
||
delimiter ;
|
||
|
||
-- ----------------------------
|
||
-- Procedure structure for cp_game_grade_get1
|
||
-- ----------------------------
|
||
DROP PROCEDURE IF EXISTS `cp_game_grade_get1`;
|
||
delimiter ;;
|
||
CREATE PROCEDURE `cp_game_grade_get1`(IN `agentid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci ,IN `playerid` int(8) ,IN `gameid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci)
|
||
SQL SECURITY INVOKER
|
||
COMMENT '获取战绩gameinfo1'
|
||
begin
|
||
-- 获取最近10条战绩记录
|
||
select idx, plgr_roomcode as roomcode, plgr_roomtype as roomtype,
|
||
DATE_FORMAT(plgr_createtime, "%m.%d %H:%i") as createtime,
|
||
DATE_FORMAT(plgr_makewartime,"%m.%d %H:%i") as makewartime,
|
||
DATE_FORMAT(plgr_overtime,"%m.%d %H:%i") as overtime,
|
||
plgr_gameinfo1 as gameinfo1
|
||
from player_grade
|
||
where plgr_agentid = agentid
|
||
and plgr_playerid = playerid
|
||
and plgr_gameid = gameid
|
||
order by idx desc
|
||
limit 10;
|
||
end
|
||
;;
|
||
delimiter ;
|
||
|
||
-- ----------------------------
|
||
-- Procedure structure for cp_game_grade_get2
|
||
-- ----------------------------
|
||
DROP PROCEDURE IF EXISTS `cp_game_grade_get2`;
|
||
delimiter ;;
|
||
CREATE PROCEDURE `cp_game_grade_get2`(IN `agentid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci ,IN `playerid` int(8) ,IN `gameid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci ,IN `gradeidx` int(11))
|
||
SQL SECURITY INVOKER
|
||
COMMENT '获取战绩gameinfo1'
|
||
begin
|
||
select plgr_roomtype as roomtype, plgr_gameinfo2 as gameinfo2
|
||
from player_grade
|
||
where plgr_agentid = agentid
|
||
and plgr_playerid = playerid
|
||
and plgr_gameid = gameid
|
||
and idx = gradeidx;
|
||
end
|
||
;;
|
||
delimiter ;
|
||
|
||
-- ----------------------------
|
||
-- Procedure structure for cp_game_grade_save
|
||
-- ----------------------------
|
||
DROP PROCEDURE IF EXISTS `cp_game_grade_save`;
|
||
delimiter ;;
|
||
CREATE PROCEDURE `cp_game_grade_save`(IN `agentid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci ,IN `playerids` varchar(100) charset utf8mb4 collate utf8mb4_general_ci ,IN `gameid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci ,IN `roomcode` int(8) ,IN `roomtype` varchar(200) charset utf8mb4 collate utf8mb4_general_ci ,IN `createtime` datetime ,IN `makewartime` datetime ,IN `overtime` datetime ,IN `gameinfo1` varchar(10000) charset utf8mb4 collate utf8mb4_general_ci ,IN `gameinfo2` mediumtext charset utf8mb4 collate utf8mb4_general_ci ,IN `ownerid` int(8) ,IN `grades` varchar(100) charset utf8mb4 collate utf8mb4_general_ci)
|
||
SQL SECURITY INVOKER
|
||
COMMENT '保存战绩'
|
||
begin
|
||
declare ary_playerid varchar(100);
|
||
declare ary_grade varchar(100);
|
||
declare pos_playerid int(10);
|
||
declare pos_grade int(10);
|
||
declare playerid varchar(8);
|
||
declare grade varchar(8);
|
||
|
||
-- 如果出现异常,自动退出并rollback
|
||
declare exit handler for sqlexception ROLLBACK;
|
||
|
||
-- 启动事务
|
||
start transaction;
|
||
|
||
set ary_playerid = playerids;
|
||
set ary_grade = grades;
|
||
while ary_playerid <> '' do
|
||
set pos_playerid = instr(ary_playerid, ',');
|
||
set pos_grade = instr(ary_grade, ',');
|
||
if pos_playerid = 0 then
|
||
set playerid = ary_playerid;
|
||
set grade = ary_grade;
|
||
set ary_playerid = '';
|
||
set ary_grade = '';
|
||
else
|
||
set playerid = left(ary_playerid, pos_playerid - 1);
|
||
set grade = left(ary_grade, pos_grade - 1);
|
||
set ary_playerid = right(ary_playerid, length(ary_playerid) - pos_playerid);
|
||
set ary_grade = right(ary_grade, length(ary_grade) - pos_grade);
|
||
end if;
|
||
|
||
-- 保留最近9条战绩记录
|
||
/*
|
||
delete from player_grade
|
||
where plgr_agentid = agentid
|
||
and plgr_playerid = playerid
|
||
and plgr_gameid = gameid
|
||
and idx < (select min(b.idx)
|
||
from (select g2.idx
|
||
from player_grade g2
|
||
where g2.plgr_agentid = agentid
|
||
and g2.plgr_playerid = playerid
|
||
and g2.plgr_gameid = gameid
|
||
order by g2.idx
|
||
desc limit 10
|
||
) as b
|
||
);
|
||
*/
|
||
|
||
-- 保存当前战绩
|
||
/*
|
||
insert into player_grade(plgr_agentid, plgr_playerid, plgr_gameid,
|
||
plgr_roomcode, plgr_roomtype, plgr_createtime, plgr_makewartime,
|
||
plgr_overtime, plgr_gameinfo1, plgr_gameinfo2)
|
||
values(agentid, playerid, gameid, roomcode, roomtype, createtime, makewartime,
|
||
overtime, gameinfo1, gameinfo2);
|
||
*/
|
||
|
||
-- 累计游戏局数(大局)
|
||
update agent_game_player
|
||
set agpl_playset = agpl_playset + 1,
|
||
agpl_winlose = agpl_winlose + grade
|
||
where agpl_agentid = agentid
|
||
and agpl_gameid = gameid
|
||
and agpl_playerid = playerid;
|
||
|
||
-- 统计房主的邀请新人奖励
|
||
if ownerid <> playerid then
|
||
if exists(select 1 from agent_game_player
|
||
where agpl_agentid = agentid
|
||
and agpl_gameid = gameid
|
||
and agpl_playerid = playerid
|
||
and agpl_playset = 1) then
|
||
call cp_game_task_finish(agentid, ownerid, 'ZVlpZweovbeQ68g8xdjcxaXHfbfIvvu7', 1, 0);
|
||
end if;
|
||
|
||
-- 累加积分(玩一局积分加1)
|
||
/*
|
||
update player set play_score = play_score + 1
|
||
where play_agentid = agentid
|
||
and play_playerid = playerid;
|
||
else
|
||
-- 累加积分(开房积分加2)
|
||
update player set play_score = play_score + 3
|
||
where play_agentid = agentid
|
||
and play_playerid = playerid;
|
||
*/
|
||
end if;
|
||
end while;
|
||
|
||
-- 按日期统计玩家一共玩了多少游戏局(大局)
|
||
call cp_report_game_day(agentid, gameid, now(), 2, 1, null);
|
||
|
||
-- 运行没有异常,提交事务
|
||
commit;
|
||
end
|
||
;;
|
||
delimiter ;
|
||
|
||
-- ----------------------------
|
||
-- Procedure structure for cp_game_grade_save2
|
||
-- ----------------------------
|
||
DROP PROCEDURE IF EXISTS `cp_game_grade_save2`;
|
||
delimiter ;;
|
||
CREATE PROCEDURE `cp_game_grade_save2`(IN `agentid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci ,IN `playerids` varchar(100) charset utf8mb4 collate utf8mb4_general_ci ,IN `gameid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci ,IN `roomcode` int(8) ,IN `roomtype` varchar(200) charset utf8mb4 collate utf8mb4_general_ci ,IN `createtime` datetime ,IN `makewartime` datetime ,IN `overtime` datetime ,IN `gameinfo1` varchar(10000) charset utf8mb4 collate utf8mb4_general_ci ,IN `gameinfo2` mediumtext charset utf8mb4 collate utf8mb4_general_ci ,IN `ownerid` int(8) ,IN `grades` varchar(100) charset utf8mb4 collate utf8mb4_general_ci)
|
||
SQL SECURITY INVOKER
|
||
COMMENT '保存战绩'
|
||
begin
|
||
declare ary_playerid varchar(100);
|
||
declare pos_playerid int(10);
|
||
declare playerid varchar(8);
|
||
|
||
set ary_playerid = playerids;
|
||
while ary_playerid <> '' do
|
||
set pos_playerid = instr(ary_playerid, ',');
|
||
if pos_playerid = 0 then
|
||
set playerid = ary_playerid;
|
||
set ary_playerid = '';
|
||
else
|
||
set playerid = left(ary_playerid, pos_playerid - 1);
|
||
set ary_playerid = right(ary_playerid, length(ary_playerid) - pos_playerid);
|
||
end if;
|
||
|
||
-- 保存当前战绩
|
||
insert into player_grade(plgr_agentid, plgr_playerid, plgr_gameid,
|
||
plgr_roomcode, plgr_roomtype, plgr_createtime, plgr_makewartime,
|
||
plgr_overtime, plgr_gameinfo1, plgr_gameinfo2)
|
||
values(agentid, playerid, gameid, roomcode, roomtype, createtime, makewartime,
|
||
overtime, gameinfo1, gameinfo2);
|
||
end while;
|
||
end
|
||
;;
|
||
delimiter ;
|
||
|
||
-- ----------------------------
|
||
-- Procedure structure for cp_game_login_location
|
||
-- ----------------------------
|
||
DROP PROCEDURE IF EXISTS `cp_game_login_location`;
|
||
delimiter ;;
|
||
CREATE PROCEDURE `cp_game_login_location`(IN `agentid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci ,IN `playerid` int(8) ,IN `country` varchar(100) charset utf8mb4 collate utf8mb4_general_ci ,IN `province` varchar(100) charset utf8mb4 collate utf8mb4_general_ci ,IN `city` varchar(100) charset utf8mb4 collate utf8mb4_general_ci ,IN `citycode` varchar(20) charset utf8mb4 collate utf8mb4_general_ci ,IN `district` varchar(100) charset utf8mb4 collate utf8mb4_general_ci ,IN `street` varchar(100) charset utf8mb4 collate utf8mb4_general_ci ,IN `address` varchar(200) charset utf8mb4 collate utf8mb4_general_ci ,IN `latitude` varchar(20) charset utf8mb4 collate utf8mb4_general_ci ,IN `longitude` varchar(20) charset utf8mb4 collate utf8mb4_general_ci)
|
||
SQL SECURITY INVOKER
|
||
COMMENT '玩家登录游戏记录地理位置'
|
||
begin
|
||
declare _channelid varchar(32); -- 玩家所属的渠道id
|
||
declare _citycode varchar(20); -- 已记录的城市编号
|
||
declare _invitecode int(8); -- 已绑定的邀请码
|
||
|
||
declare city_wechatgzh varchar(100); -- 城市公众号
|
||
declare city_wechatewm varchar(100); -- 城市公众号二维码图片地址
|
||
declare city_wechatkfh varchar(50); -- 城市客服微信
|
||
declare city_qq varchar(50); -- 城市客服QQ
|
||
declare city_tel varchar(50); -- 城市客服电话
|
||
|
||
select play_channelid, play_a_citycode, play_invitecode
|
||
into _channelid, _citycode, _invitecode
|
||
from player
|
||
where play_agentid = agentid
|
||
and play_playerid = playerid;
|
||
|
||
if isnull(_citycode) then
|
||
-- 记录第一次登录时的城市
|
||
update player set play_a_country = country, play_a_province = province,
|
||
play_a_city = city, play_a_citycode = citycode,
|
||
play_a_district = district, play_a_street = street,
|
||
play_a_address = address
|
||
where play_agentid = agentid
|
||
and play_playerid = playerid;
|
||
|
||
-- 获取城市的联系方式
|
||
select agcc_WechatPublicNo, agcc_wechat_ewm, agcc_service_wechat, agcc_service_qq, agcc_service_tel
|
||
into city_wechatgzh, city_wechatewm, city_wechatkfh, city_qq, city_tel
|
||
from agent_channel_city
|
||
where agcc_agentid = agentid
|
||
and agcc_channelid = _channelid
|
||
and agcc_citycode = citycode;
|
||
end if;
|
||
|
||
if isnull(_invitecode) then
|
||
-- 自动绑定邀请码
|
||
select ifnull(agcc_invitecode, agch_invitecode)
|
||
into _invitecode
|
||
from agent_channel, agent_channel_city
|
||
where agch_agentid = agentid
|
||
and agch_channelid = _channelid
|
||
and agcc_agentid = agentid
|
||
and agcc_channelid = _channelid
|
||
and agcc_citycode = citycode;
|
||
|
||
if not isnull(_invitecode) then
|
||
update player set play_invitecode = _invitecode
|
||
where play_agentid = agentid
|
||
and play_playerid = playerid;
|
||
|
||
-- 完成绑定邀请码任务
|
||
call cp_game_task_finish(agentid, playerid, 'UEFsfbv29YnlacKLo0mjomK48Bv82hGv', 1, 0);
|
||
end if;
|
||
end if;
|
||
|
||
select city_wechatgzh as wechatgzh, city_wechatewm as wechatewm,
|
||
city_wechatkfh as wechatkfh, city_qq as qq, city_tel as tel,
|
||
_invitecode as invitecode;
|
||
end
|
||
;;
|
||
delimiter ;
|
||
|
||
-- ----------------------------
|
||
-- Procedure structure for cp_game_pay_succ
|
||
-- ----------------------------
|
||
DROP PROCEDURE IF EXISTS `cp_game_pay_succ`;
|
||
delimiter ;;
|
||
CREATE PROCEDURE `cp_game_pay_succ`(IN `agentid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci ,IN `channelid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci ,IN `playerid` int(8) ,IN `billcode` varchar(50) charset utf8mb4 collate utf8mb4_general_ci ,IN `productid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci ,IN `payid` varchar(100) charset utf8mb4 collate utf8mb4_general_ci ,IN `amount` int(11) ,IN `money` decimal(10,2) ,IN `createtime` datetime ,IN `paymoney` decimal(10,2) ,IN `paytime` datetime ,IN `paytype` tinyint(1) ,IN `transid` varchar(100) charset utf8mb4 collate utf8mb4_general_ci ,IN `outtradeNo` varchar(100) charset utf8mb4 collate utf8mb4_general_ci)
|
||
SQL SECURITY INVOKER
|
||
COMMENT '游戏中支付成功'
|
||
label_cp: begin
|
||
declare result tinyint(1); -- 0:成功 >0:失败
|
||
declare error varchar(100); -- 失败描述
|
||
declare agentname varchar(100); -- 代理商名称
|
||
declare playername varchar(100); -- 玩家昵称
|
||
declare playerroomcard int(11); -- 玩家房卡数量
|
||
declare roomcard int(11); -- 购卡后房卡数量
|
||
|
||
set result = 0;
|
||
|
||
-- 检验agentid
|
||
call cp_check_1_agent(agentid, result, error, agentname);
|
||
if result > 0 then
|
||
select result, error;
|
||
leave label_cp;
|
||
end if;
|
||
|
||
-- 检验playerid
|
||
call cp_check_2_player(agentid, playerid, result, error, playername, playerroomcard);
|
||
if result > 0 then
|
||
select result, error;
|
||
leave label_cp;
|
||
end if;
|
||
|
||
-- 获取渠道商id
|
||
if not exists (select 1 from agent_channel where agch_agentid = agentid and agch_channelid = channelid) then
|
||
select agch_channelid into channelid from agent_channel where agch_agentid = agentid order by idx limit 1;
|
||
end if;
|
||
|
||
-- 保存订单
|
||
insert into game_buybill(gabu_agentid, gabu_playerid, gabu_channelid,
|
||
gabu_billcode, gabu_productid, gabu_payid,
|
||
gabu_amount, gabu_money, gabu_createtime,
|
||
gabu_paystate, gabu_paymoney, gabu_paytime,
|
||
gabu_paytype, gabu_transid, gabu_outtradeNo)
|
||
values(agentid, playerid, channelid, billcode, productid, payid, amount, money,
|
||
createtime, 1, paymoney, paytime, paytype, transid, outtradeNo);
|
||
|
||
-- 统计总流水
|
||
update agent set agen_selftotal = agen_selftotal + paymoney where agen_agentid = agentid;
|
||
|
||
-- 按日期统计房卡销售金额
|
||
call cp_report_agent_day(agentid, 3, paymoney);
|
||
|
||
-- 修改玩家房卡数量
|
||
update player set play_roomcard = play_roomcard + amount
|
||
where play_agentid = agentid and play_playerid = playerid;
|
||
|
||
-- 返回玩家购卡后的房卡数量
|
||
select play_roomcard into roomcard from player
|
||
where play_agentid = agentid and play_playerid = playerid;
|
||
|
||
-- 返回执行结果
|
||
select result, error, playerid, playername, amount, roomcard;
|
||
end
|
||
;;
|
||
delimiter ;
|
||
|
||
-- ----------------------------
|
||
-- Procedure structure for cp_game_player_login
|
||
-- ----------------------------
|
||
DROP PROCEDURE IF EXISTS `cp_game_player_login`;
|
||
delimiter ;;
|
||
CREATE PROCEDURE `cp_game_player_login`(IN `agentid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci ,IN `channelid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci ,IN `gameid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci ,IN `openid` varchar(100) charset utf8mb4 collate utf8mb4_general_ci ,IN `unionid` varchar(100) charset utf8mb4 collate utf8mb4_general_ci ,IN `nickname` varchar(100) charset utf8mb4 collate utf8mb4_general_ci ,IN `avatar` varchar(200) charset utf8mb4 collate utf8mb4_general_ci ,IN `sex` int(11) ,IN `province` varchar(100) charset utf8mb4 collate utf8mb4_general_ci ,IN `city` varchar(100) charset utf8mb4 collate utf8mb4_general_ci)
|
||
SQL SECURITY INVOKER
|
||
COMMENT '玩家登录游戏'
|
||
begin
|
||
declare playerid int(8); -- 玩家id
|
||
declare roomcard int(11); -- 玩家房卡数量
|
||
declare bean int(11); -- 玩家元宝数量
|
||
declare playertype int(1); -- 玩家类型
|
||
declare score int(11); -- 积分
|
||
declare invitecode int(8); -- 绑定的邀请码
|
||
declare optdata varchar(2000);
|
||
|
||
-- 如果出现异常,自动退出并rollback
|
||
declare exit handler for sqlexception ROLLBACK;
|
||
|
||
-- 启动事务
|
||
start transaction;
|
||
|
||
-- 检查是否是新玩家
|
||
select play_playerid, play_roomcard, play_bean, play_type, play_score, play_invitecode
|
||
into playerid, roomcard, bean, playertype, score, invitecode
|
||
from player
|
||
where play_agentid = agentid
|
||
and play_unionid = unionid;
|
||
|
||
if isnull(playerid) then
|
||
-- 新玩家
|
||
update agent set agen_maxplayerid = agen_maxplayerid + 1 where agen_agentid = agentid;
|
||
|
||
select agen_maxplayerid into playerid from agent where agen_agentid = agentid;
|
||
|
||
insert into player(play_agentid, play_playerid, play_channelid, play_openid,
|
||
play_unionid, play_nickname, play_avatar, play_sex,
|
||
play_province, play_city, play_regtime, play_lasttime)
|
||
values(agentid, playerid, channelid, openid, unionid, nickname, avatar, sex, province, city, now(), now());
|
||
|
||
set optdata = CONCAT('{"openid":"', openid, '", "unionid":"', unionid, '", "nickname":"', ifnull(nickname, ''), '","avatar":"', ifnull(avatar, ''), '","sex":', ifnull(sex, 0), ',"province":"', ifnull(province, ''), '","city":"', ifnull(city, ''), '"}');
|
||
insert into ct_user_process_log(uspl_agentid, uspl_channelid, uspl_playerid, uspl_unionid, uspl_opt, uspl_optdata, uspl_opttime)
|
||
values(agentid, channelid, playerid, unionid, 1, optdata, now());
|
||
|
||
select play_roomcard, play_bean, play_type, play_score, play_invitecode
|
||
into roomcard, bean, playertype, score, invitecode
|
||
from player
|
||
where play_agentid = agentid
|
||
and play_playerid = playerid;
|
||
|
||
-- 按日期统计新增玩家数量
|
||
call cp_report_agent_day(agentid, 0, 1);
|
||
else
|
||
-- 老玩家
|
||
update player set play_nickname = nickname, play_avatar = avatar, play_openid = openid,
|
||
play_sex = sex, play_province = province, play_city = city,
|
||
play_logindate = play_logindate + if(datediff(now(), play_lasttime) = 0, 0, 1),
|
||
play_lasttime = now()
|
||
where play_agentid = agentid
|
||
and play_playerid = playerid;
|
||
end if;
|
||
|
||
-- 统计玩家的最后登录时间和累积登录天数
|
||
if not exists(select 1 from agent_game_player
|
||
where agpl_agentid = agentid
|
||
and agpl_gameid = gameid
|
||
and agpl_playerid = playerid) then
|
||
insert into agent_game_player(agpl_agentid, agpl_gameid, agpl_playerid, agpl_openid, agpl_firsttime, agpl_lasttime)
|
||
values(agentid, gameid, playerid, openid, now(), now());
|
||
|
||
-- 按日期统计新增玩家数量
|
||
call cp_report_game_day(agentid, gameid, now(), 0, 1, null);
|
||
else
|
||
update agent_game_player set agpl_logindate = agpl_logindate + if(datediff(now(), agpl_lasttime) = 0, 0, 1),
|
||
agpl_lasttime = now()
|
||
where agpl_agentid = agentid
|
||
and agpl_gameid = gameid
|
||
and agpl_playerid = playerid;
|
||
end if;
|
||
|
||
-- 看是否自动绑定过邀请码
|
||
if isnull(invitecode) then
|
||
call cp_game_get_player_invitecode_insales(agentid, playerid, unionid, invitecode);
|
||
end if;
|
||
|
||
-- 运行没有异常,提交事务
|
||
commit;
|
||
|
||
-- 返回执行结果
|
||
select playerid, roomcard, bean, playertype, score, invitecode;
|
||
end
|
||
;;
|
||
delimiter ;
|
||
|
||
-- ----------------------------
|
||
-- Procedure structure for cp_game_task_award
|
||
-- ----------------------------
|
||
DROP PROCEDURE IF EXISTS `cp_game_task_award`;
|
||
delimiter ;;
|
||
CREATE PROCEDURE `cp_game_task_award`(IN `agentid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci ,IN `playerid` int(8) ,IN `taskid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci)
|
||
SQL SECURITY INVOKER
|
||
COMMENT '玩家领取任务奖励'
|
||
label_cp: begin
|
||
declare result tinyint(1); -- 0:成功 >0:失败
|
||
declare error varchar(100); -- 失败描述
|
||
declare agentname varchar(100); -- 代理商名称
|
||
declare playername varchar(100); -- 玩家昵称
|
||
declare playerroomcard int(11); -- 玩家房卡数量
|
||
declare tasktype tinyint(1); -- 任务类型
|
||
declare tasktotal int(8); -- 任务的任务总量
|
||
declare taskaward int(8); -- 任务的完成奖励
|
||
declare taskstate tinyint(1) default null; -- 当前任务的任务状态
|
||
declare playertaskstate tinyint(1); -- 玩家总的任务状态
|
||
|
||
set result = 0;
|
||
-- 检验agentid
|
||
call cp_check_1_agent(agentid, result, error, agentname);
|
||
if result > 0 then
|
||
select result, error;
|
||
leave label_cp;
|
||
end if;
|
||
|
||
-- 检验playerid
|
||
call cp_check_2_player(agentid, playerid, result, error, playername, playerroomcard);
|
||
if result > 0 then
|
||
select result, error;
|
||
leave label_cp;
|
||
end if;
|
||
|
||
-- 检验taskid
|
||
call cp_check_8_task(agentid, taskid, result, error, tasktype, tasktotal, taskaward);
|
||
if result > 0 then
|
||
select result, error;
|
||
leave label_cp;
|
||
end if;
|
||
|
||
-- 检查任务是否完成
|
||
select tapl_state into taskstate from task_player
|
||
where tapl_agentid = agentid and tapl_playerid = playerid and tapl_taskid = taskid;
|
||
|
||
if ifnull(taskstate, 0) = 0 then
|
||
set result = 8;
|
||
set error = '任务未完成,不可领取奖励';
|
||
select result, error;
|
||
leave label_cp;
|
||
end if;
|
||
|
||
if ifnull(taskstate, 0) = 2 then
|
||
set result = 8;
|
||
set error = '任务奖励已领取,不可重复领取';
|
||
select result, error;
|
||
leave label_cp;
|
||
end if;
|
||
|
||
-- 修改玩家房卡数量
|
||
if tasktype = 2 then
|
||
select tapl_finish * taskaward into taskaward
|
||
from task_player
|
||
where tapl_agentid = agentid
|
||
and tapl_playerid = playerid
|
||
and tapl_taskid = taskid;
|
||
elseif tasktype = 3 then
|
||
select tapl_finish into taskaward
|
||
from task_player
|
||
where tapl_agentid = agentid
|
||
and tapl_playerid = playerid
|
||
and tapl_taskid = taskid;
|
||
end if;
|
||
|
||
update player set play_roomcard = play_roomcard + taskaward,
|
||
play_taskaward = play_taskaward + taskaward
|
||
where play_agentid = agentid and play_playerid = playerid;
|
||
|
||
-- 按日期统计玩家领取的奖励房卡数量
|
||
call cp_report_agent_day(agentid, 2, taskaward);
|
||
|
||
-- 修改任务状态
|
||
if tasktype in (2, 3) then
|
||
update task_player set tapl_state = 0, tapl_finish = 0
|
||
where tapl_agentid = agentid and tapl_playerid = playerid and tapl_taskid = taskid;
|
||
else
|
||
update task_player set tapl_state = 2, tapl_awardtime = now()
|
||
where tapl_agentid = agentid and tapl_playerid = playerid and tapl_taskid = taskid;
|
||
end if;
|
||
|
||
-- 获取玩家总的任务状态
|
||
-- call cp_game_get_player_taskstate(agentid, playerid, playertaskstate);
|
||
set playertaskstate = 1;
|
||
|
||
-- 返回玩家最新的房卡数量
|
||
select result, error, play_roomcard as roomcard, taskaward, playertaskstate
|
||
from player
|
||
where play_agentid = agentid and play_playerid = playerid;
|
||
end
|
||
;;
|
||
delimiter ;
|
||
|
||
-- ----------------------------
|
||
-- Procedure structure for cp_game_task_finish
|
||
-- ----------------------------
|
||
DROP PROCEDURE IF EXISTS `cp_game_task_finish`;
|
||
delimiter ;;
|
||
CREATE PROCEDURE `cp_game_task_finish`(IN `agentid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci ,IN `playerid` int(8) ,IN `taskid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci ,IN `amount` int(8) ,IN `reflag` int(1))
|
||
SQL SECURITY INVOKER
|
||
COMMENT '玩家完成部分任务量'
|
||
label_cp: begin
|
||
declare result tinyint(1); -- 0:成功 >0:失败
|
||
declare error varchar(100); -- 失败描述
|
||
declare agentname varchar(100); -- 代理商名称
|
||
declare playername varchar(100); -- 玩家昵称
|
||
declare playerroomcard int(11); -- 玩家房卡数量
|
||
declare tasktype tinyint(1); -- 任务状态
|
||
declare tasktotal int(8); -- 任务的任务总量
|
||
declare taskaward int(8); -- 任务的完成奖励
|
||
declare newtaskflag tinyint(1); -- 对于玩家而言是否是新任务的标志
|
||
declare taskfinish int(8) default null; -- 玩家已完成的任务量
|
||
declare taskstate tinyint(1); -- 玩家的任务状态
|
||
|
||
set result = 0;
|
||
|
||
if isnull(reflag) then
|
||
set reflag = 1;
|
||
end if;
|
||
|
||
-- 检验agentid
|
||
call cp_check_1_agent(agentid, result, error, agentname);
|
||
if result > 0 and reflag = 1 then
|
||
select result, error;
|
||
leave label_cp;
|
||
end if;
|
||
|
||
-- 检验playerid
|
||
call cp_check_2_player(agentid, playerid, result, error, playername, playerroomcard);
|
||
if result > 0 and reflag = 1 then
|
||
select result, error;
|
||
leave label_cp;
|
||
end if;
|
||
|
||
-- 检验taskid
|
||
call cp_check_8_task(agentid, taskid, result, error, tasktype, tasktotal, taskaward);
|
||
if result > 0 and reflag = 1 then
|
||
select result, error;
|
||
leave label_cp;
|
||
end if;
|
||
|
||
set taskfinish = null;
|
||
set taskstate = null;
|
||
|
||
select tapl_finish, tapl_state into taskfinish, taskstate from task_player
|
||
where tapl_agentid = agentid and tapl_playerid = playerid and tapl_taskid = taskid;
|
||
|
||
if isnull(taskfinish) then
|
||
-- 新任务
|
||
set newtaskflag = 1;
|
||
set taskfinish = amount;
|
||
else
|
||
-- 老任务
|
||
if (tasktype in (0,1)) and (taskstate <> 0) then
|
||
set result = 16;
|
||
set error = '任务已经完成';
|
||
if reflag = 1 then
|
||
select result, error;
|
||
end if;
|
||
leave label_cp;
|
||
end if;
|
||
|
||
set newtaskflag = 0;
|
||
set taskfinish = taskfinish + amount;
|
||
end if;
|
||
|
||
if taskfinish >= tasktotal then
|
||
-- 已完成
|
||
set taskstate = 1;
|
||
else
|
||
-- 未完成
|
||
set taskstate = 0;
|
||
end if;
|
||
|
||
if newtaskflag = 1 then
|
||
-- 新任务
|
||
if taskstate = 0 then
|
||
-- 未完成
|
||
insert into task_player (tapl_agentid, tapl_playerid, tapl_taskid, tapl_finish, tapl_state, tapl_createtime)
|
||
values (agentid, playerid, taskid, taskfinish, taskstate, now());
|
||
else
|
||
-- 已完成
|
||
insert into task_player (tapl_agentid, tapl_playerid, tapl_taskid, tapl_finish, tapl_state, tapl_createtime, tapl_finishtime)
|
||
values (agentid, playerid, taskid, taskfinish, taskstate, now(), now());
|
||
end if;
|
||
else
|
||
-- 老任务
|
||
if taskstate = 0 then
|
||
-- 未完成
|
||
update task_player set tapl_finish = taskfinish
|
||
where tapl_agentid = agentid and tapl_playerid = playerid and tapl_taskid = taskid;
|
||
else
|
||
-- 已完成
|
||
update task_player set tapl_finish = taskfinish, tapl_state = taskstate, tapl_finishtime = now()
|
||
where tapl_agentid = agentid and tapl_playerid = playerid and tapl_taskid = taskid;
|
||
end if;
|
||
end if;
|
||
|
||
if reflag = 1 then
|
||
select result, error, tasktotal, taskfinish, taskstate, taskaward;
|
||
end if;
|
||
end
|
||
;;
|
||
delimiter ;
|
||
|
||
-- ----------------------------
|
||
-- Procedure structure for cp_game_task_list
|
||
-- ----------------------------
|
||
DROP PROCEDURE IF EXISTS `cp_game_task_list`;
|
||
delimiter ;;
|
||
CREATE PROCEDURE `cp_game_task_list`(IN `agentid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci ,IN `playerid` int(8) ,IN `gameid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci)
|
||
SQL SECURITY INVOKER
|
||
COMMENT '玩家获取任务列表'
|
||
begin
|
||
select task_taskid as taskid, task_type as type, task_title as title,
|
||
task_memo as memo, task_total as total,
|
||
case task_type
|
||
when 2 then if(ifnull(tapl_finish, 0) = 0, task_award, tapl_finish * task_award)
|
||
when 3 then ifnull(tapl_finish, 0)
|
||
else task_award
|
||
end as award,
|
||
ifnull(tapl_finish, 0) as finish, ifnull(tapl_state, 0) as state
|
||
from task
|
||
left join task_player on tapl_agentid = agentid
|
||
and tapl_playerid = playerid
|
||
and tapl_taskid = task_taskid
|
||
where task_agentid = agentid
|
||
and ((task_type in (0, 2, 3))
|
||
or (task_type = 1 and
|
||
(task_begintime is null or now() >= task_begintime) and
|
||
(task_endtime is null or now() <= task_endtime)
|
||
)
|
||
)
|
||
order by task.idx;
|
||
end
|
||
;;
|
||
delimiter ;
|
||
|
||
-- ----------------------------
|
||
-- Procedure structure for cp_game_update_bean
|
||
-- ----------------------------
|
||
DROP PROCEDURE IF EXISTS `cp_game_update_bean`;
|
||
delimiter ;;
|
||
CREATE PROCEDURE `cp_game_update_bean`(IN `agentid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci ,IN `playerid` int(8) ,IN `deduct` int(8) ,IN `gameid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci)
|
||
SQL SECURITY INVOKER
|
||
COMMENT '修改玩家豆豆数量'
|
||
begin
|
||
update player set play_bean = play_bean + deduct
|
||
where play_agentid = agentid
|
||
and play_playerid = playerid;
|
||
|
||
select playerid, play_bean as bean, deduct
|
||
from player
|
||
where play_agentid = agentid
|
||
and play_playerid = playerid;
|
||
end
|
||
;;
|
||
delimiter ;
|
||
|
||
-- ----------------------------
|
||
-- Procedure structure for cp_platform_get_agentchannel
|
||
-- ----------------------------
|
||
DROP PROCEDURE IF EXISTS `cp_platform_get_agentchannel`;
|
||
delimiter ;;
|
||
CREATE PROCEDURE `cp_platform_get_agentchannel`(IN `agentid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci ,IN `channelid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci)
|
||
SQL SECURITY INVOKER
|
||
COMMENT '获取代理商的渠道商的公众号配置'
|
||
begin
|
||
if not exists (select 1 from agent_channel where agch_agentid = agentid and agch_channelid = channelid) then
|
||
select agch_channelid, agch_sales_tel, agch_sales_wechat, agch_youle_appid, agch_youle_devkey, agch_youle_busiid
|
||
from agent_channel
|
||
where agch_agentid = agentid
|
||
order by idx limit 1;
|
||
else
|
||
select agch_channelid, agch_sales_tel, agch_sales_wechat, agch_youle_appid, agch_youle_devkey, agch_youle_busiid
|
||
from agent_channel
|
||
where agch_agentid = agentid
|
||
and agch_channelid = channelid;
|
||
end if;
|
||
end
|
||
;;
|
||
delimiter ;
|
||
|
||
-- ----------------------------
|
||
-- Procedure structure for cp_platform_get_agentserver
|
||
-- ----------------------------
|
||
DROP PROCEDURE IF EXISTS `cp_platform_get_agentserver`;
|
||
delimiter ;;
|
||
CREATE PROCEDURE `cp_platform_get_agentserver`(IN `agentid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci)
|
||
SQL SECURITY INVOKER
|
||
COMMENT '获取代理商的服务器地址和端口号'
|
||
begin
|
||
if not exists (select 1 from agent where agen_agentid = agentid) then
|
||
select agen_agentid, agen_name, agen_logo, agen_server, agen_server_visitor, agen_port_tcp,
|
||
agen_port_http, agen_managecode
|
||
from agent
|
||
order by idx limit 1;
|
||
else
|
||
select agen_agentid, agen_name, agen_logo, agen_server, agen_server_visitor, agen_port_tcp,
|
||
agen_port_http, agen_managecode
|
||
from agent
|
||
where agen_agentid = agentid;
|
||
end if;
|
||
end
|
||
;;
|
||
delimiter ;
|
||
|
||
-- ----------------------------
|
||
-- Procedure structure for cp_platform_get_appversion
|
||
-- ----------------------------
|
||
DROP PROCEDURE IF EXISTS `cp_platform_get_appversion`;
|
||
delimiter ;;
|
||
CREATE PROCEDURE `cp_platform_get_appversion`(IN `agentid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci ,IN `gameid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci ,IN `channelid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci)
|
||
SQL SECURITY INVOKER
|
||
COMMENT '获取app最新版本和下载地址'
|
||
begin
|
||
-- 获取渠道商id
|
||
if not exists (select 1 from agent_channel where agch_agentid = agentid and agch_channelid = channelid) then
|
||
select agch_channelid into channelid from agent_channel where agch_agentid = agentid order by idx limit 1;
|
||
end if;
|
||
|
||
select agga_android_ver as android_ver,
|
||
agga_android_down as android_down,
|
||
agga_ios_ver as ios_ver,
|
||
agga_ios_down as ios_down
|
||
from agent_game
|
||
where agga_agentid = agentid
|
||
and agga_gameid = gameid
|
||
and agga_channelid = channelid;
|
||
end
|
||
;;
|
||
delimiter ;
|
||
|
||
-- ----------------------------
|
||
-- Procedure structure for cp_platform_get_gameversion
|
||
-- ----------------------------
|
||
DROP PROCEDURE IF EXISTS `cp_platform_get_gameversion`;
|
||
delimiter ;;
|
||
CREATE PROCEDURE `cp_platform_get_gameversion`(IN `agentid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci ,IN `gameid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci ,IN `channelid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci ,IN `vers` int(11))
|
||
SQL SECURITY INVOKER
|
||
COMMENT '获取游戏最新版本和下载地址'
|
||
begin
|
||
select * from agent_game_version
|
||
where aggv_agentid = agentid
|
||
and aggv_gameid = gameid
|
||
and aggv_channelid = channelid
|
||
and aggv_version > vers
|
||
order by aggv_version;
|
||
end
|
||
;;
|
||
delimiter ;
|
||
|
||
-- ----------------------------
|
||
-- Procedure structure for cp_report_agent_day
|
||
-- ----------------------------
|
||
DROP PROCEDURE IF EXISTS `cp_report_agent_day`;
|
||
delimiter ;;
|
||
CREATE PROCEDURE `cp_report_agent_day`(IN `agentid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci ,IN `opt` tinyint(1) ,IN `amount` decimal(10,2))
|
||
SQL SECURITY INVOKER
|
||
COMMENT '统计代理商的日报表'
|
||
begin
|
||
declare _day varchar(50); -- 当前日期
|
||
select date_format(now(), "%Y-%m-%d") into _day;
|
||
|
||
if not exists(select 1 from report_agent_day where read_agentid = agentid and read_day = _day) then
|
||
insert into report_agent_day(read_agentid, read_day) values(agentid, _day);
|
||
end if;
|
||
|
||
if opt = 0 then -- 新增玩家数量
|
||
update report_agent_day
|
||
set read_newplayer = read_newplayer + amount
|
||
where read_agentid = agentid and read_day = _day;
|
||
elseif opt = 1 then -- 新增个人代理数量
|
||
update report_agent_day
|
||
set read_newsalesman = read_newsalesman + amount
|
||
where read_agentid = agentid and read_day = _day;
|
||
elseif opt = 2 then -- 玩家得到的奖励房卡数量
|
||
update report_agent_day
|
||
set read_playeraward = read_playeraward + amount
|
||
where read_agentid = agentid and read_day = _day;
|
||
elseif opt = 3 then -- 房卡销售金额
|
||
update report_agent_day
|
||
set read_salesmoney = read_salesmoney + amount
|
||
where read_agentid = agentid and read_day = _day;
|
||
end if;
|
||
end
|
||
;;
|
||
delimiter ;
|
||
|
||
-- ----------------------------
|
||
-- Procedure structure for cp_report_game_day
|
||
-- ----------------------------
|
||
DROP PROCEDURE IF EXISTS `cp_report_game_day`;
|
||
delimiter ;;
|
||
CREATE PROCEDURE `cp_report_game_day`(IN `agentid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci ,IN `gameid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci ,IN `reportday` datetime ,IN `opt` tinyint(1) ,IN `amount` decimal(10,2) ,IN `maxtime` datetime)
|
||
SQL SECURITY INVOKER
|
||
COMMENT '统计代理商的日报表'
|
||
begin
|
||
declare _day varchar(50); -- 当前日期
|
||
select date_format(reportday, "%Y-%m-%d") into _day;
|
||
|
||
if not exists(select 1 from report_game_day where regd_agentid = agentid and regd_gameid = gameid and regd_day = _day) then
|
||
insert into report_game_day(regd_agentid, regd_gameid, regd_day) values(agentid, gameid, _day);
|
||
end if;
|
||
|
||
if opt = 0 then -- 新增玩家数量
|
||
update report_game_day
|
||
set regd_newplayer = regd_newplayer + amount
|
||
where regd_agentid = agentid and regd_gameid = gameid and regd_day = _day;
|
||
elseif opt = 1 then -- 消耗房卡数量
|
||
update report_game_day
|
||
set regd_useroomcard = regd_useroomcard + amount
|
||
where regd_agentid = agentid and regd_gameid = gameid and regd_day = _day;
|
||
elseif opt = 2 then -- 玩家一共玩了多少游戏局(大局)
|
||
update report_game_day
|
||
set regd_asetcount = regd_asetcount + amount
|
||
where regd_agentid = agentid and regd_gameid = gameid and regd_day = _day;
|
||
elseif opt = 3 then -- 最大在线玩家数量
|
||
update report_game_day
|
||
set regd_maxplayer = amount, regd_maxplayertime = maxtime
|
||
where regd_agentid = agentid and regd_gameid = gameid and regd_day = _day;
|
||
elseif opt = 4 then -- 最大开房数量
|
||
|
||
update report_game_day
|
||
set regd_maxroom = amount, regd_maxroomtime = maxtime
|
||
where regd_agentid = agentid and regd_gameid = gameid and regd_day = _day;
|
||
end if;
|
||
end
|
||
;;
|
||
delimiter ;
|
||
|
||
-- ----------------------------
|
||
-- Procedure structure for cp_sales2_player_bindinginvitecode
|
||
-- ----------------------------
|
||
DROP PROCEDURE IF EXISTS `cp_sales2_player_bindinginvitecode`;
|
||
delimiter ;;
|
||
CREATE PROCEDURE `cp_sales2_player_bindinginvitecode`(IN `agentid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci ,IN `unionid` varchar(100) charset utf8mb4 collate utf8mb4_general_ci ,IN `invitecode` int(8))
|
||
SQL SECURITY INVOKER
|
||
COMMENT '代理后台2.0玩家绑定邀请码接口'
|
||
label_cp: begin
|
||
declare result tinyint(1); -- 0:成功 >0:失败
|
||
declare error varchar(100); -- 失败描述
|
||
declare playerid int(8);
|
||
|
||
set result = 0;
|
||
set error = '';
|
||
|
||
if not exists(select 1 from agent where agen_agentid = agentid) then
|
||
set result = 1;
|
||
set error = '参数错误:运营商id不存在';
|
||
select result, error;
|
||
leave label_cp;
|
||
end if;
|
||
|
||
select play_playerid into playerid from player where play_agentid = agentid and play_unionid = unionid;
|
||
if isnull(playerid) then
|
||
set result = 2;
|
||
set error = '参数错误:玩家不存在';
|
||
select result, error;
|
||
leave label_cp;
|
||
end if;
|
||
|
||
update player set play_invitecode = invitecode
|
||
where play_agentid = agentid
|
||
and play_unionid = unionid;
|
||
|
||
-- 完成绑定邀请码任务
|
||
call cp_game_task_finish(agentid, playerid, 'UEFsfbv29YnlacKLo0mjomK48Bv82hGv', 1, 0);
|
||
|
||
select result, error;
|
||
end
|
||
;;
|
||
delimiter ;
|
||
|
||
-- ----------------------------
|
||
-- Procedure structure for cp_sales2_player_topup
|
||
-- ----------------------------
|
||
DROP PROCEDURE IF EXISTS `cp_sales2_player_topup`;
|
||
delimiter ;;
|
||
CREATE PROCEDURE `cp_sales2_player_topup`(IN `agentid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci ,IN `playerid` int(8) ,IN `topup_card` int(10) ,IN `topup_bean` int(10))
|
||
SQL SECURITY INVOKER
|
||
COMMENT '代理后台2.0玩家充值接口'
|
||
label_cp: begin
|
||
declare result tinyint(1); -- 0:成功 >0:失败
|
||
declare error varchar(100); -- 失败描述
|
||
|
||
set result = 0;
|
||
set error = '';
|
||
|
||
if not exists(select 1 from agent where agen_agentid = agentid) then
|
||
set result = 1;
|
||
set error = '参数错误:运营商id不存在';
|
||
select result, error;
|
||
leave label_cp;
|
||
end if;
|
||
|
||
if not exists(select 1 from player where play_agentid = agentid and play_playerid = playerid) then
|
||
set result = 2;
|
||
set error = '参数错误:玩家id不存在';
|
||
select result, error;
|
||
leave label_cp;
|
||
end if;
|
||
|
||
if isnull(topup_card) then
|
||
set topup_card = 0;
|
||
end if;
|
||
|
||
if isnull(topup_bean) then
|
||
set topup_bean = 0;
|
||
end if;
|
||
|
||
update player set play_roomcard = play_roomcard + topup_card,
|
||
play_bean = play_bean + topup_bean
|
||
where play_agentid = agentid
|
||
and play_playerid = playerid;
|
||
|
||
select result, error, player.*
|
||
from player
|
||
where play_agentid = agentid
|
||
and play_playerid = playerid;
|
||
end
|
||
;;
|
||
delimiter ;
|
||
|
||
-- ----------------------------
|
||
-- Procedure structure for cp_sales_accept_award
|
||
-- ----------------------------
|
||
DROP PROCEDURE IF EXISTS `cp_sales_accept_award`;
|
||
delimiter ;;
|
||
CREATE PROCEDURE `cp_sales_accept_award`(IN `agentid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci ,IN `openid` varchar(100) charset utf8mb4 collate utf8mb4_general_ci ,IN `awardid` int(11))
|
||
SQL SECURITY INVOKER
|
||
COMMENT '领取奖励'
|
||
label_cp: begin
|
||
declare result tinyint(1); -- 0:成功 >0:失败
|
||
declare error varchar(100); -- 失败描述
|
||
declare mysalesid int(8); -- 我的代理id
|
||
declare award int(11); -- 奖励的房卡数量
|
||
declare awardstate tinyint(1); -- 奖励状态
|
||
declare myroomcard int(11); -- 领取后我的房卡数量
|
||
declare mystate tinyint(1); -- 领取后我的奖励状态 0无奖励 1有奖励可领取
|
||
|
||
set result = 0;
|
||
-- 获取我的代理id
|
||
select saus_salesid into mysalesid
|
||
from sales_user
|
||
where saus_agentid = agentid
|
||
and saus_openid = openid;
|
||
|
||
-- 检查奖励是否存在
|
||
if not exists(select 1 from sales_award
|
||
where saaw_agentid = agentid
|
||
and saaw_salesid = mysalesid
|
||
and idx = awardid) then
|
||
set result = 1;
|
||
set error = '奖励不存在';
|
||
select result, error;
|
||
leave label_cp;
|
||
end if;
|
||
|
||
-- 获取奖励的房卡数量和状态
|
||
select saaw_award, saaw_state into award, awardstate
|
||
from sales_award
|
||
where saaw_agentid = agentid
|
||
and saaw_salesid = mysalesid
|
||
and idx = awardid;
|
||
|
||
if awardstate = 1 then
|
||
set result = 2;
|
||
set error = '奖励已领取过,不能重复领取';
|
||
select result, error;
|
||
leave label_cp;
|
||
end if;
|
||
|
||
-- 修改领取状态
|
||
update sales_award set saaw_state = 1, saaw_gettime = now()
|
||
where saaw_agentid = agentid
|
||
and saaw_salesid = mysalesid
|
||
and idx = awardid;
|
||
|
||
-- 修改房卡
|
||
update sales_user set saus_roomcard = saus_roomcard + award
|
||
where saus_agentid = agentid
|
||
and saus_openid = openid;
|
||
|
||
-- 获取领取后我的房卡数量
|
||
select saus_roomcard into myroomcard
|
||
from sales_user
|
||
where saus_agentid = agentid
|
||
and saus_openid = openid;
|
||
|
||
-- 获取领取后我的奖励状态
|
||
if exists(select 1 from sales_award
|
||
where saaw_agentid = agentid
|
||
and saaw_salesid = mysalesid
|
||
and saaw_state = 0) then
|
||
set mystate = 1;
|
||
else
|
||
set mystate = 0;
|
||
end if;
|
||
|
||
select result, error, myroomcard, mystate;
|
||
end
|
||
;;
|
||
delimiter ;
|
||
|
||
-- ----------------------------
|
||
-- Procedure structure for cp_sales_apply_sales
|
||
-- ----------------------------
|
||
DROP PROCEDURE IF EXISTS `cp_sales_apply_sales`;
|
||
delimiter ;;
|
||
CREATE PROCEDURE `cp_sales_apply_sales`(IN `agentid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci ,IN `openid` varchar(100) charset utf8mb4 collate utf8mb4_general_ci ,IN `channelid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci ,IN `wechat` varchar(50) charset utf8mb4 collate utf8mb4_general_ci ,IN `tel` varchar(20) charset utf8mb4 collate utf8mb4_general_ci ,IN `inivtecode` int(8))
|
||
SQL SECURITY INVOKER
|
||
COMMENT '申请为个人代理'
|
||
label_cp: begin
|
||
declare result tinyint(1); -- 0:成功 >0:失败
|
||
declare error varchar(100); -- 失败描述
|
||
declare salesman tinyint(1); -- 微信公众号用户是否是个人代理
|
||
declare salesid int(8); -- 新代理id
|
||
declare salespower varchar(10); -- 默认的个人代理权限
|
||
declare parentid int(8); -- 父亲代理id
|
||
|
||
set result = 0;
|
||
|
||
-- 检验agentid
|
||
if not exists(select 1 from agent where agen_agentid = agentid) then
|
||
set result = 1;
|
||
set error = '运营商id不存在';
|
||
select result, error;
|
||
leave label_cp;
|
||
end if;
|
||
|
||
-- 检验微信公众号用户
|
||
select saus_salesman into salesman
|
||
from sales_user
|
||
where saus_agentid = agentid and saus_openid = openid;
|
||
if isnull(salesman) then
|
||
set result = 2;
|
||
set error = '用户不存在';
|
||
select result, error;
|
||
leave label_cp;
|
||
end if;
|
||
|
||
if salesman = 1 then
|
||
set result = 3;
|
||
set error = '您已经是代理了,无需再次申请';
|
||
select result, error;
|
||
leave label_cp;
|
||
end if;
|
||
|
||
-- 新个人代理
|
||
update agent set agen_maxsalesid = agen_maxsalesid + floor(rand() * (12-6) + 6) where agen_agentid = agentid;
|
||
|
||
select agen_maxsalesid, agen_salespower
|
||
into salesid, salespower
|
||
from agent
|
||
where agen_agentid = agentid;
|
||
|
||
if isnull(inivtecode) or (inivtecode = '') or (inivtecode = 0) then
|
||
set parentid = null;
|
||
else
|
||
select saus_salesid into parentid
|
||
from sales_user
|
||
where saus_agentid = agentid and saus_salesid = inivtecode;
|
||
end if;
|
||
|
||
if openid = 'oIv1dwGjgqhngUd3fkJa5Zlc13zE' then
|
||
update sales_user set saus_salesman = 1, saus_salesid = salesid,
|
||
saus_saletime = now(), saus_salestype = 1,
|
||
saus_wechat = wechat, saus_tel = tel,
|
||
saus_power = salespower, saus_parentid = parentid,
|
||
saus_roomcard = 100000, saus_power = '22'
|
||
where saus_agentid = agentid and saus_openid = openid;
|
||
else
|
||
update sales_user set saus_salesman = 1, saus_salesid = salesid,
|
||
saus_saletime = now(), saus_salestype = 1,
|
||
saus_wechat = wechat, saus_tel = tel,
|
||
saus_power = salespower, saus_parentid = parentid
|
||
where saus_agentid = agentid and saus_openid = openid;
|
||
end if;
|
||
|
||
-- 按日期统计新增个人代理人数
|
||
call cp_report_agent_day(agentid, 1, 1);
|
||
|
||
|
||
-- 返回执行结果
|
||
select result, error, parentid as inivtecode;
|
||
end
|
||
;;
|
||
delimiter ;
|
||
|
||
-- ----------------------------
|
||
-- Procedure structure for cp_sales_ask_dealbill
|
||
-- ----------------------------
|
||
DROP PROCEDURE IF EXISTS `cp_sales_ask_dealbill`;
|
||
delimiter ;;
|
||
CREATE PROCEDURE `cp_sales_ask_dealbill`(IN `_idx` int(11) ,IN `dealid` int(8) ,IN `dealstate` tinyint(1))
|
||
SQL SECURITY INVOKER
|
||
COMMENT '处理索要房卡订单'
|
||
label_cp: begin
|
||
declare result tinyint(1); -- 0:成功 >0:失败
|
||
declare error varchar(100); -- 失败描述
|
||
declare agentid varchar(32);
|
||
declare billtype tinyint(1);
|
||
declare askid int(8);
|
||
declare salesid int(8);
|
||
declare amount int(8);
|
||
declare salesroomcard int(11); -- 受理者的房卡数量
|
||
declare askerroomcard int(11); -- 索取者的房卡数量
|
||
|
||
set result = 0;
|
||
|
||
-- 检验订单是否存在
|
||
set agentid = null;
|
||
|
||
select saab_agentid, saab_type, saab_askid, saab_salesid, saab_amount
|
||
into agentid, billtype, askid, salesid, amount
|
||
from sales_ask_bill
|
||
where idx = _idx;
|
||
|
||
if isnull(agentid) then
|
||
set result = 1;
|
||
set error = '订单不存在';
|
||
select result, error;
|
||
leave label_cp;
|
||
end if;
|
||
|
||
if dealstate = 1 then
|
||
-- 充卡数量不能是负数
|
||
if amount < 0 then
|
||
set result = 2;
|
||
set error = '充卡数量必须大于0';
|
||
select result, error;
|
||
leave label_cp;
|
||
end if;
|
||
|
||
-- 检验个人代理的房卡数量是否够
|
||
set salesroomcard = 0;
|
||
select saus_roomcard
|
||
into salesroomcard
|
||
from sales_user
|
||
where saus_agentid = agentid
|
||
and saus_salesman = 1
|
||
and saus_salesid = salesid;
|
||
|
||
if (salesroomcard = 0) or (salesroomcard < amount) then
|
||
set result = 3;
|
||
set error = '房卡数量不足';
|
||
select result, error;
|
||
leave label_cp;
|
||
end if;
|
||
end if;
|
||
|
||
if (dealstate = 1 or dealstate = 3) then
|
||
if dealid <> salesid then
|
||
set result = 4;
|
||
set error = '无此订单的操作权限';
|
||
select result, error;
|
||
leave label_cp;
|
||
end if;
|
||
elseif dealstate = 2 then
|
||
if dealid <> askid then
|
||
set result = 5;
|
||
set error = '无此订单的操作权限';
|
||
select result, error;
|
||
leave label_cp;
|
||
end if;
|
||
end if;
|
||
|
||
-- 修改订单状态
|
||
update sales_ask_bill set saab_state = dealstate, saab_dealtime = now() where idx = _idx;
|
||
|
||
-- 充卡
|
||
if dealstate = 1 then
|
||
if billtype = 0 then -- 玩家
|
||
update player set play_roomcard = play_roomcard + amount where play_agentid = agentid and play_playerid = askid;
|
||
select play_roomcard into askerroomcard from player where play_agentid = agentid and play_playerid = askid;
|
||
elseif billtype = 1 then -- 个人代理
|
||
update sales_user set saus_roomcard = saus_roomcard + amount where saus_agentid = agentid and saus_salesid = askid;
|
||
select saus_roomcard into askerroomcard from sales_user where saus_agentid = agentid and saus_salesid = askid;
|
||
end if;
|
||
update sales_user set saus_roomcard = saus_roomcard - amount where saus_agentid = agentid and saus_salesid = salesid;
|
||
select saus_roomcard into salesroomcard from sales_user where saus_agentid = agentid and saus_salesid = salesid;
|
||
|
||
select result, error, agentid, askid, amount, askerroomcard, salesroomcard;
|
||
else
|
||
select result, error;
|
||
end if;
|
||
end
|
||
;;
|
||
delimiter ;
|
||
|
||
-- ----------------------------
|
||
-- Procedure structure for cp_sales_ask_getmyaskbill
|
||
-- ----------------------------
|
||
DROP PROCEDURE IF EXISTS `cp_sales_ask_getmyaskbill`;
|
||
delimiter ;;
|
||
CREATE PROCEDURE `cp_sales_ask_getmyaskbill`(IN `agentid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci ,IN `billtype` tinyint(1) ,IN `askid` int(8))
|
||
SQL SECURITY INVOKER
|
||
COMMENT '获取我发起的索要房卡订单列表'
|
||
begin
|
||
select idx, saab_asktime as asktime, saab_amount as amount, saab_state as state,
|
||
case saab_state
|
||
when 0 then 0
|
||
else 1
|
||
end as stateidx
|
||
from sales_ask_bill
|
||
where saab_agentid = agentid
|
||
and saab_type = billtype
|
||
and saab_askid = askid
|
||
order by stateidx, asktime desc
|
||
limit 50;
|
||
end
|
||
;;
|
||
delimiter ;
|
||
|
||
-- ----------------------------
|
||
-- Procedure structure for cp_sales_ask_getmydealbill
|
||
-- ----------------------------
|
||
DROP PROCEDURE IF EXISTS `cp_sales_ask_getmydealbill`;
|
||
delimiter ;;
|
||
CREATE PROCEDURE `cp_sales_ask_getmydealbill`(IN `agentid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci ,IN `billtype` tinyint(1) ,IN `salesid` int(8))
|
||
SQL SECURITY INVOKER
|
||
COMMENT '获取我受理的索要房卡订单列表'
|
||
begin
|
||
select idx, saab_asktime as asktime, saab_amount as amount, saab_state as state,
|
||
case saab_state
|
||
when 0 then 0
|
||
else 1
|
||
end as stateidx,
|
||
saab_askid as askid, saab_asknickname as nickname, saab_askavatar as avatar
|
||
from sales_ask_bill
|
||
where saab_agentid = agentid
|
||
and saab_type = billtype
|
||
and saab_salesid = salesid
|
||
order by stateidx, asktime desc
|
||
limit 100;
|
||
end
|
||
;;
|
||
delimiter ;
|
||
|
||
-- ----------------------------
|
||
-- Procedure structure for cp_sales_ask_newbill
|
||
-- ----------------------------
|
||
DROP PROCEDURE IF EXISTS `cp_sales_ask_newbill`;
|
||
delimiter ;;
|
||
CREATE PROCEDURE `cp_sales_ask_newbill`(IN `agentid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci ,IN `billtype` tinyint(1) ,IN `askid` int(8) ,IN `amount` int(8))
|
||
SQL SECURITY INVOKER
|
||
COMMENT '新建索要房卡订单'
|
||
label_cp: begin
|
||
declare result tinyint(1); -- 0:成功 >0:失败
|
||
declare error varchar(100); -- 失败描述
|
||
declare asknickname varchar(100); -- 发起者昵称
|
||
declare askavatar varchar(200); -- 发起者头像
|
||
declare invitecode int(8); -- 已经绑定的邀请码
|
||
|
||
set result = 0;
|
||
set invitecode = null;
|
||
|
||
if billtype = 0 then
|
||
select play_nickname, play_avatar, play_invitecode
|
||
into asknickname, askavatar, invitecode
|
||
from player
|
||
where play_agentid = agentid
|
||
and play_playerid = askid;
|
||
elseif billtype = 1 then
|
||
select saus_nickname, saus_avatar, saus_parentid
|
||
into asknickname, askavatar, invitecode
|
||
from sales_user
|
||
where saus_agentid = agentid
|
||
and saus_salesman = 1
|
||
and saus_salesid = askid;
|
||
end if;
|
||
if isnull(invitecode) then
|
||
set result = 1;
|
||
set error = '索要房卡失败:未绑定邀请码';
|
||
select result, error;
|
||
leave label_cp;
|
||
end if;
|
||
|
||
insert into sales_ask_bill(saab_agentid, saab_type, saab_askid, saab_asknickname,
|
||
saab_askavatar, saab_salesid, saab_amount, saab_state, saab_asktime)
|
||
values(agentid, billtype, askid, asknickname, askavatar, invitecode, amount, 0, now());
|
||
|
||
select result, error;
|
||
end
|
||
;;
|
||
delimiter ;
|
||
|
||
-- ----------------------------
|
||
-- Procedure structure for cp_sales_ask_player_getsalesman
|
||
-- ----------------------------
|
||
DROP PROCEDURE IF EXISTS `cp_sales_ask_player_getsalesman`;
|
||
delimiter ;;
|
||
CREATE PROCEDURE `cp_sales_ask_player_getsalesman`(IN `agentid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci ,IN `playerid` int(8))
|
||
SQL SECURITY INVOKER
|
||
COMMENT '玩家获取自己所属的个人代理信息'
|
||
begin
|
||
select saus_salesid as sales_id, saus_wechat as sales_wechat,
|
||
saus_tel as sales_tel, saus_nickname as sales_nickname,
|
||
saus_avatar as sales_avatar
|
||
from player, sales_user
|
||
where play_agentid = agentid
|
||
and play_playerid = playerid
|
||
and play_invitecode is not null
|
||
and saus_agentid = agentid
|
||
and saus_salesman = 1
|
||
and saus_salesid = play_invitecode;
|
||
end
|
||
;;
|
||
delimiter ;
|
||
|
||
-- ----------------------------
|
||
-- Procedure structure for cp_sales_ask_sales_getparentman
|
||
-- ----------------------------
|
||
DROP PROCEDURE IF EXISTS `cp_sales_ask_sales_getparentman`;
|
||
delimiter ;;
|
||
CREATE PROCEDURE `cp_sales_ask_sales_getparentman`(IN `agentid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci ,IN `salesid` int(8))
|
||
SQL SECURITY INVOKER
|
||
COMMENT '个人代理获取自己的上级代理信息'
|
||
begin
|
||
select u2.saus_salesid as sales_id, u2.saus_wechat as sales_wechat,
|
||
u2.saus_tel as sales_tel, u2.saus_nickname as sales_nickname,
|
||
u2.saus_avatar as sales_avatar
|
||
from sales_user as u1, sales_user as u2
|
||
where u1.saus_agentid = agentid
|
||
and u1.saus_salesman = 1
|
||
and u1.saus_salesid = salesid
|
||
and u1.saus_parentid is not null
|
||
and u2.saus_agentid = agentid
|
||
and u2.saus_salesman = 1
|
||
and u2.saus_salesid = u1.saus_parentid;
|
||
end
|
||
;;
|
||
delimiter ;
|
||
|
||
-- ----------------------------
|
||
-- Procedure structure for cp_sales_binding_parent
|
||
-- ----------------------------
|
||
DROP PROCEDURE IF EXISTS `cp_sales_binding_parent`;
|
||
delimiter ;;
|
||
CREATE PROCEDURE `cp_sales_binding_parent`(IN `agentid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci ,IN `openid` varchar(100) charset utf8mb4 collate utf8mb4_general_ci ,IN `salesid` int(8))
|
||
SQL SECURITY INVOKER
|
||
COMMENT '绑定我的推荐人'
|
||
label_cp: begin
|
||
declare result tinyint(1); -- 0:成功 >0:失败
|
||
declare error varchar(100);
|
||
declare mysalesid int(8); -- 我的代理id
|
||
declare myparentid int(8); -- 我的上级代理id
|
||
declare pid int(8); -- 推荐人的上级代理id
|
||
declare ppid int(8); -- 推荐人的上级的上级代理id
|
||
declare i int;
|
||
|
||
declare _salesid int(8);
|
||
declare wechat varchar(100);
|
||
declare tel varchar(50);
|
||
declare nickname varchar(100);
|
||
declare avatar varchar(200);
|
||
|
||
set result = 0;
|
||
|
||
-- 检查推荐人是否存在
|
||
set _salesid = null;
|
||
select saus_salesid, saus_nickname, saus_avatar, saus_wechat, saus_tel
|
||
into _salesid, nickname, avatar, wechat, tel
|
||
from sales_user
|
||
where saus_agentid = agentid
|
||
and saus_salesid = salesid;
|
||
if isnull(_salesid) then
|
||
set result = 1;
|
||
set error = '邀请码不存在';
|
||
select result, error;
|
||
leave label_cp;
|
||
end if;
|
||
|
||
-- 获取我的代理id
|
||
select saus_salesid, saus_parentid into mysalesid, myparentid
|
||
from sales_user
|
||
where saus_agentid = agentid
|
||
and saus_openid = openid
|
||
and saus_salesman = 1;
|
||
|
||
-- 检查我是否已经是代理
|
||
if isnull(mysalesid) then
|
||
set result = 5;
|
||
set error = '您还不是代理,请先申请成为代理再绑定邀请码';
|
||
select result, error;
|
||
leave label_cp;
|
||
end if;
|
||
|
||
-- 检查是否已经绑定了邀请码
|
||
if isnull(myparentid) then
|
||
-- 不能绑自己
|
||
if mysalesid = salesid then
|
||
set result = 1;
|
||
set error = '不能绑定自己的邀请码';
|
||
select result, error;
|
||
leave label_cp;
|
||
end if;
|
||
|
||
-- 检查推荐人的上级代理是否有我
|
||
set i = 0;
|
||
set pid = salesid;
|
||
label_wh: while i < 2 do
|
||
select saus_parentid into ppid from sales_user where saus_agentid = agentid and saus_salesid = pid;
|
||
|
||
if isnull(ppid) then
|
||
leave label_wh;
|
||
elseif ppid = mysalesid then
|
||
set result = 1;
|
||
set error = '不能绑定自己下级的邀请码';
|
||
select result, error;
|
||
leave label_cp;
|
||
end if;
|
||
set i = i + 1;
|
||
set pid = ppid;
|
||
end while;
|
||
|
||
-- 检查通过后修改我的推荐人
|
||
update sales_user set saus_parentid = salesid
|
||
where saus_agentid = agentid
|
||
and saus_openid = openid;
|
||
|
||
-- 如果是第一次绑定则添加推荐人的奖励
|
||
if isnull(myparentid) then
|
||
call cp_sales_new_award(agentid, salesid, mysalesid, 0, null);
|
||
end if;
|
||
|
||
select result, salesid, wechat, tel, nickname, avatar;
|
||
else
|
||
set result = 2;
|
||
set error = '已经绑定过上级代理,不能再次绑定';
|
||
|
||
select saus_salesid, saus_nickname, saus_avatar, saus_wechat, saus_tel
|
||
into salesid, nickname, avatar, wechat, tel
|
||
from sales_user
|
||
where saus_agentid = agentid
|
||
and saus_salesid = myparentid;
|
||
|
||
select result, error, salesid, wechat, tel, nickname, avatar;
|
||
end if;
|
||
end
|
||
;;
|
||
delimiter ;
|
||
|
||
-- ----------------------------
|
||
-- Procedure structure for cp_sales_finish_task
|
||
-- ----------------------------
|
||
DROP PROCEDURE IF EXISTS `cp_sales_finish_task`;
|
||
delimiter ;;
|
||
CREATE PROCEDURE `cp_sales_finish_task`(IN `agentid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci ,IN `opneid` varchar(100) charset utf8mb4 collate utf8mb4_general_ci ,IN `unionid` varchar(100) charset utf8mb4 collate utf8mb4_general_ci ,IN `taskid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci)
|
||
SQL SECURITY INVOKER
|
||
COMMENT '根据unionid判断是否完成了相关任务'
|
||
begin
|
||
declare playerid varchar(32);
|
||
|
||
if isnull(unionid) then
|
||
select saus_unionid into unionid from sales_user where saus_agentid = agentid and saus_openid = opneid;
|
||
end if;
|
||
|
||
if not isnull(unionid) then
|
||
select play_playerid into playerid from player where play_agentid = agentid and play_unionid = unionid;
|
||
if not isnull(playerid) then
|
||
call cp_game_task_finish(agentid, playerid, taskid, 1, 0);
|
||
end if;
|
||
end if;
|
||
end
|
||
;;
|
||
delimiter ;
|
||
|
||
-- ----------------------------
|
||
-- Procedure structure for cp_sales_get_award
|
||
-- ----------------------------
|
||
DROP PROCEDURE IF EXISTS `cp_sales_get_award`;
|
||
delimiter ;;
|
||
CREATE PROCEDURE `cp_sales_get_award`(IN `agentid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci ,IN `openid` varchar(100) charset utf8mb4 collate utf8mb4_general_ci)
|
||
SQL SECURITY INVOKER
|
||
COMMENT '获取我的奖励列表'
|
||
begin
|
||
select sales_award.idx as awardid, saaw_type as type, saaw_childid as childid,
|
||
c.saus_nickname as childname, c.saus_avatar as childavatar, saaw_award as award,
|
||
saaw_state as state, saaw_createtime as awardtime, saaw_gettime as gettime
|
||
from sales_user as i
|
||
inner join sales_user as c on c.saus_agentid = agentid
|
||
inner join sales_award on saaw_agentid = agentid
|
||
and saaw_salesid = i.saus_salesid
|
||
and saaw_childid = c.saus_salesid
|
||
where i.saus_agentid = agentid
|
||
and i.saus_openid = openid
|
||
and i.saus_salesid is not null
|
||
order by saaw_createtime desc;
|
||
end
|
||
;;
|
||
delimiter ;
|
||
|
||
-- ----------------------------
|
||
-- Procedure structure for cp_sales_get_child
|
||
-- ----------------------------
|
||
DROP PROCEDURE IF EXISTS `cp_sales_get_child`;
|
||
delimiter ;;
|
||
CREATE PROCEDURE `cp_sales_get_child`(IN `agentid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci ,IN `openid` varchar(100) charset utf8mb4 collate utf8mb4_general_ci)
|
||
SQL SECURITY INVOKER
|
||
COMMENT '获取我的子代理'
|
||
begin
|
||
select s2.saus_salesid as salesid, s2.saus_nickname as name,
|
||
s2.saus_avatar as avatar, ifnull(sum(saaw_award), 0) as awardtotal
|
||
from sales_user as s1
|
||
inner join sales_user as s2 on s2.saus_agentid = agentid
|
||
and s2.saus_parentid = s1.saus_salesid
|
||
left join sales_award on saaw_agentid = agentid
|
||
and saaw_salesid = s1.saus_salesid
|
||
and saaw_childid = s2.saus_salesid
|
||
and saaw_state = 1
|
||
where s1.saus_agentid = agentid
|
||
and s1.saus_openid = openid
|
||
and s1.saus_salesid is not null
|
||
group by salesid, name, avatar;
|
||
end
|
||
;;
|
||
delimiter ;
|
||
|
||
-- ----------------------------
|
||
-- Procedure structure for cp_sales_get_gamelist
|
||
-- ----------------------------
|
||
DROP PROCEDURE IF EXISTS `cp_sales_get_gamelist`;
|
||
delimiter ;;
|
||
CREATE PROCEDURE `cp_sales_get_gamelist`(IN `agentid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci ,IN `channelid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci)
|
||
SQL SECURITY INVOKER
|
||
COMMENT '获取代理商的游戏列表及下载地址'
|
||
begin
|
||
if not exists (select 1 from agent where agen_agentid = agentid) then
|
||
select agen_agentid into agentid from agent order by idx limit 1;
|
||
end if;
|
||
|
||
-- 获取渠道商id
|
||
if not exists (select 1 from agent_channel where agch_agentid = agentid and agch_channelid = channelid) then
|
||
select agch_channelid into channelid from agent_channel where agch_agentid = agentid order by idx limit 1;
|
||
end if;
|
||
|
||
select agga_aliasname as name, agga_image as image, agga_state as state,
|
||
agga_gamememo as memo,
|
||
agga_ios_down as ios_down, agga_ios_size as ios_size,
|
||
agga_android_down as android_down, agga_android_size as android_size
|
||
from agent_game
|
||
where agga_agentid = agentid
|
||
and agga_channelid = channelid
|
||
order by idx;
|
||
end
|
||
;;
|
||
delimiter ;
|
||
|
||
-- ----------------------------
|
||
-- Procedure structure for cp_sales_get_invitecodeinfo
|
||
-- ----------------------------
|
||
DROP PROCEDURE IF EXISTS `cp_sales_get_invitecodeinfo`;
|
||
delimiter ;;
|
||
CREATE PROCEDURE `cp_sales_get_invitecodeinfo`(IN `agentid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci ,IN `openid` varchar(100) charset utf8mb4 collate utf8mb4_general_ci)
|
||
SQL SECURITY INVOKER
|
||
COMMENT '获取玩家绑定的邀请码的代理信息'
|
||
begin
|
||
select p.saus_salesid, p.saus_nickname, p.saus_avatar
|
||
from sales_user as i
|
||
inner join sales_user as p on p.saus_agentid = agentid
|
||
and p.saus_salesid is not null
|
||
and p.saus_salesid = i.saus_invitecode
|
||
where i.saus_agentid = agentid
|
||
and i.saus_openid = openid;
|
||
end
|
||
;;
|
||
delimiter ;
|
||
|
||
-- ----------------------------
|
||
-- Procedure structure for cp_sales_get_myplayer
|
||
-- ----------------------------
|
||
DROP PROCEDURE IF EXISTS `cp_sales_get_myplayer`;
|
||
delimiter ;;
|
||
CREATE PROCEDURE `cp_sales_get_myplayer`(IN `agentid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci ,IN `openid` varchar(100) charset utf8mb4 collate utf8mb4_general_ci)
|
||
SQL SECURITY INVOKER
|
||
COMMENT '绑定了我的邀请码的玩家列表'
|
||
begin
|
||
declare salesid int(8);
|
||
set salesid = null;
|
||
|
||
select saus_salesid into salesid from sales_user
|
||
where saus_agentid = agentid and saus_openid = openid and saus_salesman = 1;
|
||
|
||
if not isnull(salesid) then
|
||
select play_playerid as playerid, play_nickname as nickname,
|
||
play_avatar as avatar, ifnull(v.money, 0) as money
|
||
from player
|
||
left join (select sabu_agentid, sabu_playerid, sum(sabu_paymoney) as money
|
||
from sales_buybill
|
||
where sabu_billtype = 0
|
||
and sabu_paystate = 1
|
||
and yearweek(date_format(sabu_paytime, '%Y-%m-%d')) = yearweek(now())
|
||
group by sabu_agentid, sabu_playerid
|
||
) as v
|
||
on v.sabu_agentid = play_agentid
|
||
and v.sabu_playerid = play_playerid
|
||
where play_agentid = agentid
|
||
and play_invitecode = salesid
|
||
order by playerid;
|
||
end if;
|
||
end
|
||
;;
|
||
delimiter ;
|
||
|
||
-- ----------------------------
|
||
-- Procedure structure for cp_sales_get_mysalesman
|
||
-- ----------------------------
|
||
DROP PROCEDURE IF EXISTS `cp_sales_get_mysalesman`;
|
||
delimiter ;;
|
||
CREATE PROCEDURE `cp_sales_get_mysalesman`(IN `agentid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci ,IN `openid` varchar(100) charset utf8mb4 collate utf8mb4_general_ci)
|
||
SQL SECURITY INVOKER
|
||
COMMENT '我的下级代理列表'
|
||
begin
|
||
declare salesid int(8);
|
||
set salesid = null;
|
||
|
||
select saus_salesid into salesid from sales_user
|
||
where saus_agentid = agentid and saus_openid = openid and saus_salesman = 1;
|
||
|
||
if not isnull(salesid) then
|
||
select s1.saus_salesid as salesid, s1.saus_nickname as nickname, s1.saus_avatar as avatar,
|
||
ifnull(v1.salesmancount, 0) as salesmancount,
|
||
ifnull(v2.playercount, 0) as playercount
|
||
from sales_user as s1
|
||
left join (select s2.saus_parentid, count(1) as salesmancount
|
||
from sales_user as s2
|
||
where s2.saus_agentid = agentid
|
||
and s2.saus_salesman = 1
|
||
and s2.saus_parentid is not null
|
||
group by s2.saus_parentid
|
||
) as v1 on v1.saus_parentid = s1.saus_salesid
|
||
left join (select play_invitecode, count(1) as playercount
|
||
from player
|
||
where play_agentid = agentid
|
||
and play_invitecode is not null
|
||
group by play_invitecode
|
||
) as v2 on v2.play_invitecode = s1.saus_salesid
|
||
where s1.saus_agentid = agentid
|
||
and s1.saus_salesman = 1
|
||
and s1.saus_parentid = salesid;
|
||
end if;
|
||
end
|
||
;;
|
||
delimiter ;
|
||
|
||
-- ----------------------------
|
||
-- Procedure structure for cp_sales_get_parentinfo
|
||
-- ----------------------------
|
||
DROP PROCEDURE IF EXISTS `cp_sales_get_parentinfo`;
|
||
delimiter ;;
|
||
CREATE PROCEDURE `cp_sales_get_parentinfo`(IN `agentid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci ,IN `openid` varchar(100) charset utf8mb4 collate utf8mb4_general_ci)
|
||
SQL SECURITY INVOKER
|
||
COMMENT '获取我的推荐人信息'
|
||
begin
|
||
select p.saus_salesid, p.saus_nickname, p.saus_avatar
|
||
from sales_user as i
|
||
inner join sales_user as p on p.saus_agentid = agentid
|
||
and p.saus_salesid is not null
|
||
and p.saus_salesid = i.saus_parentid
|
||
where i.saus_agentid = agentid
|
||
and i.saus_openid = openid
|
||
and i.saus_salesid is not null;
|
||
end
|
||
;;
|
||
delimiter ;
|
||
|
||
-- ----------------------------
|
||
-- Procedure structure for cp_sales_get_topupname
|
||
-- ----------------------------
|
||
DROP PROCEDURE IF EXISTS `cp_sales_get_topupname`;
|
||
delimiter ;;
|
||
CREATE PROCEDURE `cp_sales_get_topupname`(IN `agentid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci ,IN `openid` varchar(100) charset utf8mb4 collate utf8mb4_general_ci)
|
||
SQL SECURITY INVOKER
|
||
COMMENT '获取充卡名单'
|
||
begin
|
||
select distinct(sase_playerid) as playerid, play_nickname as name,
|
||
play_avatar as avatar,
|
||
sum(sase_amount) as total, max(sase_selltime) as lastselltime
|
||
from sales_sellbill
|
||
inner join player on play_agentid = agentid
|
||
and play_playerid = sase_playerid
|
||
where sase_agentid = agentid
|
||
and sase_openid = openid
|
||
group by playerid, name, avatar
|
||
order by lastselltime desc;
|
||
end
|
||
;;
|
||
delimiter ;
|
||
|
||
-- ----------------------------
|
||
-- Procedure structure for cp_sales_get_transfername
|
||
-- ----------------------------
|
||
DROP PROCEDURE IF EXISTS `cp_sales_get_transfername`;
|
||
delimiter ;;
|
||
CREATE PROCEDURE `cp_sales_get_transfername`(IN `agentid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci ,IN `openid` varchar(100) charset utf8mb4 collate utf8mb4_general_ci)
|
||
SQL SECURITY INVOKER
|
||
COMMENT '获取转卡名单'
|
||
begin
|
||
select distinct(satr_salesid) as salesid, saus_nickname as name,
|
||
saus_avatar as avatar,
|
||
sum(satr_amount) as total, max(satr_transfertime) as lasttransfertime
|
||
from sales_transferbill
|
||
inner join sales_user on saus_agentid = agentid
|
||
and saus_salesid = satr_salesid
|
||
where satr_agentid = agentid
|
||
and satr_openid = openid
|
||
group by salesid, name, avatar
|
||
order by lasttransfertime desc;
|
||
end
|
||
;;
|
||
delimiter ;
|
||
|
||
-- ----------------------------
|
||
-- Procedure structure for cp_sales_new_award
|
||
-- ----------------------------
|
||
DROP PROCEDURE IF EXISTS `cp_sales_new_award`;
|
||
delimiter ;;
|
||
CREATE PROCEDURE `cp_sales_new_award`(IN `agentid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci ,IN `salesid` int(8) ,IN `childid` int(8) ,IN `type` tinyint(1) ,IN `billcode` varchar(50) charset utf8mb4 collate utf8mb4_general_ci)
|
||
SQL SECURITY INVOKER
|
||
COMMENT '添加推荐人奖励'
|
||
begin
|
||
if type = 0 then
|
||
insert into sales_award (saaw_agentid, saaw_salesid, saaw_childid,
|
||
saaw_type, saaw_award, saaw_state, saaw_createtime)
|
||
values(agentid, salesid, childid, type, 100, 0, now());
|
||
else
|
||
insert into sales_award (saaw_agentid, saaw_salesid, saaw_childid,
|
||
saaw_type, saaw_buybill, saaw_award, saaw_state, saaw_createtime)
|
||
values(agentid, salesid, childid, type, billcode, 200, 0, now());
|
||
end if;
|
||
end
|
||
;;
|
||
delimiter ;
|
||
|
||
-- ----------------------------
|
||
-- Procedure structure for cp_sales_new_bill
|
||
-- ----------------------------
|
||
DROP PROCEDURE IF EXISTS `cp_sales_new_bill`;
|
||
delimiter ;;
|
||
CREATE PROCEDURE `cp_sales_new_bill`(IN `agentid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci ,IN `openid` varchar(100) charset utf8mb4 collate utf8mb4_general_ci ,IN `channelid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci ,IN `billcode` varchar(100) charset utf8mb4 collate utf8mb4_general_ci ,IN `billtype` tinyint(1) ,IN `productid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci ,IN `playerid` int(8) ,IN `tel` varchar(50) charset utf8mb4 collate utf8mb4_general_ci ,IN `wechat` varchar(50) charset utf8mb4 collate utf8mb4_general_ci)
|
||
SQL SECURITY INVOKER
|
||
COMMENT '新增一条购卡订单'
|
||
label_cp: begin
|
||
declare result tinyint(1); -- 0:成功 >0:失败
|
||
declare error varchar(100); -- 失败描述
|
||
declare agentname varchar(100); -- 代理商名称
|
||
declare username varchar(100); -- 微信公众号用户昵称
|
||
declare usersalesman tinyint(1); -- 微信公众号用户是否是个人代理
|
||
declare productname varchar(100); -- 产品名称
|
||
declare productamount int(11); -- 产品的房卡数量
|
||
declare productmoney decimal(10,2);-- 产品的所需金额
|
||
declare playername varchar(100); -- 充入者的昵称
|
||
declare playerroomcard int(11); -- 充入者的房卡数量
|
||
|
||
set result = 0;
|
||
-- 检验agentid
|
||
call cp_check_1_agent(agentid, result, error, agentname);
|
||
if result > 0 then
|
||
select result, error;
|
||
leave label_cp;
|
||
end if;
|
||
|
||
-- 检验微信公众号用户
|
||
call cp_check_4_salesuser(agentid, openid, result, error, username, usersalesman);
|
||
if result > 0 then
|
||
select result, error;
|
||
leave label_cp;
|
||
end if;
|
||
|
||
-- 检验productid
|
||
call cp_check_5_product(agentid, productid, result, error, productname, productamount, productmoney);
|
||
if result > 0 then
|
||
select result, error;
|
||
leave label_cp;
|
||
end if;
|
||
|
||
-- 检验playerid
|
||
if (billtype = 0) then
|
||
call cp_check_2_player(agentid, playerid, result, error, playername, playerroomcard);
|
||
if result > 0 then
|
||
select result, error;
|
||
leave label_cp;
|
||
end if;
|
||
end if;
|
||
|
||
-- 获取渠道商id
|
||
if not exists (select 1 from agent_channel where agch_agentid = agentid and agch_channelid = channelid) then
|
||
select agch_channelid into channelid from agent_channel where agch_agentid = agentid order by idx limit 1;
|
||
end if;
|
||
|
||
-- 保存订单
|
||
if (billtype = 0) then
|
||
insert into sales_buybill(sabu_agentid, sabu_openid, sabu_channelid, sabu_billcode, sabu_productid,
|
||
sabu_amount, sabu_money, sabu_createtime, sabu_billtype,
|
||
sabu_playerid, sabu_playername)
|
||
values(agentid, openid, channelid, billcode, productid, productamount, productmoney, now(),
|
||
billtype, playerid, playername);
|
||
else
|
||
insert into sales_buybill(sabu_agentid, sabu_openid, sabu_channelid, sabu_billcode, sabu_productid,
|
||
sabu_amount, sabu_money, sabu_createtime, sabu_billtype)
|
||
values(agentid, openid, channelid, billcode, productid, productamount, productmoney, now(), billtype);
|
||
|
||
-- 保存个人代理的联系方式
|
||
update sales_user set saus_tel = tel, saus_wechat = wechat where saus_agentid = agentid and saus_openid = openid;
|
||
end if;
|
||
|
||
-- 返回执行结果
|
||
select result, error, productname, productamount, productmoney, playername;
|
||
end
|
||
;;
|
||
delimiter ;
|
||
|
||
-- ----------------------------
|
||
-- Procedure structure for cp_sales_pay_query
|
||
-- ----------------------------
|
||
DROP PROCEDURE IF EXISTS `cp_sales_pay_query`;
|
||
delimiter ;;
|
||
CREATE PROCEDURE `cp_sales_pay_query`(IN `agentid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci ,IN `openid` varchar(100) charset utf8mb4 collate utf8mb4_general_ci ,IN `billcode` varchar(50) charset utf8mb4 collate utf8mb4_general_ci ,IN `paymoney` decimal(10,2) ,IN `appid` varchar(50) charset utf8mb4 collate utf8mb4_general_ci ,IN `devkey` varchar(50) charset utf8mb4 collate utf8mb4_general_ci ,IN `business_id` varchar(50) charset utf8mb4 collate utf8mb4_general_ci ,IN `parentid` int(8))
|
||
SQL SECURITY INVOKER
|
||
COMMENT '订单支付查询成功,修改实际支付金额'
|
||
label_cp: begin
|
||
declare result tinyint(1); -- 0:成功 >0:失败
|
||
declare error varchar(100); -- 失败描述
|
||
declare agentname varchar(100); -- 代理商名称
|
||
declare username varchar(100); -- 微信公众号用户昵称
|
||
declare usersalesman tinyint(1); -- 微信公众号用户是否是个人代理
|
||
declare billtype tinyint(1); -- 订单类型
|
||
declare playerid int(8); -- 充入者玩家id
|
||
declare playername varchar(100); -- 充入者昵称
|
||
declare amount int(11); -- 购卡数量
|
||
declare money decimal(10,2);-- 产品中的所需金额
|
||
declare paystate tinyint(1); -- 支付状态
|
||
declare roomcard int(11); -- 购卡后房卡数量
|
||
|
||
set result = 0;
|
||
|
||
-- 检验agentid
|
||
call cp_check_1_agent(agentid, result, error, agentname);
|
||
if result > 0 then
|
||
select result, error;
|
||
leave label_cp;
|
||
end if;
|
||
|
||
-- 检验微信公众号用户
|
||
call cp_check_4_salesuser(agentid, openid, result, error, username, usersalesman);
|
||
if result > 0 then
|
||
select result, error;
|
||
leave label_cp;
|
||
end if;
|
||
|
||
-- 检验订单
|
||
call cp_check_6_buybill(agentid, billcode, result, error, billtype, playerid, playername, amount, money, paystate);
|
||
if result > 0 then
|
||
select result, error;
|
||
leave label_cp;
|
||
end if;
|
||
|
||
-- 修改实际支付金额
|
||
update sales_buybill set sabu_paymoney = paymoney,
|
||
sabu_appid = appid, sabu_devkey = devkey,
|
||
sabu_business_id = business_id
|
||
where sabu_agentid = agentid and sabu_billcode = billcode;
|
||
|
||
-- 返回执行结果
|
||
if (billtype = 0) then
|
||
-- 返回玩家购卡后的房卡数量
|
||
select play_roomcard into roomcard from player where play_agentid = agentid and play_playerid = playerid;
|
||
|
||
-- 返回执行结果
|
||
select result, error, billtype, playerid, playername, amount, roomcard;
|
||
else
|
||
-- 无推荐人
|
||
if isnull(parentid) or (parentid = '') or (parentid = 0) then
|
||
select result, error, billtype, saus_salesid as salesid,
|
||
saus_nickname as salesname, amount, saus_roomcard as roomcard
|
||
from sales_user where saus_agentid = agentid and saus_openid = openid;
|
||
else
|
||
select result, error, billtype, u.saus_salesid as salesid,
|
||
u.saus_nickname as salesname, amount, u.saus_roomcard as roomcard,
|
||
p.saus_salesid as parentid, p.saus_nickname as parentname
|
||
from sales_user as u
|
||
left join sales_user as p on p.saus_agentid = agentid
|
||
and p.saus_salesid = u.saus_parentid
|
||
where u.saus_agentid = agentid
|
||
and u.saus_openid = openid;
|
||
end if;
|
||
end if;
|
||
end
|
||
;;
|
||
delimiter ;
|
||
|
||
-- ----------------------------
|
||
-- Procedure structure for cp_sales_pay_succ
|
||
-- ----------------------------
|
||
DROP PROCEDURE IF EXISTS `cp_sales_pay_succ`;
|
||
delimiter ;;
|
||
CREATE PROCEDURE `cp_sales_pay_succ`(IN `agentid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci ,IN `channelid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci ,IN `openid` varchar(100) charset utf8mb4 collate utf8mb4_general_ci ,IN `billcode` varchar(50) charset utf8mb4 collate utf8mb4_general_ci ,IN `transid` varchar(100) charset utf8mb4 collate utf8mb4_general_ci ,IN `outtradeNo` varchar(100) charset utf8mb4 collate utf8mb4_general_ci ,IN `signkey` varchar(50) charset utf8mb4 collate utf8mb4_general_ci ,IN `paymoney` decimal(10,2) ,IN `parentid` int(8))
|
||
SQL SECURITY INVOKER
|
||
COMMENT '订单支付成功'
|
||
label_cp: begin
|
||
declare result tinyint(1); -- 0:成功 >0:失败
|
||
declare error varchar(100); -- 失败描述
|
||
declare agentname varchar(100); -- 代理商名称
|
||
declare username varchar(100); -- 微信公众号用户昵称
|
||
declare usersalesman tinyint(1); -- 微信公众号用户是否是个人代理
|
||
declare usersalesid int(8); -- 个人代理id
|
||
declare userparentid int(8); -- 上级个人代理id
|
||
declare billtype tinyint(1); -- 订单类型
|
||
declare playerid int(8); -- 充入者玩家id
|
||
declare playername varchar(100); -- 充入者昵称
|
||
declare amount int(11); -- 购卡数量
|
||
declare money decimal(10,2);-- 产品中的所需金额
|
||
declare paystate tinyint(1); -- 支付状态
|
||
declare roomcard int(11); -- 购卡后房卡数量
|
||
declare salesid int(8); -- 新代理id
|
||
declare salespower varchar(10); -- 默认的个人代理权限
|
||
|
||
declare salesid1 int(8); -- 玩家绑定的上一级个人代理id
|
||
declare salesid2 int(8); -- 玩家绑定的上二级个人代理id
|
||
declare pushrate1 int(4); -- 玩家的上一级代理的提成比例
|
||
declare pushrate2 int(4); -- 玩家的上二级代理的提成比例
|
||
|
||
set result = 0;
|
||
|
||
-- 检验agentid
|
||
call cp_check_1_agent(agentid, result, error, agentname);
|
||
if result > 0 then
|
||
select result, error;
|
||
leave label_cp;
|
||
end if;
|
||
|
||
-- 检验微信公众号用户
|
||
call cp_check_4_salesuser(agentid, openid, result, error, username, usersalesman);
|
||
if result > 0 then
|
||
select result, error;
|
||
leave label_cp;
|
||
end if;
|
||
|
||
-- 检验订单
|
||
call cp_check_6_buybill(agentid, billcode, result, error, billtype, playerid, playername, amount, money, paystate);
|
||
if result > 0 then
|
||
select result, error;
|
||
leave label_cp;
|
||
end if;
|
||
|
||
if paystate = 1 then
|
||
set result = 11;
|
||
set error = '订单已支付';
|
||
select result, error;
|
||
leave label_cp;
|
||
end if;
|
||
|
||
-- 获取渠道商id
|
||
if not exists (select 1 from agent_channel where agch_agentid = agentid and agch_channelid = channelid) then
|
||
select agch_channelid into channelid from agent_channel where agch_agentid = agentid order by idx limit 1;
|
||
end if;
|
||
|
||
-- 检验signkey
|
||
if not exists(select 1 from agent_channel where agch_agentid = agentid and agch_channelid = channelid and agch_youle_signkey = signkey) then
|
||
set result = 12;
|
||
set error = '微信支付签名不正确';
|
||
select result, error;
|
||
leave label_cp;
|
||
end if;
|
||
|
||
-- 修改订单状态
|
||
update sales_buybill set sabu_paystate = 1, sabu_paytime = now(),
|
||
sabu_transid = transid, sabu_outtradeNo = outtradeNo,
|
||
sabu_signkey = signkey, sabu_paymoney = paymoney
|
||
where sabu_agentid = agentid and sabu_billcode = billcode;
|
||
|
||
-- 统计总流水
|
||
update agent set agen_selftotal = agen_selftotal + paymoney where agen_agentid = agentid;
|
||
|
||
-- 按日期统计房卡销售金额
|
||
call cp_report_agent_day(agentid, 3, paymoney);
|
||
|
||
-- 检验支付金额
|
||
if paymoney <> money then
|
||
set result = 13;
|
||
set error = '支付金额不正确';
|
||
select result, error;
|
||
leave label_cp;
|
||
end if;
|
||
|
||
-- 完成购买任意金额房卡的任务
|
||
call cp_sales_finish_task(agentid, openid, null, 'heB1piC7b8M4nfifn34k9ouV2qL9osTM');
|
||
|
||
if (billtype = 0) then
|
||
-- 修改玩家房卡数量
|
||
update player set play_roomcard = play_roomcard + amount
|
||
where play_agentid = agentid and play_playerid = playerid;
|
||
|
||
-- 返回玩家购卡后的房卡数量
|
||
select play_roomcard into roomcard from player
|
||
where play_agentid = agentid and play_playerid = playerid;
|
||
|
||
-- 统计绑定的个人代理的提成
|
||
select play_invitecode into salesid1
|
||
from player
|
||
where play_agentid = agentid and play_playerid = playerid;
|
||
|
||
if not isnull(salesid1) then
|
||
select saus_parentid, saus_pushrate1 into salesid2, pushrate1
|
||
from sales_user
|
||
where saus_agentid = agentid and saus_salesid = salesid1;
|
||
|
||
update sales_buybill set sabu_pushsalesid1 = salesid1,
|
||
sabu_pushrate1 = pushrate1,
|
||
sabu_pushmoney1 = if(isnull(pushrate1), null, paymoney * pushrate1 / 100)
|
||
where sabu_agentid = agentid and sabu_billcode = billcode;
|
||
|
||
if not isnull(pushrate1) then
|
||
update sales_user set saus_pushmoney1 = saus_pushmoney1 + paymoney * pushrate1 / 100
|
||
where saus_agentid = agentid and saus_salesid = salesid1;
|
||
end if;
|
||
|
||
if not isnull(salesid2) then
|
||
select saus_pushrate2 into pushrate2
|
||
from sales_user
|
||
where saus_agentid = agentid and saus_salesid = salesid2;
|
||
|
||
update sales_buybill set sabu_pushsalesid2 = salesid2,
|
||
sabu_pushrate2 = pushrate2,
|
||
sabu_pushmoney2 = if(isnull(pushrate2), null, paymoney * pushrate2 / 100)
|
||
where sabu_agentid = agentid and sabu_billcode = billcode;
|
||
|
||
if not isnull(pushrate2) then
|
||
update sales_user set saus_pushmoney2 = saus_pushmoney2 + paymoney * pushrate2 / 100
|
||
where saus_agentid = agentid and saus_salesid = salesid2;
|
||
end if;
|
||
end if;
|
||
end if;
|
||
|
||
-- 返回执行结果
|
||
select result, error, billtype, playerid, playername, amount, roomcard;
|
||
else
|
||
if (usersalesman = 0) then
|
||
-- 新个人代理
|
||
update agent set agen_maxsalesid = agen_maxsalesid + floor(rand() * (12-6) + 6) where agen_agentid = agentid;
|
||
|
||
select agen_maxsalesid, agen_salespower
|
||
into salesid, salespower
|
||
from agent
|
||
where agen_agentid = agentid;
|
||
|
||
-- 无推荐人
|
||
if isnull(parentid) or (parentid = '') or (parentid = 0) then
|
||
update sales_user set saus_roomcard = saus_roomcard + amount,
|
||
saus_salesman = 1, saus_salesid = salesid,
|
||
saus_level = 0, saus_saletime = now(),
|
||
saus_salestype = 1, saus_power = salespower
|
||
where saus_agentid = agentid and saus_openid = openid;
|
||
else -- 有推荐人
|
||
update sales_user set saus_roomcard = saus_roomcard + amount,
|
||
saus_salesman = 1, saus_salesid = salesid,
|
||
saus_saletime = now(),
|
||
saus_salestype = 1, saus_power = salespower,
|
||
saus_parentid = parentid
|
||
where saus_agentid = agentid and saus_openid = openid;
|
||
|
||
-- 推荐人奖励
|
||
call cp_sales_new_award(agentid, parentid, salesid, 0, billcode);
|
||
end if;
|
||
|
||
-- 按日期统计新增个人代理人数
|
||
call cp_report_agent_day(agentid, 1, 1);
|
||
else
|
||
-- 老个人代理
|
||
update sales_user set saus_roomcard = saus_roomcard + amount
|
||
where saus_agentid = agentid and saus_openid = openid;
|
||
|
||
-- 推荐人的奖励
|
||
select saus_salesid, saus_parentid into usersalesid, userparentid
|
||
from sales_user where saus_agentid = agentid and saus_openid = openid;
|
||
if not isnull(userparentid) then
|
||
call cp_sales_new_award(agentid, userparentid, usersalesid, 1, billcode);
|
||
end if;
|
||
end if;
|
||
|
||
-- 返回执行结果
|
||
select result, error, billtype;
|
||
end if;
|
||
end
|
||
;;
|
||
delimiter ;
|
||
|
||
-- ----------------------------
|
||
-- Procedure structure for cp_sales_player_binding_invitecode
|
||
-- ----------------------------
|
||
DROP PROCEDURE IF EXISTS `cp_sales_player_binding_invitecode`;
|
||
delimiter ;;
|
||
CREATE PROCEDURE `cp_sales_player_binding_invitecode`(IN `agentid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci ,IN `openid` varchar(100) charset utf8mb4 collate utf8mb4_general_ci ,IN `invitecode` int(8))
|
||
SQL SECURITY INVOKER
|
||
COMMENT '玩家自动绑定邀请码'
|
||
label_cp: begin
|
||
declare result tinyint(1); -- 0:成功 >0:失败
|
||
declare error varchar(100); -- 失败描述
|
||
|
||
declare salesid int(8);
|
||
declare nickname varchar(100);
|
||
declare avatar varchar(200);
|
||
declare wechat varchar(50);
|
||
declare tel varchar(20);
|
||
|
||
declare myinvitecode int(8); -- 已经绑定的邀请码
|
||
|
||
-- 检验邀请码是否存在
|
||
select saus_salesid, saus_nickname, saus_avatar, saus_wechat, saus_tel
|
||
into salesid, nickname, avatar, wechat, tel
|
||
from sales_user
|
||
where saus_agentid = agentid
|
||
and saus_salesid = invitecode
|
||
and saus_salesman = 1;
|
||
|
||
if isnull(salesid) then
|
||
set result = 1;
|
||
set error = '邀请码不存在';
|
||
select result, error;
|
||
leave label_cp;
|
||
end if;
|
||
|
||
-- 检查是否已经绑定了邀请码
|
||
select saus_invitecode into myinvitecode
|
||
from sales_user
|
||
where saus_agentid = agentid
|
||
and saus_openid = openid;
|
||
|
||
if isnull(myinvitecode) then
|
||
update sales_user
|
||
set saus_invitecode = invitecode
|
||
where saus_agentid = agentid
|
||
and saus_openid = openid;
|
||
|
||
set result = 0;
|
||
set error = '绑定邀请码成功';
|
||
else
|
||
set result = 2;
|
||
set error = '已经绑定过邀请码,不能再次绑定';
|
||
|
||
select saus_salesid, saus_nickname, saus_avatar, saus_wechat, saus_tel
|
||
into salesid, nickname, avatar, wechat, tel
|
||
from sales_user
|
||
where saus_agentid = agentid
|
||
and saus_salesid = myinvitecode
|
||
and saus_salesman = 1;
|
||
end if;
|
||
|
||
select result, error, salesid, nickname, avatar, wechat, tel;
|
||
end
|
||
;;
|
||
delimiter ;
|
||
|
||
-- ----------------------------
|
||
-- Procedure structure for cp_sales_query_player
|
||
-- ----------------------------
|
||
DROP PROCEDURE IF EXISTS `cp_sales_query_player`;
|
||
delimiter ;;
|
||
CREATE PROCEDURE `cp_sales_query_player`(IN `agentid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci ,IN `openid` varchar(100) charset utf8mb4 collate utf8mb4_general_ci ,IN `playerid` int(8))
|
||
SQL SECURITY INVOKER
|
||
COMMENT '通过玩家id查询玩家昵称和房卡数量'
|
||
label_cp: begin
|
||
declare result tinyint(1); -- 0:成功 >0:失败
|
||
declare error varchar(100); -- 失败描述
|
||
declare agentname varchar(100); -- 代理商名称
|
||
declare roomcard int(11); -- 个人代理房卡数量
|
||
declare playername varchar(100); -- 充入者的昵称
|
||
declare playerroomcard int(11); -- 充入者的房卡数量
|
||
|
||
set result = 0;
|
||
-- 检验agentid
|
||
call cp_check_1_agent(agentid, result, error, agentname);
|
||
if result > 0 then
|
||
select result, error;
|
||
leave label_cp;
|
||
end if;
|
||
|
||
-- 检验是否是个人代理
|
||
call cp_check_7_salesman(agentid, openid, result, error, roomcard);
|
||
if result > 0 then
|
||
select result, error;
|
||
leave label_cp;
|
||
end if;
|
||
|
||
-- 检验playerid
|
||
call cp_check_2_player(agentid, playerid, result, error, playername, playerroomcard);
|
||
if result > 0 then
|
||
select result, error;
|
||
leave label_cp;
|
||
end if;
|
||
|
||
select result, error, playerid, playername, playerroomcard;
|
||
end
|
||
;;
|
||
delimiter ;
|
||
|
||
-- ----------------------------
|
||
-- Procedure structure for cp_sales_query_player_bean
|
||
-- ----------------------------
|
||
DROP PROCEDURE IF EXISTS `cp_sales_query_player_bean`;
|
||
delimiter ;;
|
||
CREATE PROCEDURE `cp_sales_query_player_bean`(IN `agentid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci ,IN `openid` varchar(100) charset utf8mb4 collate utf8mb4_general_ci ,IN `playerid` int(8))
|
||
SQL SECURITY INVOKER
|
||
COMMENT '通过玩家id查询玩家昵称和房卡数量'
|
||
label_cp: begin
|
||
declare result tinyint(1); -- 0:成功 >0:失败
|
||
declare error varchar(100); -- 失败描述
|
||
declare _playerid int(8);
|
||
declare playername varchar(100); -- 玩家的昵称
|
||
declare playerbean int(11); -- 玩家的星星数量
|
||
|
||
set result = 0;
|
||
-- 检验agentid
|
||
if not exists(select 1 from agent where agen_agentid = agentid) then
|
||
set result = 1;
|
||
set error = '运营商不存在';
|
||
select result, error;
|
||
leave label_cp;
|
||
end if;
|
||
|
||
-- 检验是否是个人代理
|
||
if not exists(select 1 from sales_user where saus_agentid = agentid and saus_openid = openid and saus_salesman = 1) then
|
||
set result = 7;
|
||
set error = '您不是个人代理';
|
||
select result, error;
|
||
leave label_cp;
|
||
end if;
|
||
|
||
-- 检验playerid
|
||
select play_playerid, play_nickname, play_bean into _playerid, playername, playerbean
|
||
from player
|
||
where play_agentid = agentid and play_playerid = playerid;
|
||
if isnull(_playerid) then
|
||
set result = 2;
|
||
set error = '玩家不存在';
|
||
select result, error;
|
||
leave label_cp;
|
||
end if;
|
||
|
||
select result, error, playerid, playername, playerbean;
|
||
end
|
||
;;
|
||
delimiter ;
|
||
|
||
-- ----------------------------
|
||
-- Procedure structure for cp_sales_query_salesman
|
||
-- ----------------------------
|
||
DROP PROCEDURE IF EXISTS `cp_sales_query_salesman`;
|
||
delimiter ;;
|
||
CREATE PROCEDURE `cp_sales_query_salesman`(IN `agentid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci ,IN `openid` varchar(100) charset utf8mb4 collate utf8mb4_general_ci ,IN `salesid` int(8))
|
||
SQL SECURITY INVOKER
|
||
COMMENT '通过个人代理id查询个人代理昵称和房卡数量'
|
||
label_cp: begin
|
||
declare result tinyint(1); -- 0:成功 >0:失败
|
||
declare error varchar(100); -- 失败描述
|
||
declare agentname varchar(100); -- 代理商名称
|
||
declare roomcard int(11); -- 用户的房卡数量
|
||
declare salesname varchar(100); -- 查询的个人代理昵称
|
||
declare salesroomcard int(11); -- 查询的个人代理房卡数量
|
||
|
||
set result = 0;
|
||
-- 检验agentid
|
||
call cp_check_1_agent(agentid, result, error, agentname);
|
||
if result > 0 then
|
||
select result, error;
|
||
leave label_cp;
|
||
end if;
|
||
|
||
-- 检验用户是否是个人代理
|
||
call cp_check_7_salesman(agentid, openid, result, error, roomcard);
|
||
if result > 0 then
|
||
select result, error;
|
||
leave label_cp;
|
||
end if;
|
||
|
||
-- 检验salesid
|
||
call cp_check_9_salesman(agentid, salesid, result, error, salesname, salesroomcard);
|
||
if result > 0 then
|
||
select result, error;
|
||
leave label_cp;
|
||
end if;
|
||
|
||
select result, error, salesid, salesname, salesroomcard;
|
||
end
|
||
;;
|
||
delimiter ;
|
||
|
||
-- ----------------------------
|
||
-- Procedure structure for cp_sales_topup_player
|
||
-- ----------------------------
|
||
DROP PROCEDURE IF EXISTS `cp_sales_topup_player`;
|
||
delimiter ;;
|
||
CREATE PROCEDURE `cp_sales_topup_player`(IN `agentid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci ,IN `openid` varchar(100) charset utf8mb4 collate utf8mb4_general_ci ,IN `playerid` int(8) ,IN `amount` int(11))
|
||
SQL SECURITY INVOKER
|
||
COMMENT '个人代理给玩家充卡'
|
||
label_cp: begin
|
||
declare result tinyint(1); -- 0:成功 >0:失败
|
||
declare error varchar(100); -- 失败描述
|
||
declare agentname varchar(100); -- 代理商名称
|
||
declare roomcard int(11); -- 个人代理房卡数量
|
||
declare playername varchar(100); -- 充入者的昵称
|
||
declare playerroomcard int(11); -- 充入者的房卡数量
|
||
|
||
declare salespower varchar(10); -- 个人代理的权限
|
||
declare topuppower varchar(1); -- 给玩家充值权限
|
||
declare playerinvitecode int(8); -- 充入者绑定的邀请码
|
||
declare mysalesid int(8); -- 我的个人代理id
|
||
|
||
set result = 0;
|
||
-- 检验agentid
|
||
call cp_check_1_agent(agentid, result, error, agentname);
|
||
if result > 0 then
|
||
select result, error;
|
||
leave label_cp;
|
||
end if;
|
||
|
||
-- 检验是否是个人代理
|
||
call cp_check_7_salesman(agentid, openid, result, error, roomcard);
|
||
if result > 0 then
|
||
select result, error;
|
||
leave label_cp;
|
||
end if;
|
||
|
||
-- 检验playerid
|
||
call cp_check_2_player(agentid, playerid, result, error, playername, playerroomcard);
|
||
if result > 0 then
|
||
select result, error;
|
||
leave label_cp;
|
||
end if;
|
||
|
||
-- 检验个人代理的房卡数量是否够
|
||
if roomcard < amount then
|
||
set result = 11;
|
||
set error = '房卡数量不足';
|
||
select result, error;
|
||
leave label_cp;
|
||
end if;
|
||
|
||
-- 充卡数量不能是负数
|
||
if amount < 0 then
|
||
set result = 12;
|
||
set error = '充卡数量必须大于0';
|
||
select result, error;
|
||
leave label_cp;
|
||
end if;
|
||
|
||
-- 判断是否有给玩家充值的权限
|
||
select saus_salesid, saus_power
|
||
into mysalesid, salespower
|
||
from sales_user
|
||
where saus_agentid = agentid
|
||
and saus_openid = openid;
|
||
|
||
if isnull(salespower) then
|
||
select agen_salespower
|
||
into salespower
|
||
from agent
|
||
where agen_agentid = agentid;
|
||
end if;
|
||
|
||
set topuppower = substring(salespower, 2, 1);
|
||
|
||
if topuppower = '0' then
|
||
set result = 13;
|
||
set error = '您没有给玩家充卡的权限';
|
||
select result, error;
|
||
leave label_cp;
|
||
end if;
|
||
|
||
if topuppower = '1' then
|
||
select play_invitecode into playerinvitecode
|
||
from player
|
||
where play_agentid = agentid
|
||
and play_playerid = playerid;
|
||
|
||
if isnull(playerinvitecode) or (playerinvitecode <> mysalesid) then
|
||
set result = 14;
|
||
set error = '只能给绑定了自己邀请码的玩家充卡';
|
||
select result, error;
|
||
leave label_cp;
|
||
end if;
|
||
end if;
|
||
|
||
-- 保存充卡记录
|
||
insert into sales_sellbill(sase_agentid, sase_openid, sase_playerid,
|
||
sase_amount, sase_selltime)
|
||
values(agentid, openid, playerid, amount, now());
|
||
|
||
-- 修改个人代理的房卡数量
|
||
update sales_user set saus_roomcard = saus_roomcard - amount
|
||
where saus_agentid = agentid and saus_openid = openid;
|
||
|
||
select saus_roomcard into roomcard from sales_user
|
||
where saus_agentid = agentid and saus_openid = openid;
|
||
|
||
-- 修改玩家的房卡数量
|
||
update player set play_roomcard = play_roomcard + amount
|
||
where play_agentid = agentid and play_playerid = playerid;
|
||
|
||
select play_roomcard into playerroomcard from player
|
||
where play_agentid = agentid and play_playerid = playerid;
|
||
|
||
-- 返回执行结果
|
||
select result, error, roomcard, amount, playerid, playername, playerroomcard;
|
||
end
|
||
;;
|
||
delimiter ;
|
||
|
||
-- ----------------------------
|
||
-- Procedure structure for cp_sales_topup_player_bean
|
||
-- ----------------------------
|
||
DROP PROCEDURE IF EXISTS `cp_sales_topup_player_bean`;
|
||
delimiter ;;
|
||
CREATE PROCEDURE `cp_sales_topup_player_bean`(IN `agentid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci ,IN `openid` varchar(100) charset utf8mb4 collate utf8mb4_general_ci ,IN `playerid` int(8) ,IN `amount` int(11))
|
||
SQL SECURITY INVOKER
|
||
COMMENT '个人代理给玩家充星星'
|
||
label_cp: begin
|
||
declare result tinyint(1); -- 0:成功 >0:失败
|
||
declare error varchar(100); -- 失败描述
|
||
declare agentsalespower varchar(10); -- 代理商设置的默认权限
|
||
declare salesid int(8); -- 我的个人代理id
|
||
declare salespower varchar(10); -- 个人代理的权限
|
||
declare topuppower varchar(1); -- 给玩家充星星权限
|
||
declare salesbean int(11); -- 个人代理星星数量
|
||
declare _playerid int(8); -- 玩家id
|
||
declare playername varchar(100); -- 玩家昵称
|
||
declare playerbean int(11); -- 玩家星星数量
|
||
declare playerinvitecode int(8); -- 玩家绑定的邀请码
|
||
|
||
|
||
set result = 0;
|
||
|
||
-- 检验agentid
|
||
set agentsalespower = '';
|
||
select agen_salespower into agentsalespower from agent where agen_agentid = agentid;
|
||
if isnull(agentsalespower) then
|
||
set result = 1;
|
||
set error = '运营商不存在';
|
||
select result, error;
|
||
leave label_cp;
|
||
end if;
|
||
|
||
-- 检验是否是个人代理
|
||
select saus_salesid, saus_power, saus_bean into salesid, salespower, salesbean
|
||
from sales_user
|
||
where saus_agentid = agentid and saus_openid = openid and saus_salesman = 1;
|
||
if isnull(salesid) then
|
||
set result = 7;
|
||
set error = '您不是个人代理';
|
||
select result, error;
|
||
leave label_cp;
|
||
end if;
|
||
|
||
-- 检验playerid
|
||
select play_playerid, play_nickname, play_invitecode into _playerid, playername, playerinvitecode
|
||
from player
|
||
where play_agentid = agentid and play_playerid = playerid;
|
||
if isnull(_playerid) then
|
||
set result = 2;
|
||
set error = '玩家不存在';
|
||
select result, error;
|
||
leave label_cp;
|
||
end if;
|
||
|
||
-- 充值数量不能是负数
|
||
if amount < 0 then
|
||
set result = 12;
|
||
set error = '充值数量必须大于0';
|
||
select result, error;
|
||
leave label_cp;
|
||
end if;
|
||
|
||
-- 检验个人代理的星星数量是否够
|
||
if salesbean < amount then
|
||
set result = 11;
|
||
set error = '星星数量不足';
|
||
select result, error;
|
||
leave label_cp;
|
||
end if;
|
||
|
||
-- 判断是否有给玩家充值的权限
|
||
if isnull(salespower) then
|
||
set salespower = agentsalespower;
|
||
end if;
|
||
set topuppower = substring(salespower, 3, 1);
|
||
|
||
if topuppower = '' or topuppower = '0' then
|
||
set result = 13;
|
||
set error = '您没有给玩家充值的权限';
|
||
select result, error;
|
||
leave label_cp;
|
||
end if;
|
||
|
||
if topuppower = '1' then
|
||
if isnull(playerinvitecode) or (playerinvitecode <> salesid) then
|
||
set result = 14;
|
||
set error = '只能给绑定了自己邀请码的玩家充值星星';
|
||
select result, error;
|
||
leave label_cp;
|
||
end if;
|
||
end if;
|
||
|
||
-- 保存充卡记录
|
||
insert into sales_sellbill_bean(
|
||
ssbe_agentid, ssbe_openid, ssbe_playerid, ssbe_amount, ssbe_selltime)
|
||
values(agentid, openid, playerid, amount, now());
|
||
|
||
-- 修改个人代理的星星数量
|
||
update sales_user set saus_bean = saus_bean - amount
|
||
where saus_agentid = agentid and saus_openid = openid;
|
||
|
||
select saus_bean into salesbean from sales_user
|
||
where saus_agentid = agentid and saus_openid = openid;
|
||
|
||
-- 修改玩家的房卡数量
|
||
update player set play_bean = play_bean + amount
|
||
where play_agentid = agentid and play_playerid = playerid;
|
||
|
||
select play_bean into playerbean from player
|
||
where play_agentid = agentid and play_playerid = playerid;
|
||
|
||
-- 返回执行结果
|
||
select result, error, salesbean, amount, playerid, playername, playerbean;
|
||
end
|
||
;;
|
||
delimiter ;
|
||
|
||
-- ----------------------------
|
||
-- Procedure structure for cp_sales_topup_salesman
|
||
-- ----------------------------
|
||
DROP PROCEDURE IF EXISTS `cp_sales_topup_salesman`;
|
||
delimiter ;;
|
||
CREATE PROCEDURE `cp_sales_topup_salesman`(IN `agentid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci ,IN `openid` varchar(100) charset utf8mb4 collate utf8mb4_general_ci ,IN `salesid` int(8) ,IN `amount` int(11) ,IN `channelid` varchar(50) charset utf8mb4 collate utf8mb4_general_ci)
|
||
SQL SECURITY INVOKER
|
||
label_cp: begin
|
||
declare result tinyint(1);
|
||
declare error varchar(100);
|
||
declare agentname varchar(100);
|
||
declare roomcard int(11);
|
||
declare salesname varchar(100);
|
||
declare salesroomcard int(11);
|
||
|
||
declare salespower varchar(10);
|
||
declare topuppower varchar(1);
|
||
declare parentid int(8);
|
||
declare mysalesid int(8);
|
||
|
||
set result = 0;
|
||
|
||
call cp_check_1_agent(agentid, result, error, agentname);
|
||
if result > 0 then
|
||
select result, error;
|
||
leave label_cp;
|
||
end if;
|
||
|
||
|
||
call cp_check_7_salesman(agentid, openid, result, error, roomcard);
|
||
if result > 0 then
|
||
select result, error;
|
||
leave label_cp;
|
||
end if;
|
||
|
||
|
||
call cp_check_9_salesman(agentid, salesid, result, error, salesname, salesroomcard);
|
||
if result > 0 then
|
||
select result, error;
|
||
leave label_cp;
|
||
end if;
|
||
|
||
|
||
if roomcard < amount then
|
||
set result = 11;
|
||
set error = '房卡数量不足';
|
||
select result, error;
|
||
leave label_cp;
|
||
end if;
|
||
|
||
|
||
if amount < 0 then
|
||
set result = 12;
|
||
set error = '转卡数量必须大于0';
|
||
select result, error;
|
||
leave label_cp;
|
||
end if;
|
||
|
||
|
||
|
||
select saus_salesid, saus_power
|
||
into mysalesid, salespower
|
||
from sales_user
|
||
where saus_agentid = agentid
|
||
and saus_openid = openid;
|
||
|
||
if isnull(salespower) then
|
||
select agen_salespower
|
||
into salespower
|
||
from agent
|
||
where agen_agentid = agentid;
|
||
end if;
|
||
|
||
set topuppower = substring(salespower, 1, 1);
|
||
|
||
if topuppower = '0' then
|
||
set result = 13;
|
||
set error = '您没有给其他代理转卡的权限';
|
||
select result, error;
|
||
leave label_cp;
|
||
end if;
|
||
|
||
if topuppower = '1' then
|
||
select saus_parentid into parentid
|
||
from sales_user
|
||
where saus_agentid = agentid
|
||
and saus_salesid = salesid;
|
||
|
||
if isnull(parentid) or (parentid <> mysalesid) then
|
||
set result = 14;
|
||
set error = '只能给绑定了自己邀请码的子代理转卡';
|
||
select result, error;
|
||
leave label_cp;
|
||
end if;
|
||
end if;
|
||
|
||
|
||
insert into sales_transferbill(satr_agentid, satr_openid, satr_salesid,
|
||
satr_amount, satr_transfertime, channel_id)
|
||
values(agentid, openid, salesid, amount, now(), channelid);
|
||
|
||
|
||
update sales_user set saus_roomcard = saus_roomcard - amount
|
||
where saus_agentid = agentid and saus_openid = openid;
|
||
|
||
select saus_roomcard into roomcard from sales_user
|
||
where saus_agentid = agentid and saus_openid = openid;
|
||
|
||
|
||
update sales_user set saus_roomcard = saus_roomcard + amount
|
||
where saus_agentid = agentid and saus_salesid = salesid;
|
||
|
||
select saus_roomcard into salesroomcard from sales_user
|
||
where saus_agentid = agentid and saus_salesid = salesid;
|
||
|
||
|
||
select result, error, roomcard, amount, salesid, salesname, salesroomcard;
|
||
end
|
||
;;
|
||
delimiter ;
|
||
|
||
-- ----------------------------
|
||
-- Procedure structure for cp_sales_update_mywechat
|
||
-- ----------------------------
|
||
DROP PROCEDURE IF EXISTS `cp_sales_update_mywechat`;
|
||
delimiter ;;
|
||
CREATE PROCEDURE `cp_sales_update_mywechat`(IN `agentid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci ,IN `openid` varchar(100) charset utf8mb4 collate utf8mb4_general_ci ,IN `wechat` varchar(50) charset utf8mb4 collate utf8mb4_general_ci ,IN `tel` varchar(20) charset utf8mb4 collate utf8mb4_general_ci)
|
||
SQL SECURITY INVOKER
|
||
COMMENT '修改个人代理的联系方式'
|
||
label_cp: begin
|
||
declare result tinyint(1); -- 0:成功 >0:失败
|
||
declare error varchar(100); -- 失败描述
|
||
|
||
set result = 0;
|
||
|
||
-- 检验agentid
|
||
if not exists(select 1 from agent where agen_agentid = agentid) then
|
||
set result = 1;
|
||
set error = '运营商id不存在';
|
||
select result, error;
|
||
leave label_cp;
|
||
end if;
|
||
|
||
-- 检验微信公众号用户
|
||
if not exists(select 1 from sales_user where saus_agentid = agentid and saus_openid = openid) then
|
||
set result = 2;
|
||
set error = '用户不存在';
|
||
select result, error;
|
||
leave label_cp;
|
||
end if;
|
||
|
||
update sales_user set saus_wechat = wechat, saus_tel = tel
|
||
where saus_agentid = agentid and saus_openid = openid;
|
||
|
||
-- 返回执行结果
|
||
select result, error;
|
||
end
|
||
;;
|
||
delimiter ;
|
||
|
||
-- ----------------------------
|
||
-- Procedure structure for cp_sales_user_login
|
||
-- ----------------------------
|
||
DROP PROCEDURE IF EXISTS `cp_sales_user_login`;
|
||
delimiter ;;
|
||
CREATE PROCEDURE `cp_sales_user_login`(IN `agentid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci ,IN `channelid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci ,IN `openid` varchar(100) charset utf8mb4 collate utf8mb4_general_ci ,IN `unionid` varchar(100) charset utf8mb4 collate utf8mb4_general_ci ,IN `nickname` varchar(100) charset utf8mb4 collate utf8mb4_general_ci ,IN `avatar` varchar(200) charset utf8mb4 collate utf8mb4_general_ci ,IN `sex` tinyint(1) ,IN `province` varchar(100) charset utf8mb4 collate utf8mb4_general_ci ,IN `city` varchar(100) charset utf8mb4 collate utf8mb4_general_ci)
|
||
SQL SECURITY INVOKER
|
||
COMMENT '微信公众号用户登录'
|
||
begin
|
||
declare old_openid varchar(100);
|
||
declare salesman tinyint(1);
|
||
declare salesid int(8);
|
||
declare saleslevel int(4);
|
||
declare salestype tinyint(1);
|
||
declare roomcard int(11);
|
||
declare bean int(11);
|
||
declare pushmoney decimal(10,2);
|
||
declare salespower varchar(10);
|
||
declare playerask tinyint(1);
|
||
declare salesask tinyint(1);
|
||
declare invitecode int(8);
|
||
|
||
-- 获取代理商id
|
||
if not exists (select 1 from agent where agen_agentid = agentid) then
|
||
select agen_agentid into agentid from agent order by idx limit 1;
|
||
end if;
|
||
|
||
-- 获取渠道商id
|
||
if not exists (select 1 from agent_channel where agch_agentid = agentid and agch_channelid = channelid) then
|
||
select agch_channelid into channelid from agent_channel where agch_agentid = agentid order by idx limit 1;
|
||
end if;
|
||
|
||
-- 获取用户信息
|
||
select saus_openid, saus_salesman, saus_salesid, saus_level, saus_salestype,
|
||
saus_roomcard, saus_bean, saus_power, saus_invitecode,
|
||
ifnull(saus_pushmoney1, 0) + ifnull(saus_pushmoney2, 0)
|
||
into old_openid, salesman, salesid, saleslevel, salestype,
|
||
roomcard, bean, salespower, invitecode, pushmoney
|
||
from sales_user
|
||
where saus_agentid = agentid
|
||
and saus_unionid = unionid;
|
||
|
||
if isnull(old_openid) then
|
||
-- 新用户
|
||
insert into sales_user (saus_agentid, saus_channelid, saus_openid, saus_unionid,
|
||
saus_nickname, saus_avatar, saus_sex, saus_province,
|
||
saus_city, saus_firsttime, saus_lasttime)
|
||
values (agentid, channelid, openid, unionid, nickname, avatar, sex, province, city, now(), now());
|
||
else
|
||
-- 老用户
|
||
update sales_user set saus_openid = openid, saus_nickname = nickname,
|
||
saus_avatar = avatar, saus_sex = sex,
|
||
saus_province = province, saus_city = city,
|
||
saus_lasttime = now()
|
||
where saus_agentid = agentid and saus_unionid = unionid;
|
||
|
||
-- 更换了授权后openid会发生变化
|
||
if openid <> old_openid then
|
||
update sales_buybill set sabu_openid = openid where sabu_agentid = agentid and sabu_openid = old_openid;
|
||
update sales_sellbill set sase_openid = openid where sase_agentid = agentid and sase_openid = old_openid;
|
||
update sales_sellbill_bean set ssbe_openid = openid where ssbe_agentid = agentid and ssbe_openid = old_openid;
|
||
update sales_transferbill set satr_openid = openid where satr_agentid = agentid and satr_openid = old_openid;
|
||
end if;
|
||
end if;
|
||
|
||
select saus_openid, saus_salesman, saus_salesid, saus_level, saus_salestype,
|
||
saus_roomcard, saus_bean, saus_power, saus_invitecode,
|
||
ifnull(saus_pushmoney1, 0) + ifnull(saus_pushmoney2, 0)
|
||
into old_openid, salesman, salesid, saleslevel, salestype,
|
||
roomcard, bean, salespower, invitecode, pushmoney
|
||
from sales_user
|
||
where saus_agentid = agentid
|
||
and saus_unionid = unionid;
|
||
|
||
if salesman = 1 then
|
||
-- 获取是否有新的玩家索要房卡记录
|
||
if exists(select 1 from sales_ask_bill
|
||
where saab_agentid = agentid
|
||
and saab_salesid = salesid
|
||
and saab_state = 0
|
||
and saab_type = 0) then
|
||
set playerask = 1;
|
||
else
|
||
set playerask = 0;
|
||
end if;
|
||
|
||
-- 获取是否有新的代理索要房卡记录
|
||
if exists(select 1 from sales_ask_bill
|
||
where saab_agentid = agentid
|
||
and saab_salesid = salesid
|
||
and saab_state = 0
|
||
and saab_type = 1) then
|
||
set salesask = 1;
|
||
else
|
||
set salesask = 0;
|
||
end if;
|
||
end if;
|
||
|
||
-- 完成关注公众号的任务
|
||
call cp_sales_finish_task(agentid, null, unionid, 'lXA1XUuHPvKyupdGlbQI4y5D37Kbgodo');
|
||
|
||
-- 看是否绑定过邀请码
|
||
if isnull(invitecode) then
|
||
select play_invitecode into invitecode
|
||
from player
|
||
where play_agentid = agentid
|
||
and play_unionid = unionid;
|
||
|
||
if not isnull(invitecode) then
|
||
update sales_user set saus_invitecode = invitecode
|
||
where saus_agentid = agentid
|
||
and saus_unionid = unionid;
|
||
end if;
|
||
end if;
|
||
|
||
-- 返回结果
|
||
select salesman, salesid, saleslevel, salestype, roomcard, bean,
|
||
salespower, playerask, salesask, pushmoney;
|
||
end
|
||
;;
|
||
delimiter ;
|
||
|
||
-- ----------------------------
|
||
-- Procedure structure for cp_SynchronizeSettle
|
||
-- ----------------------------
|
||
DROP PROCEDURE IF EXISTS `cp_SynchronizeSettle`;
|
||
delimiter ;;
|
||
CREATE PROCEDURE `cp_SynchronizeSettle`()
|
||
SQL SECURITY INVOKER
|
||
begin
|
||
declare nErrorCode integer default 0; -- 错误标志
|
||
declare szSqlState varchar(1000); -- sql执行状态(错误号)
|
||
declare szMessages varchar(1000); -- 错误信息
|
||
declare nLine integer default 0; --
|
||
|
||
declare szDatetime varchar(100); -- 战绩表的年月
|
||
declare dtReport datetime;
|
||
declare nCursorDone int default 0; -- 游标状态
|
||
declare cc_grade cursor for select date_format(plgr_makewartime, '%Y%m') from game_db_temp.player_grade group by date_format(plgr_makewartime, '%Y%m');
|
||
declare cc_user_commission cursor for select date_format(goac_time, '%Y%m') from game_db_temp.gold_account group by date_format(goac_time, '%Y%m');
|
||
-- 将结束标志绑定到游标
|
||
declare continue handler for not found set nCursorDone = 1;
|
||
|
||
-- 错误处理
|
||
declare continue handler for sqlexception
|
||
begin
|
||
set nErrorCode = 1;
|
||
get diagnostics condition 1 szSqlState = returned_sqlstate, szMessages = message_text;
|
||
-- select unix_timestamp(curdate()), szSqlState, szMessages;
|
||
end;
|
||
|
||
start transaction;
|
||
|
||
/*
|
||
-- 同步战绩数据
|
||
insert into
|
||
ct_grade_temp
|
||
(
|
||
agent_id,
|
||
channel_id,
|
||
game_id,
|
||
player_id,
|
||
room_code,
|
||
room_type,
|
||
owner_id,
|
||
room_card,
|
||
owner_card,
|
||
create_time,
|
||
makewar_time,
|
||
over_time,
|
||
short_number,
|
||
deduct_type,
|
||
deduct_card,
|
||
aset_count,
|
||
room_mode,
|
||
out_id
|
||
)
|
||
select
|
||
plgr_agentid,
|
||
null,
|
||
plgr_gameid,
|
||
plgr_playerid,
|
||
plgr_roomcode,
|
||
plgr_roomtype,
|
||
plgr_ownerid,
|
||
plgr_roomcard,
|
||
plgr_ownercard,
|
||
plgr_createtime,
|
||
plgr_makewartime,
|
||
plgr_overtime,
|
||
plgr_shortcode,
|
||
plgr_deducttype,
|
||
plgr_deductcard,
|
||
plgr_asetcount,
|
||
plgr_roommode,
|
||
idx
|
||
from
|
||
game_db_temp.player_grade
|
||
where
|
||
idx not in (select out_id from ct_grade_temp);
|
||
*/
|
||
|
||
-- 同步并计算分成数据
|
||
insert into
|
||
ct_user_commission
|
||
(
|
||
agent_id,
|
||
channel_id,
|
||
game_id,
|
||
room_id,
|
||
player_id,
|
||
user_id,
|
||
parent_user_id,
|
||
room_code,
|
||
short_number,
|
||
used_card,
|
||
owner_id,
|
||
room_type,
|
||
room_mode,
|
||
commission_type,
|
||
grade,
|
||
source_mode,
|
||
target_mode,
|
||
target_id,
|
||
mode,
|
||
type,
|
||
commission_total,
|
||
commission_system,
|
||
commission_user,
|
||
commission_parent_user,
|
||
commission_owner,
|
||
commission_user_rate,
|
||
commission_parent_user_rate,
|
||
commission_owner_rate,
|
||
create_time,
|
||
is_robot,
|
||
out_id
|
||
)
|
||
select
|
||
agent_id,
|
||
channel_id,
|
||
game_id,
|
||
room_id,
|
||
player_id,
|
||
user_id,
|
||
parent_user_id,
|
||
room_code,
|
||
short_number,
|
||
used_card,
|
||
owner_id,
|
||
room_type,
|
||
room_mode,
|
||
commission_type,
|
||
grade,
|
||
source_mode,
|
||
target_mode,
|
||
target_id,
|
||
mode,
|
||
type,
|
||
ifnull(commission_total, 0) commission_total, -- 累计抽成数
|
||
case target_mode
|
||
when 0 then
|
||
(ifnull(commission_total, 0)) - -- 累计抽成数
|
||
(ifnull(commission_total, 0) * ifnull(user_rate, 0)) - -- 绑定的代理抽成数
|
||
(ifnull(commission_total, 0) * ifnull(parent_user_rate, 0)) - -- 绑定的代理的上级代理抽成数
|
||
(ifnull(commission_total, 0) * ifnull(owner_rate, 0)) -- 房主的抽成数
|
||
else
|
||
0
|
||
end commission_system, -- 系统抽成数
|
||
(ifnull(commission_total, 0) * ifnull(user_rate, 0)) commission_user, -- 绑定的代理抽成数
|
||
(ifnull(commission_total, 0) * ifnull(parent_user_rate, 0)) commission_parent_user, -- 绑定的代理的上级代理抽成数
|
||
(ifnull(commission_total, 0) * ifnull(owner_rate, 0)) commission_owner, -- 房主的抽成数
|
||
ifnull(user_rate, 0) commission_user_rate, -- 绑定的代理抽成比例
|
||
ifnull(parent_user_rate, 0) commission_parent_user_rate, -- 绑定的代理的上级代理抽成比例
|
||
ifnull(owner_rate, 0) commission_owner_rate, -- 房主的抽成比例
|
||
create_time,
|
||
is_robot,
|
||
out_id
|
||
from
|
||
(
|
||
select
|
||
a.agent_id,
|
||
a.channel_id,
|
||
a.game_id,
|
||
a.room_id,
|
||
a.player_id,
|
||
a.user_id,
|
||
a.parent_user_id,
|
||
a.room_code,
|
||
a.short_number,
|
||
a.used_card,
|
||
a.owner_id,
|
||
a.room_type,
|
||
a.room_mode,
|
||
a.commission_type,
|
||
a.grade,
|
||
a.source_mode,
|
||
a.target_mode,
|
||
a.target_id,
|
||
a.mode,
|
||
a.type,
|
||
a.commission_total,
|
||
case
|
||
when 0 = ifnull(a.target_mode, 0) and 0 = ifnull(a.is_robot, 0) then
|
||
case
|
||
when (0 = a.user_id) or (0 != a.user_is_admin) then 0
|
||
else case ifnull(d.is_custom, 0)
|
||
when 0 then c.user_commission_rate
|
||
else d.commission_rate
|
||
end
|
||
end
|
||
+
|
||
case
|
||
when ((0 != a.user_id) and (0 = a.user_is_admin)) and ((0 = a.parent_user_id) or (0 != a.parent_user_is_admin)) and (1 = b.service_type) then
|
||
case ifnull(d.is_custom, 0)
|
||
when 0 then
|
||
c.parent_user_commission_rate
|
||
else
|
||
d.parent_commission_rate
|
||
end
|
||
else 0
|
||
end
|
||
|
||
else 0
|
||
end user_rate,
|
||
|
||
case
|
||
when 0 = ifnull(a.target_mode, 0) and 0 = ifnull(a.is_robot, 0) then
|
||
case
|
||
when (0 = a.parent_user_id) or (0 != a.parent_user_is_admin) then 0
|
||
else case ifnull(d.is_custom, 0)
|
||
when 0 then c.parent_user_commission_rate
|
||
else d.parent_commission_rate
|
||
end
|
||
end
|
||
|
||
else 0
|
||
end parent_user_rate,
|
||
|
||
case
|
||
when 0 = ifnull(a.target_mode, 0) and 0 = ifnull(a.is_robot, 0) then
|
||
case ifnull(d.is_custom, 0)
|
||
when 0 then c.owner_commission_rate
|
||
else d.owner_commission_rate
|
||
end
|
||
|
||
else 0
|
||
end owner_rate,
|
||
|
||
a.user_is_admin,
|
||
a.parent_user_is_admin,
|
||
a.create_time,
|
||
a.is_robot,
|
||
a.out_id
|
||
from
|
||
(
|
||
select
|
||
if(a.goac_isrobot = 0, a.goac_agentid, e.agent_id) agent_id,
|
||
if(a.goac_isrobot = 0, b.play_channelid, e.channel_id) channel_id,
|
||
a.goac_gameid game_id,
|
||
a.goac_id room_id,
|
||
a.goac_playerid player_id,
|
||
if(a.goac_isrobot = 0, ifnull(b.play_invitecode, 0), 0) user_id,
|
||
ifnull(c.global_power, 0) user_is_admin,
|
||
ifnull(c.saus_parentid, 0) parent_user_id,
|
||
ifnull(d.global_power, 0) parent_user_is_admin,
|
||
a.goac_roomcode room_code,
|
||
a.goac_shortcode short_number,
|
||
a.goac_roomcard used_card,
|
||
a.goac_ownerid owner_id,
|
||
null room_type,
|
||
a.goac_roommode room_mode,
|
||
case a.goac_roommode
|
||
when 0 then '001'
|
||
when 1 then '001'
|
||
else '001'
|
||
end commission_type,
|
||
a.goac_grade grade,
|
||
a.goac_rebatefrom source_mode,
|
||
a.goac_rebateto target_mode,
|
||
case a.goac_rebateto
|
||
when 0 then 0 -- 0-抽成给系统
|
||
when 1 then a.goac_ownerid -- 1-抽成给房主
|
||
when 2 then a.goac_toplayerid -- 2-抽成给指定玩家
|
||
when 3 then a.goac_toplayerid -- 3-抽成给指定玩家的代理账号
|
||
when 4 then a.goac_ownerid -- 4-抽成给房主的代理账号
|
||
end target_id,
|
||
a.goac_rebatemode mode,
|
||
a.goac_datatype type,
|
||
if(a.goac_rebatevalue < 0, 0, a.goac_rebatevalue) commission_total,
|
||
a.goac_time create_time,
|
||
a.goac_isrobot is_robot,
|
||
a.idx out_id
|
||
from
|
||
game_db_temp.gold_account a
|
||
left join
|
||
player b
|
||
on
|
||
a.goac_agentid = b.play_agentid and a.goac_playerid = b.play_playerid
|
||
left join
|
||
sales_user c
|
||
on
|
||
b.play_agentid = c.saus_agentid and b.play_channelid = c.saus_channelid and b.play_invitecode = c.saus_salesid
|
||
left join
|
||
sales_user d
|
||
on
|
||
c.saus_agentid = d.saus_agentid and c.saus_channelid = d.saus_channelid and c.saus_parentid = d.saus_salesid
|
||
left join
|
||
ct_channel_list e
|
||
on
|
||
a.goac_agentid = e.agent_id
|
||
) a
|
||
inner join
|
||
ct_channel_list b
|
||
on
|
||
a.agent_id = b.agent_id and a.channel_id = b.channel_id
|
||
left join
|
||
ct_agent_commission c
|
||
on
|
||
a.agent_id = c.agent_id and a.channel_id = c.channel_id and a.commission_type = c.type_id
|
||
left join
|
||
ct_agent_commission_user d
|
||
on
|
||
a.agent_id = d.agent_id and a.channel_id = d.channel_id and c.type_id = d.type_id and a.user_id = d.user_id
|
||
) t
|
||
where
|
||
t.out_id not in (select out_id from ct_user_commission);
|
||
|
||
set nLine := nLine + 1;
|
||
|
||
-- 转移指定了接收代理编号的抽水金币数
|
||
update
|
||
sales_user a,
|
||
(
|
||
select
|
||
service_id,
|
||
agent_id,
|
||
channel_id,
|
||
sales_id,
|
||
type,
|
||
total_value,
|
||
total_value - sub_value real_value,
|
||
sub_value,
|
||
unix_timestamp() create_time
|
||
from
|
||
(
|
||
select
|
||
a.service_id,
|
||
a.agent_id,
|
||
a.channel_id,
|
||
a.sales_id,
|
||
a.total_value,
|
||
a.type,
|
||
case a.type
|
||
when 0 then 0
|
||
when 1 then a.value * a.total_value
|
||
when 2 then a.value
|
||
else 0
|
||
end sub_value,
|
||
case concat(a.agent_id, a.channel_id, a.sales_id)
|
||
when @g then @i := @i + 1
|
||
else @i := 1
|
||
end rn,
|
||
@g := concat(a.agent_id, a.channel_id, a.sales_id)
|
||
from
|
||
(
|
||
select
|
||
a.agent_id,
|
||
a.channel_id,
|
||
c.saus_salesid sales_id,
|
||
sum(a.commission_total) total_value,
|
||
b.id service_id,
|
||
b.type,
|
||
b.value,
|
||
b.min_value,
|
||
b.max_value
|
||
from
|
||
ct_user_commission a
|
||
inner join
|
||
ct_agent_service b
|
||
on
|
||
a.agent_id = b.agent_id and a.channel_id = b.channel_id
|
||
inner join
|
||
ct_sales_player c
|
||
on
|
||
a.agent_id = c.agent_id and a.channel_id = c.channel_id and a.target_id = c.play_playerid
|
||
where
|
||
ifnull(a.target_mode, 0) in (3, 4) and -- 转给指定的玩家对应的代理账号
|
||
a.is_settle = 0 and
|
||
b.type != 0
|
||
group by
|
||
a.agent_id,
|
||
a.channel_id,
|
||
c.saus_salesid,
|
||
b.type,
|
||
b.value,
|
||
b.min_value,
|
||
b.max_value
|
||
) a,
|
||
(select @g := '') g,
|
||
(select @i := 0) i
|
||
where
|
||
(a.total_value >= a.min_value or -1 = a.min_value) and
|
||
(a.total_value <= a.max_value or -1 = a.max_value)
|
||
) t
|
||
where
|
||
rn = 1
|
||
) b
|
||
set
|
||
#a.saus_bean = a.saus_bean + b.real_value
|
||
a.currency_total = ifnull(a.currency_total, 0) + b.real_value,
|
||
a.currency_withdraw = ifnull(a.currency_withdraw, 0) + b.real_value
|
||
where
|
||
a.saus_agentid = b.agent_id and
|
||
a.saus_channelid = b.channel_id and
|
||
a.saus_salesid = b.sales_id;
|
||
/*
|
||
set nLine := nLine + 1;
|
||
|
||
-- 更新统一用户帐户表
|
||
update
|
||
ct_user_account a,
|
||
(
|
||
select
|
||
a.service_id,
|
||
a.agent_id,
|
||
a.channel_id,
|
||
b.user_id,
|
||
a.sales_id,
|
||
a.total_value,
|
||
a.total_value - a.sub_value real_value,
|
||
a.sub_value,
|
||
now() create_time
|
||
from
|
||
(
|
||
select
|
||
a.service_id,
|
||
a.agent_id,
|
||
a.channel_id,
|
||
a.sales_id,
|
||
a.total_value,
|
||
a.type,
|
||
case a.type
|
||
when 0 then 0
|
||
when 1 then a.value * a.total_value
|
||
when 2 then a.value
|
||
else 0
|
||
end sub_value,
|
||
case concat(a.agent_id, a.channel_id, a.sales_id)
|
||
when @g then @i := @i + 1
|
||
else @i := 1
|
||
end rn,
|
||
@g := concat(a.agent_id, a.channel_id, a.sales_id)
|
||
from
|
||
(
|
||
select
|
||
a.agent_id,
|
||
a.channel_id,
|
||
c.saus_salesid sales_id,
|
||
sum(a.commission_total) total_value,
|
||
b.id service_id,
|
||
b.type,
|
||
b.value,
|
||
b.min_value,
|
||
b.max_value
|
||
from
|
||
ct_user_commission a
|
||
inner join
|
||
ct_agent_service b
|
||
on
|
||
a.agent_id = b.agent_id and a.channel_id = b.channel_id
|
||
inner join
|
||
ct_sales_player c
|
||
on
|
||
a.agent_id = c.agent_id and a.channel_id = c.channel_id and a.target_id = c.play_playerid
|
||
where
|
||
ifnull(a.target_mode, 0) in (3, 4) and -- 转给指定的玩家对应的代理账号
|
||
a.is_settle = 0 and
|
||
b.type != 0
|
||
group by
|
||
a.agent_id,
|
||
a.channel_id,
|
||
c.saus_salesid,
|
||
b.type,
|
||
b.value,
|
||
b.min_value,
|
||
b.max_value
|
||
) a,
|
||
(select @g := '') g,
|
||
(select @i := 0) i
|
||
where
|
||
(a.total_value >= a.min_value or -1 = a.min_value) and
|
||
(a.total_value <= a.max_value or -1 = a.max_value)
|
||
) a
|
||
inner join
|
||
sales_user b
|
||
on
|
||
a.agent_id = b.saus_agentid and a.channel_id = b.saus_channelid and a.sales_id = b.saus_salesid
|
||
where
|
||
rn = 1
|
||
) b
|
||
set
|
||
a.currency = a.currency + b.real_value
|
||
where
|
||
a.user_id = b.user_id;
|
||
*/
|
||
set nLine := nLine + 1;
|
||
|
||
-- 保存茶水费流水
|
||
insert into
|
||
ct_service_info
|
||
(
|
||
service_id,
|
||
agent_id,
|
||
channel_id,
|
||
user_id,
|
||
sales_id,
|
||
total_value,
|
||
real_value,
|
||
sub_value,
|
||
create_time,
|
||
service_index
|
||
)
|
||
select
|
||
a.service_id,
|
||
a.agent_id,
|
||
a.channel_id,
|
||
b.user_id,
|
||
a.sales_id,
|
||
a.total_value,
|
||
a.total_value - a.sub_value real_value,
|
||
a.sub_value,
|
||
now() create_time,
|
||
a.service_index + 1
|
||
from
|
||
(
|
||
select
|
||
a.service_id,
|
||
a.agent_id,
|
||
a.channel_id,
|
||
a.sales_id,
|
||
a.total_value,
|
||
a.type,
|
||
case a.type
|
||
when 0 then 0
|
||
when 1 then a.value * a.total_value
|
||
when 2 then a.value
|
||
else 0
|
||
end sub_value,
|
||
case concat(a.agent_id, a.channel_id, a.sales_id)
|
||
when @g then @i := @i + 1
|
||
else @i := 1
|
||
end rn,
|
||
a.service_index,
|
||
@g := concat(a.agent_id, a.channel_id, a.sales_id)
|
||
from
|
||
(
|
||
select
|
||
a.agent_id,
|
||
a.channel_id,
|
||
c.saus_salesid sales_id,
|
||
sum(a.commission_total) total_value,
|
||
b.id service_id,
|
||
b.type,
|
||
b.value,
|
||
b.min_value,
|
||
b.max_value,
|
||
d.service_index
|
||
from
|
||
ct_user_commission a
|
||
inner join
|
||
ct_agent_service b
|
||
on
|
||
a.agent_id = b.agent_id and a.channel_id = b.channel_id
|
||
inner join
|
||
ct_sales_player c
|
||
on
|
||
a.agent_id = c.agent_id and a.channel_id = c.channel_id and a.target_id = c.play_playerid
|
||
inner join
|
||
ct_channel_list d
|
||
on
|
||
a.agent_id = d.agent_id and a.channel_id = d.channel_id
|
||
where
|
||
ifnull(a.target_mode, 0) in (3, 4) and -- 转给指定的玩家对应的代理账号
|
||
a.is_settle = 0 and
|
||
b.type != 0
|
||
group by
|
||
a.agent_id,
|
||
a.channel_id,
|
||
c.saus_salesid,
|
||
b.type,
|
||
b.value,
|
||
b.min_value,
|
||
b.max_value,
|
||
d.service_index
|
||
) a,
|
||
(select @g := '') g,
|
||
(select @i := 0) i
|
||
where
|
||
(a.total_value >= a.min_value or -1 = a.min_value) and
|
||
(a.total_value <= a.max_value or -1 = a.max_value)
|
||
) a
|
||
inner join
|
||
sales_user b
|
||
on
|
||
a.agent_id = b.saus_agentid and a.channel_id = b.saus_channelid and a.sales_id = b.saus_salesid
|
||
where
|
||
rn = 1;
|
||
|
||
set nLine := nLine + 1;
|
||
|
||
-- 更新抽水记录的服务费/茶水费计算序号
|
||
update
|
||
ct_user_commission a,
|
||
ct_channel_list b
|
||
set
|
||
a.service_index = b.service_index + 1
|
||
where
|
||
a.agent_id = b.agent_id and a.channel_id = b.channel_id and
|
||
ifnull(a.target_mode, 0) in (3, 4) and -- 转给指定的玩家对应的代理账号
|
||
a.is_settle = 0;
|
||
|
||
|
||
-- 更新渠道的服务费/茶水费计算序号
|
||
update
|
||
ct_channel_list a,
|
||
(
|
||
select
|
||
a.agent_id, a.channel_id
|
||
from
|
||
ct_user_commission a
|
||
where
|
||
ifnull(a.target_mode, 0) in (3, 4) and -- 转给指定的玩家对应的代理账号
|
||
a.is_settle = 0
|
||
group by
|
||
a.agent_id, a.channel_id
|
||
) b
|
||
set
|
||
a.service_index = a.service_index + 1
|
||
where
|
||
a.agent_id = b.agent_id and a.channel_id = b.channel_id;
|
||
|
||
set nLine := nLine + 1;
|
||
|
||
-- 增加玩家绑定的代理的总计抽水金币数
|
||
update
|
||
sales_user a,
|
||
(
|
||
select
|
||
agent_id, channel_id, user_id, sum(ifnull(commission_user, 0)) commission_user
|
||
from
|
||
ct_user_commission
|
||
where
|
||
ifnull(target_mode, 0) = 0 and is_settle = 0
|
||
group by
|
||
agent_id, channel_id, user_id
|
||
) b
|
||
set
|
||
a.currency_total = ifnull(a.currency_total, 0) + b.commission_user,
|
||
a.currency_withdraw = ifnull(a.currency_withdraw, 0) + b.commission_user
|
||
where
|
||
a.saus_agentid = b.agent_id and
|
||
a.saus_channelid = b.channel_id and
|
||
a.saus_salesid = b.user_id;
|
||
|
||
set nLine := nLine + 1;
|
||
|
||
-- 增加玩家绑定的代理的上级代理的总计抽水金币数
|
||
update
|
||
sales_user a,
|
||
(
|
||
select
|
||
agent_id, channel_id, parent_user_id user_id, sum(ifnull(commission_parent_user, 0)) commission_user
|
||
from
|
||
ct_user_commission
|
||
where
|
||
ifnull(target_mode, 0) = 0 and is_settle = 0
|
||
group by
|
||
agent_id, channel_id, parent_user_id
|
||
) b
|
||
set
|
||
a.currency_total = ifnull(a.currency_total, 0) + b.commission_user,
|
||
a.currency_withdraw = ifnull(a.currency_withdraw, 0) + b.commission_user
|
||
where
|
||
a.saus_agentid = b.agent_id and
|
||
a.saus_channelid = b.channel_id and
|
||
a.saus_salesid = b.user_id;
|
||
|
||
set nLine := nLine + 1;
|
||
|
||
-- 添加房主的总计抽水金币数
|
||
update
|
||
sales_user a,
|
||
(
|
||
select
|
||
agent_id, channel_id, owner_id player_id, sum(ifnull(commission_owner, 0)) commission_user
|
||
from
|
||
ct_user_commission
|
||
where
|
||
ifnull(target_mode, 0) = 0 and is_settle = 0
|
||
group by
|
||
agent_id, channel_id, owner_id
|
||
) b
|
||
set
|
||
a.currency_total = ifnull(a.currency_total, 0) + b.commission_user,
|
||
a.currency_withdraw = ifnull(a.currency_withdraw, 0) + b.commission_user
|
||
where
|
||
a.saus_agentid = b.agent_id and
|
||
a.saus_channelid = b.channel_id and
|
||
a.player_id = b.player_id;
|
||
|
||
/*
|
||
set nLine := nLine + 1;
|
||
|
||
-- 计算可提现金币数
|
||
update
|
||
sales_user a,
|
||
(
|
||
select
|
||
agent_id, channel_id, user_id
|
||
from
|
||
ct_user_commission
|
||
where
|
||
is_settle = 0
|
||
union all
|
||
select
|
||
agent_id, channel_id, parent_user_id
|
||
from
|
||
ct_user_commission
|
||
where
|
||
is_settle = 0
|
||
) b
|
||
set
|
||
a.currency_withdraw = ifnull(a.currency_total, 0) - ifnull(a.currency_freeze, 0)
|
||
where
|
||
a.saus_agentid = b.agent_id and
|
||
a.saus_channelid = b.channel_id and
|
||
a.saus_salesid = b.user_id;
|
||
*/
|
||
set nLine := nLine + 1;
|
||
|
||
-- 变更状态
|
||
update
|
||
ct_user_commission
|
||
set
|
||
is_settle = 1
|
||
where
|
||
ifnull(is_settle, 0) = 0;
|
||
|
||
set nLine := nLine + 1;
|
||
|
||
-- 更新表(player)
|
||
update
|
||
player a,
|
||
game_db_temp.player b
|
||
set
|
||
a.play_nickname = b.play_nickname,
|
||
a.play_bean = b.play_bean,
|
||
a.play_roomcard = b.play_roomcard,
|
||
a.play_a_country = b.play_a_country,
|
||
a.play_a_province = b.play_a_province,
|
||
a.play_a_city = b.play_a_city,
|
||
a.play_a_citycode = b.play_a_citycode,
|
||
a.play_a_district = b.play_a_district,
|
||
a.play_a_street = b.play_a_street,
|
||
a.play_a_address = b.play_a_address,
|
||
a.play_longitude = b.play_longitude,
|
||
a.play_latitude = b.play_latitude,
|
||
a.play_marketid = b.play_marketid,
|
||
a.play_phoneinfo = b.play_phoneinfo,
|
||
a.play_whitelist = b.play_whitelist,
|
||
a.play_bankpower = b.play_bankpower,
|
||
a.play_bank = b.play_bank,
|
||
a.play_bankpwd = b.play_bankpwd
|
||
where
|
||
a.play_agentid = b.play_agentid and
|
||
a.play_channelid = b.play_channelid and
|
||
a.play_playerid = b.play_playerid;
|
||
|
||
set nLine := nLine + 1;
|
||
|
||
-- 更新金币平衡报表数据
|
||
set dtReport := date_add(now(), interval -1 day);
|
||
delete from ct_gold_balance where report_date = date_format(dtReport, '%Y-%m-%d');
|
||
insert into
|
||
ct_gold_balance
|
||
(
|
||
agent_id, -- 代理号
|
||
channel_id, -- 渠道号
|
||
channel_name, -- 渠道名
|
||
report_date, -- 日期
|
||
trans_sales, -- 转给代理的金币
|
||
trans_player, -- 转给玩家的金币
|
||
buy_sales, -- 代理购买的金币
|
||
buy_player, -- 玩家购买的金币
|
||
buy_third, -- 第三方代付购买的金币
|
||
request_sales, -- 代理索要的金币
|
||
request_player, -- 玩家索要的金币
|
||
robot_produce, -- 机器人输掉的金币
|
||
system_produce, -- 系统转出的金币
|
||
manager_produce, -- 总代理转出的金币
|
||
gift, -- 赠送的金币
|
||
stock_sales, -- 代理库存的金币
|
||
stock_player, -- 玩家库存的金币
|
||
bank_sales, -- 代理银行中的金币
|
||
bank_player, -- 玩家银行中的金币
|
||
consume_commission_system, -- 系统扣除的分成金币
|
||
consume_commission_service, -- 系统扣除的服务金币
|
||
robot_consume, -- 机器人赢的金币
|
||
system_consume, -- 系统扣罚的金币
|
||
manager_consume -- 总代理扣罚的金币
|
||
)
|
||
select
|
||
a.agent_id, -- 代理号
|
||
a.channel_id, -- 渠道号
|
||
a.nickname, -- 渠道名称
|
||
date_format(dtReport, '%Y-%m-%d'),
|
||
#ifnull(ab.card_trans_sales, 0), -- 转给代理房卡数
|
||
ifnull(ac.gold_trans_sales, 0), -- 转给代理金币数
|
||
#ifnull(ad.card_trans_player, 0), -- 转给玩家房卡数
|
||
ifnull(ae.gold_trans_player, 0), -- 转给玩家金币数
|
||
#ifnull(af.card_buy_sales, 0), -- 代理购买房卡
|
||
ifnull(af.gold_buy_sales, 0), -- 代理购买金币
|
||
#ifnull(af.card_buy_player, 0), -- 玩家购买房卡
|
||
ifnull(af.gold_buy_player, 0), -- 玩家购买金币
|
||
#ifnull(al.card_buy_third, 0), -- 第三方代付购买的房卡
|
||
ifnull(al.gold_buy_third, 0), -- 第三方代付购买的金币
|
||
#ifnull(ah.card_request_sales, 0), -- 代理索要房卡
|
||
ifnull(ah.gold_request_sales, 0), -- 代理索要金币
|
||
#ifnull(ah.card_request_player, 0), -- 玩家索要房卡
|
||
ifnull(ah.gold_request_player, 0), -- 玩家索要金币
|
||
#0 card_robot_produce, -- 机器人生产房卡
|
||
ifnull(ai.gold_robot_produce, 0), -- 机器人生产金币
|
||
#ifnull(aj.card_system_produce, 0), -- 系统转出去的房卡
|
||
ifnull(aj.gold_system_produce, 0), -- 系统转出去的金币
|
||
#ifnull(ak.card_manager_produce, 0), -- 总代理转出去的房卡
|
||
ifnull(ak.gold_manager_produce, 0), -- 总代理转出去的金币
|
||
#0 card_gift, -- 赠送房卡
|
||
0 gold_gift, -- 赠送金币
|
||
|
||
#ifnull(ba.card_stock_sales, 0) card_stock_sales, -- 代理库存房卡
|
||
ifnull(ba.gold_stock_sales, 0) gold_stock_sales, -- 代理库存金币
|
||
#ifnull(bb.card_stock_player, 0) card_stock_player, -- 玩家库存房卡
|
||
ifnull(bb.gold_stock_player, 0) gold_stock_player, -- 玩家库存金币
|
||
ifnull(ba.gold_bank_sales, 0) gold_bank_sales, -- 代理银行中的金币
|
||
ifnull(bb.gold_bank_player, 0) gold_bank_player, -- 玩家银行中的金币
|
||
|
||
ifnull(ca.gold_consume_commission_system, 0), -- 系统分成金币
|
||
ifnull(cb.gold_consume_commission_service, 0), -- 系统扣除服务费金币
|
||
ifnull(cc.gold_robot_consume, 0), -- 机器人消费金币
|
||
#ifnull(cd.card_system_consume, 0), -- 系统扣罚的房卡
|
||
ifnull(cd.gold_system_consume, 0), -- 系统扣罚的金币
|
||
#ifnull(ce.card_manager_consume, 0), -- 总代理扣罚的房卡
|
||
ifnull(ce.gold_manager_consume, 0) -- 总代理扣罚的金币
|
||
from
|
||
ct_channel_list a -- 渠道列表
|
||
-- 以下是生产数据
|
||
left join
|
||
(
|
||
select
|
||
a.satr_agentid agent_id,
|
||
a.channel_id,
|
||
-- a.from_sales sales_id,
|
||
sum(a.satr_amount) card_trans_sales
|
||
from
|
||
sales_transferbill a
|
||
inner join
|
||
sales_user b
|
||
on
|
||
a.satr_agentid = b.saus_agentid and a.channel_id = b.saus_channelid and a.from_sales = b.saus_salesid
|
||
where
|
||
ifnull(b.statistic_type, 0) = 1 and ifnull(b.saus_status, 1) = 0 and date_format(a.satr_transfertime, '%Y-%m-%d') = date_format(dtReport, '%Y-%m-%d')
|
||
group by
|
||
a.satr_agentid, a.channel_id-- , a.from_sales
|
||
) ab -- 转给代理的房卡数
|
||
on
|
||
a.agent_id = ab.agent_id and a.channel_id = ab.channel_id
|
||
left join
|
||
(
|
||
select
|
||
a.agent_id,
|
||
a.channel_id,
|
||
-- a.send_id sales_id,
|
||
sum(a.amount) gold_trans_sales
|
||
from
|
||
trans_star_record a
|
||
inner join
|
||
sales_user b
|
||
on
|
||
a.agent_id = b.saus_agentid and a.channel_id = b.saus_channelid and a.send_id = b.saus_salesid
|
||
where
|
||
ifnull(b.statistic_type, 0) = 1 and ifnull(b.saus_status, 1) = 0 and date_format(a.op_time, '%Y-%m-%d') = date_format(dtReport, '%Y-%m-%d')
|
||
group by
|
||
a.agent_id, a.channel_id-- , a.send_id
|
||
) ac -- 转给代理的金币数
|
||
on
|
||
a.agent_id = ac.agent_id and a.channel_id = ac.channel_id
|
||
left join
|
||
(
|
||
select
|
||
a.sase_agentid agent_id,
|
||
a.channel_id,
|
||
-- a.from_sales sales_id,
|
||
sum(a.sase_amount) card_trans_player
|
||
from
|
||
sales_sellbill a
|
||
inner join
|
||
sales_user b
|
||
on
|
||
a.sase_agentid = b.saus_agentid and a.channel_id = b.saus_channelid and a.from_sales = b.saus_salesid
|
||
where
|
||
ifnull(b.statistic_type, 0) = 1 and ifnull(b.saus_status, 1) = 0 and date_format(a.sase_selltime, '%Y-%m-%d') = date_format(dtReport, '%Y-%m-%d')
|
||
group by
|
||
a.sase_agentid, a.channel_id-- , a.from_sales
|
||
) ad -- 转给玩家的房卡数
|
||
on
|
||
a.agent_id = ad.agent_id and a.channel_id = ad.channel_id
|
||
left join
|
||
(
|
||
select
|
||
a.ssbe_agentid agent_id,
|
||
a.channel_id,
|
||
-- a.from_sales sales_id,
|
||
sum(a.ssbe_amount) gold_trans_player
|
||
from
|
||
sales_sellbill_bean a
|
||
inner join
|
||
sales_user b
|
||
on
|
||
a.ssbe_agentid = b.saus_agentid and a.channel_id = b.saus_channelid and a.from_sales = b.saus_salesid
|
||
where
|
||
ifnull(b.statistic_type, 0) = 1 and ifnull(b.saus_status, 1) = 0 and date_format(a.ssbe_selltime, '%Y-%m-%d') = date_format(dtReport, '%Y-%m-%d')
|
||
group by
|
||
a.ssbe_agentid, a.channel_id-- , a.from_sales
|
||
) ae -- 转给玩家的金币数
|
||
on
|
||
a.agent_id = ae.agent_id and a.channel_id = ae.channel_id
|
||
/*
|
||
left join
|
||
(
|
||
select
|
||
a.sabu_agentid agent_id,
|
||
a.sabu_channelid channel_id,
|
||
sum(case a.sabu_billtype when 1 then a.sabu_amount else 0 end) card_buy_sales,
|
||
sum(case a.sabu_billtype when 0 then a.sabu_amount else 0 end) card_buy_player
|
||
from
|
||
sales_buybill a
|
||
where
|
||
a.sabu_paystate = 1 and date_format(a.sabu_paytime, '%Y-%m-%d') = date_format(dtReport, '%Y-%m-%d')
|
||
group by
|
||
a.sabu_agentid, a.sabu_channelid
|
||
) af -- 购买的房卡数
|
||
on
|
||
a.agent_id = af.agent_id and a.channel_id = af.channel_id
|
||
left join
|
||
(
|
||
select
|
||
a.agent_id,
|
||
a.channel_id,
|
||
sum(case a.order_type when 1 then a.star_amount else 0 end) gold_buy_sales,
|
||
sum(case a.order_type when 0 then a.star_amount else 0 end) gold_buy_player
|
||
from
|
||
order_star a
|
||
where
|
||
a.status = 1 and date_format(a.pay_time, '%Y-%m-%d') = date_format(dtReport, '%Y-%m-%d')
|
||
) ag -- 购买的金币数
|
||
on
|
||
a.agent_id = ag.agent_id and a.channel_id = ag.channel_id
|
||
*/
|
||
left join
|
||
(
|
||
select
|
||
agent_id,
|
||
channel_id,
|
||
sum(case when product_type = 0 and order_type = 1 then product_amount else 0 end) card_buy_sales, # 代理购买房卡数
|
||
sum(case when product_type = 0 and order_type = 0 then product_amount else 0 end) card_buy_player, # 玩家购买房卡数
|
||
sum(case when product_type = 1 and order_type = 1 then product_amount else 0 end) gold_buy_sales, # 代理购买金币数
|
||
sum(case when product_type = 1 and order_type = 0 then product_amount else 0 end) gold_buy_player, # 玩家购买金币数
|
||
sum(case when product_type = 2 and order_type = 1 then product_amount else 0 end) diamond_buy_sales, # 代理购买钻石数
|
||
sum(case when product_type = 2 and order_type = 0 then product_amount else 0 end) diamond_buy_player # 玩家购买钻石数
|
||
from
|
||
ct_order_info
|
||
where
|
||
pay_status = 1 and date_format(from_unixtime(pay_time), '%Y-%m-%d') = date_format(dtReport, '%Y-%m-%d')
|
||
group by
|
||
agent_id, channel_id
|
||
) af -- 购买订单
|
||
on
|
||
a.agent_id = af.agent_id and a.channel_id = af.channel_id
|
||
left join
|
||
(
|
||
select
|
||
a.saab_agentid agent_id,
|
||
a.channel_id,
|
||
sum(case a.saab_type when 0 then a.saab_amount else 0 end) card_request_player, -- 玩家索要房卡
|
||
sum(case a.saab_type when 1 then a.saab_amount else 0 end) card_request_sales, -- 代理索要房卡
|
||
sum(case a.saab_type when 2 then a.saab_amount else 0 end) gold_request_player, -- 玩家索要金币
|
||
sum(case a.saab_type when 3 then a.saab_amount else 0 end) gold_request_sales -- 代理索要金币
|
||
from
|
||
sales_ask_bill a
|
||
inner join
|
||
sales_user b
|
||
on
|
||
a.saab_agentid = b.saus_agentid and a.channel_id = b.saus_channelid and a.saab_salesid = b.saus_salesid
|
||
where
|
||
a.saab_state = 1 and ifnull(b.statistic_type, 0) = 1 and ifnull(b.saus_status, 1) = 0 and date_format(a.saab_dealtime, '%Y-%m-%d') = date_format(dtReport, '%Y-%m-%d')
|
||
) ah -- 索要的房卡和金币数
|
||
on
|
||
a.agent_id = ah.agent_id and a.channel_id = ah.channel_id
|
||
left join
|
||
(
|
||
select
|
||
agent_id,
|
||
sum(grade) * -1 gold_robot_produce
|
||
from
|
||
ct_user_commission
|
||
where
|
||
is_robot = 1 and grade < 0 and date_format(create_time, '%Y-%m-%d') = date_format(dtReport, '%Y-%m-%d')
|
||
group by
|
||
agent_id
|
||
) ai -- 机器人输掉的
|
||
on
|
||
a.agent_id = ai.agent_id
|
||
left join
|
||
(
|
||
select
|
||
a.agent_id,
|
||
a.channel_id,
|
||
sum(case a.production_type when 1 then a.amount else 0 end) card_system_produce,
|
||
sum(case a.production_type when 2 then a.amount else 0 end) gold_system_produce
|
||
from
|
||
ct_production_info a
|
||
#inner join
|
||
# sales_user b
|
||
#on
|
||
# a.agent_id = b.saus_agentid and a.channel_id = b.saus_channelid and a.from_user = b.saus_salesid
|
||
where
|
||
a.amount > 0 and
|
||
#ifnull(b.statistic_type, 0) = 1 and
|
||
date_format(a.create_time, '%Y-%m-%d') = date_format(dtReport, '%Y-%m-%d')
|
||
group by
|
||
a.agent_id, a.channel_id
|
||
) aj -- 平台转出去的
|
||
on
|
||
a.agent_id = aj.agent_id and a.channel_id = aj.channel_id
|
||
left join
|
||
(
|
||
select
|
||
a.agent_id,
|
||
a.channel_id,
|
||
sum(case a.production_type when 1 then a.amount else 0 end) card_manager_produce,
|
||
sum(case a.production_type when 2 then a.amount else 0 end) gold_manager_produce
|
||
from
|
||
ct_manager_production_info a
|
||
inner join
|
||
sales_user b
|
||
on
|
||
a.agent_id = b.saus_agentid and a.channel_id = b.saus_channelid and a.from_user = b.saus_salesid
|
||
where
|
||
a.oper_type = 1 and ifnull(b.statistic_type, 0) = 1 and date_format(a.create_time, '%Y-%m-%d') = date_format(dtReport, '%Y-%m-%d')
|
||
group by
|
||
a.agent_id, a.channel_id
|
||
) ak -- 代理转出去的
|
||
on
|
||
a.agent_id = ak.agent_id and a.channel_id = ak.channel_id
|
||
left join
|
||
(
|
||
select
|
||
a.agent_id,
|
||
a.channel_id,
|
||
sum(case a.type when 1 then a.amount else 0 end) card_buy_third,
|
||
sum(case a.type when 2 then a.amount else 0 end) gold_buy_third
|
||
from
|
||
ct_pay_for_third a
|
||
where
|
||
date_format(a.create_time, '%Y-%m-%d') = date_format(dtReport, '%Y-%m-%d')
|
||
group by
|
||
a.agent_id, a.channel_id
|
||
) al -- 第三方代付购买的
|
||
on
|
||
a.agent_id = al.agent_id and a.channel_id = al.channel_id
|
||
|
||
-- 以上是生产数据
|
||
-- 以下是库存数据
|
||
left join
|
||
(
|
||
select
|
||
saus_agentid agent_id,
|
||
saus_channelid channel_id,
|
||
sum(saus_roomcard) card_stock_sales,
|
||
sum(saus_bean) gold_stock_sales,
|
||
0 card_bank_sales,
|
||
0 gold_bank_sales
|
||
from
|
||
sales_user
|
||
where
|
||
ifnull(statistic_type, 0) = 0
|
||
group by
|
||
saus_agentid, saus_channelid
|
||
) ba -- 代理的库存房卡和金币数
|
||
on
|
||
a.agent_id = ba.agent_id and a.channel_id = ba.channel_id
|
||
left join
|
||
(
|
||
select
|
||
play_agentid agent_id,
|
||
play_channelid channel_id,
|
||
sum(play_roomcard) card_stock_player,
|
||
sum(play_bean) gold_stock_player,
|
||
0 card_bank_player,
|
||
sum(play_bank) gold_bank_player
|
||
from
|
||
player
|
||
group by
|
||
play_agentid, play_channelid
|
||
) bb -- 玩家的库存房卡和金币数
|
||
on
|
||
a.agent_id = bb.agent_id and a.channel_id = bb.channel_id
|
||
-- 以上是库存数据
|
||
-- 以下是消耗数据
|
||
left join
|
||
(
|
||
select
|
||
agent_id,
|
||
channel_id,
|
||
sum(commission_system) gold_consume_commission_system
|
||
from
|
||
ct_user_commission
|
||
where
|
||
ifnull(is_settle, 0) != 0 and date_format(create_time, '%Y-%m-%d') = date_format(dtReport, '%Y-%m-%d')
|
||
group by
|
||
agent_id, channel_id
|
||
) ca -- 系统分成扣除的金币数
|
||
on
|
||
a.agent_id = ca.agent_id and a.channel_id = ca.channel_id
|
||
left join
|
||
(
|
||
select
|
||
agent_id,
|
||
channel_id,
|
||
sum(sub_value) gold_consume_commission_service
|
||
from
|
||
ct_service_info
|
||
where
|
||
date_format(create_time, '%Y-%m-%d') = date_format(dtReport, '%Y-%m-%d')
|
||
group by
|
||
agent_id, channel_id
|
||
) cb -- 茶水费扣除的服务费
|
||
on
|
||
a.agent_id = cb.agent_id and a.channel_id = cb.channel_id
|
||
left join
|
||
(
|
||
select
|
||
agent_id,
|
||
sum(grade) gold_robot_consume
|
||
from
|
||
ct_user_commission
|
||
where
|
||
is_robot = 1 and grade >= 0 and date_format(create_time, '%Y-%m-%d') = date_format(dtReport, '%Y-%m-%d')
|
||
group by
|
||
agent_id
|
||
) cc -- 机器人赢的
|
||
on
|
||
a.agent_id = cc.agent_id
|
||
left join
|
||
(
|
||
select
|
||
a.agent_id,
|
||
a.channel_id,
|
||
sum(case a.production_type when 1 then a.amount else 0 end) * -1 card_system_consume,
|
||
sum(case a.production_type when 2 then a.amount else 0 end) * -1 gold_system_consume
|
||
from
|
||
ct_production_info a
|
||
#inner join
|
||
# sales_user b
|
||
#on
|
||
# a.agent_id = b.saus_agentid and a.channel_id = b.saus_channelid and a.from_user = b.saus_salesid
|
||
where
|
||
a.amount < 0 and
|
||
#ifnull(b.statistic_type, 0) = 1 and
|
||
date_format(a.create_time, '%Y-%m-%d') = date_format(dtReport, '%Y-%m-%d')
|
||
group by
|
||
a.agent_id, a.channel_id
|
||
) cd -- 系统扣罚的
|
||
on
|
||
a.agent_id = cd.agent_id and a.channel_id = cd.channel_id
|
||
left join
|
||
(
|
||
select
|
||
a.agent_id,
|
||
a.channel_id,
|
||
sum(case a.production_type when 1 then a.amount else 0 end) * -1 card_manager_consume,
|
||
sum(case a.production_type when 2 then a.amount else 0 end) * -1 gold_manager_consume
|
||
from
|
||
ct_manager_production_info a
|
||
inner join
|
||
sales_user b
|
||
on
|
||
a.agent_id = b.saus_agentid and a.channel_id = b.saus_channelid and a.from_user = b.saus_salesid
|
||
where
|
||
a.oper_type = 2 and ifnull(b.statistic_type, 0) = 1 and date_format(a.create_time, '%Y-%m-%d') = date_format(dtReport, '%Y-%m-%d')
|
||
group by
|
||
a.agent_id, a.channel_id
|
||
) ce -- 总代扣罚的
|
||
on
|
||
a.agent_id = ce.agent_id and a.channel_id = ce.channel_id
|
||
-- 以上是消耗数据
|
||
where
|
||
a.is_open != 0;
|
||
|
||
set nLine := nLine + 1;
|
||
|
||
set nCursorDone := 0;
|
||
-- 打开游标
|
||
open cc_grade;
|
||
|
||
-- 开始循环
|
||
LoopCursor: loop
|
||
-- 提取游标里的数据,这里只有一个,多个的话也一样;
|
||
fetch cc_grade into szDatetime;
|
||
-- 声明结束的时候
|
||
if nCursorDone != 0 then
|
||
leave LoopCursor;
|
||
end if;
|
||
|
||
-- 插入战绩数据到分表中
|
||
set @_sql_command_ = concat(
|
||
'insert into', char(13), char(10),
|
||
' ct_grade_', szDatetime, char(13), char(10),
|
||
' (', char(13), char(10),
|
||
' agent_id,', char(13), char(10),
|
||
' channel_id,', char(13), char(10),
|
||
' game_id,', char(13), char(10),
|
||
' player_id,', char(13), char(10),
|
||
' room_code,', char(13), char(10),
|
||
' room_type,', char(13), char(10),
|
||
' owner_id,', char(13), char(10),
|
||
' room_card,', char(13), char(10),
|
||
' owner_card,', char(13), char(10),
|
||
' create_time,', char(13), char(10),
|
||
' makewar_time,', char(13), char(10),
|
||
' over_time,', char(13), char(10),
|
||
' short_number,', char(13), char(10),
|
||
' deduct_type,', char(13), char(10),
|
||
' deduct_card,', char(13), char(10),
|
||
' aset_count,', char(13), char(10),
|
||
' room_mode,', char(13), char(10),
|
||
' score,', char(13), char(10),
|
||
' is_winner,', char(13), char(10),
|
||
' room_hash,', char(13), char(10),
|
||
' out_id', char(13), char(10),
|
||
' )', char(13), char(10),
|
||
'select', char(13), char(10),
|
||
' plgr_agentid,', char(13), char(10),
|
||
' null,', char(13), char(10),
|
||
' plgr_gameid,', char(13), char(10),
|
||
' plgr_playerid,', char(13), char(10),
|
||
' plgr_roomcode,', char(13), char(10),
|
||
' plgr_roomtype,', char(13), char(10),
|
||
' plgr_ownerid,', char(13), char(10),
|
||
' plgr_roomcard,', char(13), char(10),
|
||
' plgr_ownercard,', char(13), char(10),
|
||
' plgr_createtime,', char(13), char(10),
|
||
' plgr_makewartime,', char(13), char(10),
|
||
' plgr_overtime,', char(13), char(10),
|
||
' plgr_shortcode,', char(13), char(10),
|
||
' plgr_deducttype,', char(13), char(10),
|
||
' plgr_deductcard,', char(13), char(10),
|
||
' plgr_asetcount,', char(13), char(10),
|
||
' plgr_roommode,', char(13), char(10),
|
||
' plgr_score,', char(13), char(10),
|
||
' plgr_winner,', char(13), char(10),
|
||
' concat(date_format(plgr_createtime, \'%Y%m%d%H%i%s\'), \'--\', md5(concat(plgr_agentid, plgr_gameid, plgr_roomcode, plgr_ownerid, unix_timestamp(plgr_createtime)))),', char(13), char(10),
|
||
' idx', char(13), char(10),
|
||
'from', char(13), char(10),
|
||
' game_db_temp.player_grade', char(13), char(10),
|
||
'where', char(13), char(10),
|
||
' date_format(plgr_makewartime, \'%Y%m\') = \'', szDatetime, '\' and ', char(13), char(10),
|
||
' idx not in (select out_id from ct_grade_', szDatetime, ');'
|
||
);
|
||
|
||
-- 预处理拼接好的字符串
|
||
prepare _sql_command_ from @_sql_command_;
|
||
-- 使用参数执行拼接好的字符串语句
|
||
execute _sql_command_;
|
||
-- 释放拼接的字符串语句
|
||
deallocate prepare _sql_command_;
|
||
|
||
/* 重建表索引 */
|
||
-- 设置脚本
|
||
set @_sql_command_ = concat(
|
||
'alter table ct_grade_', szDatetime, char(13), char(10),
|
||
'drop index pk_grade_', szDatetime, ',', char(13), char(10),
|
||
'drop index uk_grade_', szDatetime, ',', char(13), char(10),
|
||
'drop index nk_grade_', szDatetime, '_agent_id,', char(13), char(10),
|
||
'drop index nk_grade_', szDatetime, '_player_id,', char(13), char(10),
|
||
'drop index nk_grade_', szDatetime, '_owner_id,', char(13), char(10),
|
||
'drop index nk_grade_', szDatetime, '_create_time,', char(13), char(10),
|
||
'drop index nk_grade_', szDatetime, '_makewar_time,', char(13), char(10),
|
||
'drop index nk_grade_', szDatetime, '_over_time,', char(13), char(10),
|
||
'drop index nk_grade_', szDatetime, '_group_data,', char(13), char(10),
|
||
'add unique index pk_grade_', szDatetime, ' (id) using hash,', char(13), char(10),
|
||
'add unique index uk_grade_', szDatetime, ' (out_id) using hash,', char(13), char(10),
|
||
'add index nk_grade_', szDatetime, '_agent_id (agent_id) using hash,', char(13), char(10),
|
||
'add index nk_grade_', szDatetime, '_player_id (agent_id, player_id) using hash,', char(13), char(10),
|
||
'add index nk_grade_', szDatetime, '_owner_id (agent_id, owner_id) using hash,', char(13), char(10),
|
||
'add index nk_grade_', szDatetime, '_create_time (agent_id, short_number, create_time) using hash,', char(13), char(10),
|
||
'add index nk_grade_', szDatetime, '_makewar_time (agent_id, short_number, makewar_time) using hash,', char(13), char(10),
|
||
'add index nk_grade_', szDatetime, '_over_time (agent_id, short_number, over_time) using hash,', char(13), char(10),
|
||
'add index nk_grade_', szDatetime, '_group_data (agent_id, channel_id, game_id, player_id, short_number, create_time, makewar_time, over_time) using btree;'
|
||
);
|
||
|
||
-- 预处理拼接好的字符串
|
||
prepare _sql_command_ from @_sql_command_;
|
||
-- 使用参数执行拼接好的字符串语句
|
||
execute _sql_command_;
|
||
-- 释放拼接的字符串语句
|
||
deallocate prepare _sql_command_;
|
||
end loop;
|
||
|
||
-- 关闭游标
|
||
close cc_grade;
|
||
|
||
set nLine := nLine + 1;
|
||
|
||
set nCursorDone := 0;
|
||
open cc_user_commission;
|
||
|
||
-- 开始循环
|
||
LoopCursor: loop
|
||
-- 提取游标里的数据,这里只有一个,多个的话也一样;
|
||
fetch cc_user_commission into szDatetime;
|
||
-- 声明结束的时候
|
||
if nCursorDone != 0 then
|
||
leave LoopCursor;
|
||
end if;
|
||
|
||
set @_sql_command_ := concat(
|
||
'insert into', char(13), char(10),
|
||
' ct_user_commission_', szDatetime, char(13), char(10),
|
||
' (', char(13), char(10),
|
||
' agent_id,', char(13), char(10),
|
||
' channel_id,', char(13), char(10),
|
||
' game_id,', char(13), char(10),
|
||
' room_id,', char(13), char(10),
|
||
' player_id,', char(13), char(10),
|
||
' user_id,', char(13), char(10),
|
||
' parent_user_id,', char(13), char(10),
|
||
' room_code,', char(13), char(10),
|
||
' short_number,', char(13), char(10),
|
||
' used_card,', char(13), char(10),
|
||
' owner_id,', char(13), char(10),
|
||
' room_type,', char(13), char(10),
|
||
' room_mode,', char(13), char(10),
|
||
' commission_type,', char(13), char(10),
|
||
' grade,', char(13), char(10),
|
||
' source_mode,', char(13), char(10),
|
||
' target_mode,', char(13), char(10),
|
||
' target_id,', char(13), char(10),
|
||
' mode,', char(13), char(10),
|
||
' type,', char(13), char(10),
|
||
' commission_total,', char(13), char(10),
|
||
' commission_system,', char(13), char(10),
|
||
' commission_user,', char(13), char(10),
|
||
' commission_parent_user,', char(13), char(10),
|
||
' commission_owner,', char(13), char(10),
|
||
' commission_user_rate,', char(13), char(10),
|
||
' commission_parent_user_rate,', char(13), char(10),
|
||
' commission_owner_rate,', char(13), char(10),
|
||
' create_time,', char(13), char(10),
|
||
' is_settle,', char(13), char(10),
|
||
' is_robot,', char(13), char(10),
|
||
' service_index,', char(13), char(10),
|
||
' out_id', char(13), char(10),
|
||
' )', char(13), char(10),
|
||
'select', char(13), char(10),
|
||
' agent_id,', char(13), char(10),
|
||
' channel_id,', char(13), char(10),
|
||
' game_id,', char(13), char(10),
|
||
' room_id,', char(13), char(10),
|
||
' player_id,', char(13), char(10),
|
||
' user_id,', char(13), char(10),
|
||
' parent_user_id,', char(13), char(10),
|
||
' room_code,', char(13), char(10),
|
||
' short_number,', char(13), char(10),
|
||
' used_card,', char(13), char(10),
|
||
' owner_id,', char(13), char(10),
|
||
' room_type,', char(13), char(10),
|
||
' room_mode,', char(13), char(10),
|
||
' commission_type,', char(13), char(10),
|
||
' grade,', char(13), char(10),
|
||
' source_mode,', char(13), char(10),
|
||
' target_mode,', char(13), char(10),
|
||
' target_id,', char(13), char(10),
|
||
' mode,', char(13), char(10),
|
||
' type,', char(13), char(10),
|
||
' commission_total,', char(13), char(10),
|
||
' commission_system,', char(13), char(10),
|
||
' commission_user,', char(13), char(10),
|
||
' commission_parent_user,', char(13), char(10),
|
||
' commission_owner,', char(13), char(10),
|
||
' commission_user_rate,', char(13), char(10),
|
||
' commission_parent_user_rate,', char(13), char(10),
|
||
' commission_owner_rate,', char(13), char(10),
|
||
' create_time,', char(13), char(10),
|
||
' is_settle,', char(13), char(10),
|
||
' is_robot,', char(13), char(10),
|
||
' service_index,', char(13), char(10),
|
||
' out_id', char(13), char(10),
|
||
'from', char(13), char(10),
|
||
' ct_user_commission', char(13), char(10),
|
||
'where', char(13), char(10),
|
||
' date_format(create_time, \'%Y%m\') = \'', szDatetime, '\' and ', char(13), char(10),
|
||
' out_id not in (select out_id from ct_user_commission_', szDatetime, ')'
|
||
);
|
||
|
||
-- 预处理拼接好的字符串
|
||
prepare _sql_command_ from @_sql_command_;
|
||
-- 使用参数执行拼接好的字符串语句
|
||
execute _sql_command_;
|
||
-- 释放拼接的字符串语句
|
||
deallocate prepare _sql_command_;
|
||
|
||
set @_sql_command_ := concat(
|
||
'alter table ct_user_commission_', szDatetime, char(13), char(10),
|
||
'drop index `pk_user_commission_', szDatetime, '`,', char(13), char(10),
|
||
'drop index `uk_user_commission_', szDatetime, '_out_id`,', char(13), char(10),
|
||
'drop index `nk_user_commission_', szDatetime, '_user`,', char(13), char(10),
|
||
'drop index `nk_user_commission_', szDatetime, '_player_id`,', char(13), char(10),
|
||
'drop index `nk_user_commission_', szDatetime, '_user_id`,', char(13), char(10),
|
||
'drop index `nk_user_commission_', szDatetime, '_service_index`,', char(13), char(10),
|
||
'drop index `nk_user_commission_', szDatetime, '_target_mode_settle`,', char(13), char(10),
|
||
'drop index `nk_user_commission_', szDatetime, '_target_id`,', char(13), char(10),
|
||
'add unique index `pk_user_commission_', szDatetime, '` (`id`) using hash,', char(13), char(10),
|
||
'add unique index `uk_user_commission_', szDatetime, '_out_id` (`out_id`) using hash,', char(13), char(10),
|
||
'add index `nk_user_commission_', szDatetime, '_user` (`agent_id`,`channel_id`,`player_id`,`user_id`) using hash,', char(13), char(10),
|
||
'add index `nk_user_commission_', szDatetime, '_player_id` (`agent_id`,`channel_id`,`player_id`) using hash,', char(13), char(10),
|
||
'add index `nk_user_commission_', szDatetime, '_user_id` (`agent_id`,`channel_id`,`user_id`) using hash,', char(13), char(10),
|
||
'add index `nk_user_commission_', szDatetime, '_service_index` (`agent_id`,`channel_id`,`service_index`) using hash,', char(13), char(10),
|
||
'add index `nk_user_commission_', szDatetime, '_target_mode_settle` (`target_mode`, `is_settle`, `commission_total`, `create_time`) using hash,', char(13), char(10),
|
||
'add index `nk_user_commission_', szDatetime, '_target_id` (`agent_id`, `channel_id`, `target_id`) using hash;', char(13), char(10)
|
||
);
|
||
|
||
|
||
-- 预处理拼接好的字符串
|
||
prepare _sql_command_ from @_sql_command_;
|
||
-- 使用参数执行拼接好的字符串语句
|
||
execute _sql_command_;
|
||
-- 释放拼接的字符串语句
|
||
deallocate prepare _sql_command_;
|
||
end loop;
|
||
|
||
close cc_user_commission;
|
||
|
||
set nLine := nLine + 1;
|
||
|
||
-- 重建索引(ct_grade_temp)
|
||
alter table ct_grade_temp
|
||
drop index pk_grade_temp,
|
||
drop index uk_grade_temp,
|
||
drop index nk_grade_temp_player_id,
|
||
drop index nk_grade_temp_create_time,
|
||
drop index nk_grade_temp_group_data,
|
||
drop index nk_grade_temp_group_short_number_data,
|
||
add unique index pk_grade_temp (id) using hash,
|
||
add unique index uk_grade_temp (out_id) using hash,
|
||
add index nk_grade_temp_player_id (agent_id, channel_id, game_id, player_id) using btree,
|
||
add index nk_grade_temp_create_time (agent_id, channel_id, game_id, short_number, create_time) using btree,
|
||
add index nk_grade_temp_group_data (agent_id, channel_id, player_id, short_number, create_time) using btree,
|
||
add index nk_grade_temp_group_short_number_data (agent_id, short_number, create_time) using hash;
|
||
|
||
-- 重建索引(ct_user_commission)
|
||
alter table ct_user_commission
|
||
drop index pk_user_commission,
|
||
drop index uk_user_commission_out_id,
|
||
drop index nk_user_commission_user,
|
||
drop index nk_user_commission_player_id,
|
||
drop index nk_user_commission_user_id,
|
||
drop index nk_user_commission_service_index,
|
||
drop index nk_user_commission_target_mode_settle,
|
||
drop index nk_user_commission_target_id,
|
||
add unique index pk_user_commission (id) using hash,
|
||
add unique index uk_user_commission_out_id (out_id) using hash,
|
||
add index nk_user_commission_user (agent_id, channel_id, player_id, user_id) using hash,
|
||
add index nk_user_commission_player_id (agent_id, channel_id, player_id) using hash,
|
||
add index nk_user_commission_user_id (agent_id, channel_id, user_id) using hash,
|
||
add index nk_user_commission_service_index (agent_id, channel_id, service_index) using hash,
|
||
add index nk_user_commission_target_mode_settle (target_mode, is_settle, commission_total, create_time) using hash,
|
||
add index nk_user_commission_target_id (agent_id, channel_id, target_id) using hash;
|
||
|
||
-- 重建索引(sales_user)
|
||
alter table sales_user
|
||
drop index uk_sales_user_id,
|
||
drop index uk_sales_user_userid,
|
||
drop index uk_sales_user_salesid,
|
||
drop index uk_sales_user_playerid,
|
||
drop index uk_sales_user_openid,
|
||
drop index uk_sales_user_unionid,
|
||
drop index nk_sales_user_salesid,
|
||
add unique index uk_sales_user_id (idx) using hash,
|
||
add unique index uk_sales_user_userid (user_id, saus_agentid, saus_channelid) using hash,
|
||
add unique index uk_sales_user_salesid (saus_agentid, saus_channelid, saus_salesid) using hash,
|
||
add unique index uk_sales_user_playerid (saus_agentid, saus_channelid, player_id) using hash,
|
||
add unique index uk_sales_user_openid (saus_agentid, saus_channelid, saus_openid) using hash,
|
||
add unique index uk_sales_user_unionid (saus_agentid, saus_channelid, saus_unionid) using hash,
|
||
add index nk_sales_user_salesid (saus_agentid,saus_channelid,saus_salesid,saus_openid,saus_unionid,saus_status,password) using btree;
|
||
|
||
-- 重建索引(player)
|
||
alter table player
|
||
drop index player_index1,
|
||
drop index player_index2,
|
||
drop index uk_play_playerid,
|
||
drop index nk_player,
|
||
add unique index player_index1 (play_agentid,play_channelid,play_playerid) using hash,
|
||
add unique index player_index2 (play_agentid,play_channelid,play_unionid) using hash,
|
||
add unique index uk_play_playerid (play_agentid, play_playerid) using hash,
|
||
add index nk_player (play_agentid,play_playerid,play_channelid,play_openid,play_unionid,play_status) using btree;
|
||
|
||
-- 判断是否成功
|
||
if 1 = nErrorCode then
|
||
rollback;
|
||
insert into ct_exec_log(name, time, message) values ('cp_SynchronizeSettle', now(), concat('error: ', szMessages, '(', szSqlState, ')!with: ', nLine));
|
||
select concat('error: ', szMessages, '(', szSqlState, ')!');
|
||
else
|
||
commit;
|
||
insert into ct_exec_log(name, time, message) values ('cp_SynchronizeSettle', now(), 'success!');
|
||
select 'success!';
|
||
end if;
|
||
end
|
||
;;
|
||
delimiter ;
|
||
|
||
-- ----------------------------
|
||
-- Procedure structure for cp_SynchronizeSettle_copy1
|
||
-- ----------------------------
|
||
DROP PROCEDURE IF EXISTS `cp_SynchronizeSettle_copy1`;
|
||
delimiter ;;
|
||
CREATE PROCEDURE `cp_SynchronizeSettle_copy1`()
|
||
SQL SECURITY INVOKER
|
||
begin
|
||
declare nErrorCode integer default 0; -- 错误标志
|
||
declare szSqlState varchar(1000); -- sql执行状态(错误号)
|
||
declare szMessages varchar(1000); -- 错误信息
|
||
declare nLine integer default 0; --
|
||
|
||
declare szDatetime varchar(100); -- 战绩表的年月
|
||
declare dtReport datetime;
|
||
declare nCursorDone int default 0; -- 游标状态
|
||
declare cc_grade cursor for select date_format(plgr_makewartime, '%Y%m') from game_db_temp.player_grade group by date_format(plgr_makewartime, '%Y%m');
|
||
declare cc_user_commission cursor for select date_format(goac_time, '%Y%m') from game_db_temp.gold_account group by date_format(goac_time, '%Y%m');
|
||
-- 将结束标志绑定到游标
|
||
declare continue handler for not found set nCursorDone = 1;
|
||
|
||
-- 错误处理
|
||
declare continue handler for sqlexception
|
||
begin
|
||
set nErrorCode = 1;
|
||
get diagnostics condition 1 szSqlState = returned_sqlstate, szMessages = message_text;
|
||
-- select unix_timestamp(curdate()), szSqlState, szMessages;
|
||
end;
|
||
|
||
start transaction;
|
||
|
||
/*
|
||
-- 同步战绩数据
|
||
insert into
|
||
ct_grade_temp
|
||
(
|
||
agent_id,
|
||
channel_id,
|
||
game_id,
|
||
player_id,
|
||
room_code,
|
||
room_type,
|
||
owner_id,
|
||
room_card,
|
||
owner_card,
|
||
create_time,
|
||
makewar_time,
|
||
over_time,
|
||
short_number,
|
||
deduct_type,
|
||
deduct_card,
|
||
aset_count,
|
||
room_mode,
|
||
out_id
|
||
)
|
||
select
|
||
plgr_agentid,
|
||
null,
|
||
plgr_gameid,
|
||
plgr_playerid,
|
||
plgr_roomcode,
|
||
plgr_roomtype,
|
||
plgr_ownerid,
|
||
plgr_roomcard,
|
||
plgr_ownercard,
|
||
plgr_createtime,
|
||
plgr_makewartime,
|
||
plgr_overtime,
|
||
plgr_shortcode,
|
||
plgr_deducttype,
|
||
plgr_deductcard,
|
||
plgr_asetcount,
|
||
plgr_roommode,
|
||
idx
|
||
from
|
||
game_db_temp.player_grade
|
||
where
|
||
idx not in (select out_id from ct_grade_temp);
|
||
*/
|
||
|
||
-- 同步并计算分成数据
|
||
insert into
|
||
ct_user_commission
|
||
(
|
||
agent_id,
|
||
channel_id,
|
||
game_id,
|
||
room_id,
|
||
player_id,
|
||
user_id,
|
||
parent_user_id,
|
||
room_code,
|
||
short_number,
|
||
used_card,
|
||
owner_id,
|
||
room_type,
|
||
room_mode,
|
||
commission_type,
|
||
grade,
|
||
source_mode,
|
||
target_mode,
|
||
target_id,
|
||
mode,
|
||
type,
|
||
commission_total,
|
||
commission_system,
|
||
commission_user,
|
||
commission_parent_user,
|
||
commission_owner,
|
||
commission_user_rate,
|
||
commission_parent_user_rate,
|
||
commission_owner_rate,
|
||
create_time,
|
||
is_robot,
|
||
out_id
|
||
)
|
||
select
|
||
agent_id,
|
||
channel_id,
|
||
game_id,
|
||
room_id,
|
||
player_id,
|
||
user_id,
|
||
parent_user_id,
|
||
room_code,
|
||
short_number,
|
||
used_card,
|
||
owner_id,
|
||
room_type,
|
||
room_mode,
|
||
commission_type,
|
||
grade,
|
||
source_mode,
|
||
target_mode,
|
||
target_id,
|
||
mode,
|
||
type,
|
||
ifnull(commission_total, 0) commission_total, -- 累计抽成数
|
||
case target_mode
|
||
when 0 then
|
||
(ifnull(commission_total, 0)) - -- 累计抽成数
|
||
(ifnull(commission_total, 0) * ifnull(user_rate, 0)) - -- 绑定的代理抽成数
|
||
(ifnull(commission_total, 0) * ifnull(parent_user_rate, 0)) - -- 绑定的代理的上级代理抽成数
|
||
(ifnull(commission_total, 0) * ifnull(owner_rate, 0)) -- 房主的抽成数
|
||
else
|
||
0
|
||
end commission_system, -- 系统抽成数
|
||
(ifnull(commission_total, 0) * ifnull(user_rate, 0)) commission_user, -- 绑定的代理抽成数
|
||
(ifnull(commission_total, 0) * ifnull(parent_user_rate, 0)) commission_parent_user, -- 绑定的代理的上级代理抽成数
|
||
(ifnull(commission_total, 0) * ifnull(owner_rate, 0)) commission_owner, -- 房主的抽成数
|
||
ifnull(user_rate, 0) commission_user_rate, -- 绑定的代理抽成比例
|
||
ifnull(parent_user_rate, 0) commission_parent_user_rate, -- 绑定的代理的上级代理抽成比例
|
||
ifnull(owner_rate, 0) commission_owner_rate, -- 房主的抽成比例
|
||
create_time,
|
||
is_robot,
|
||
out_id
|
||
from
|
||
(
|
||
select
|
||
a.agent_id,
|
||
a.channel_id,
|
||
a.game_id,
|
||
a.room_id,
|
||
a.player_id,
|
||
a.user_id,
|
||
a.parent_user_id,
|
||
a.room_code,
|
||
a.short_number,
|
||
a.used_card,
|
||
a.owner_id,
|
||
a.room_type,
|
||
a.room_mode,
|
||
a.commission_type,
|
||
a.grade,
|
||
a.source_mode,
|
||
a.target_mode,
|
||
a.target_id,
|
||
a.mode,
|
||
a.type,
|
||
a.commission_total,
|
||
case
|
||
when 0 = ifnull(a.target_mode, 0) and 0 = ifnull(a.is_robot, 0) then
|
||
case
|
||
when (0 = a.user_id) or (0 != a.user_is_admin) then 0
|
||
else case ifnull(d.is_custom, 0)
|
||
when 0 then c.user_commission_rate
|
||
else d.commission_rate
|
||
end
|
||
end
|
||
+
|
||
case
|
||
when ((0 != a.user_id) and (0 = a.user_is_admin)) and ((0 = a.parent_user_id) or (0 != a.parent_user_is_admin)) and (1 = b.service_type) then
|
||
case ifnull(d.is_custom, 0)
|
||
when 0 then
|
||
c.parent_user_commission_rate
|
||
else
|
||
d.parent_commission_rate
|
||
end
|
||
else 0
|
||
end
|
||
|
||
else 0
|
||
end user_rate,
|
||
|
||
case
|
||
when 0 = ifnull(a.target_mode, 0) and 0 = ifnull(a.is_robot, 0) then
|
||
case
|
||
when (0 = a.parent_user_id) or (0 != a.parent_user_is_admin) then 0
|
||
else case ifnull(d.is_custom, 0)
|
||
when 0 then c.parent_user_commission_rate
|
||
else d.parent_commission_rate
|
||
end
|
||
end
|
||
|
||
else 0
|
||
end parent_user_rate,
|
||
|
||
case
|
||
when 0 = ifnull(a.target_mode, 0) and 0 = ifnull(a.is_robot, 0) then
|
||
case ifnull(d.is_custom, 0)
|
||
when 0 then c.owner_commission_rate
|
||
else d.owner_commission_rate
|
||
end
|
||
|
||
else 0
|
||
end owner_rate,
|
||
|
||
a.user_is_admin,
|
||
a.parent_user_is_admin,
|
||
a.create_time,
|
||
a.is_robot,
|
||
a.out_id
|
||
from
|
||
(
|
||
select
|
||
if(a.goac_isrobot = 0, a.goac_agentid, e.agent_id) agent_id,
|
||
if(a.goac_isrobot = 0, b.play_channelid, e.channel_id) channel_id,
|
||
a.goac_gameid game_id,
|
||
a.goac_id room_id,
|
||
a.goac_playerid player_id,
|
||
if(a.goac_isrobot = 0, ifnull(b.play_invitecode, 0), 0) user_id,
|
||
ifnull(c.global_power, 0) user_is_admin,
|
||
ifnull(c.saus_parentid, 0) parent_user_id,
|
||
ifnull(d.global_power, 0) parent_user_is_admin,
|
||
a.goac_roomcode room_code,
|
||
a.goac_shortcode short_number,
|
||
a.goac_roomcard used_card,
|
||
a.goac_ownerid owner_id,
|
||
null room_type,
|
||
a.goac_roommode room_mode,
|
||
case a.goac_roommode
|
||
when 0 then '001'
|
||
when 1 then '001'
|
||
else '001'
|
||
end commission_type,
|
||
a.goac_grade grade,
|
||
a.goac_rebatefrom source_mode,
|
||
a.goac_rebateto target_mode,
|
||
case a.goac_rebateto
|
||
when 0 then 0 -- 0-抽成给系统
|
||
when 1 then a.goac_ownerid -- 1-抽成给房主
|
||
when 2 then a.goac_toplayerid -- 2-抽成给指定玩家
|
||
when 3 then a.goac_toplayerid -- 3-抽成给指定玩家的代理账号
|
||
when 4 then a.goac_ownerid -- 4-抽成给房主的代理账号
|
||
end target_id,
|
||
a.goac_rebatemode mode,
|
||
a.goac_datatype type,
|
||
if(a.goac_rebatevalue < 0, 0, a.goac_rebatevalue) commission_total,
|
||
a.goac_time create_time,
|
||
a.goac_isrobot is_robot,
|
||
a.idx out_id
|
||
from
|
||
game_db_temp.gold_account a
|
||
left join
|
||
player b
|
||
on
|
||
a.goac_agentid = b.play_agentid and a.goac_playerid = b.play_playerid
|
||
left join
|
||
sales_user c
|
||
on
|
||
b.play_agentid = c.saus_agentid and b.play_channelid = c.saus_channelid and b.play_invitecode = c.saus_salesid
|
||
left join
|
||
sales_user d
|
||
on
|
||
c.saus_agentid = d.saus_agentid and c.saus_channelid = d.saus_channelid and c.saus_parentid = d.saus_salesid
|
||
left join
|
||
ct_channel_list e
|
||
on
|
||
a.goac_agentid = e.agent_id
|
||
) a
|
||
inner join
|
||
ct_channel_list b
|
||
on
|
||
a.agent_id = b.agent_id and a.channel_id = b.channel_id
|
||
left join
|
||
ct_agent_commission c
|
||
on
|
||
a.agent_id = c.agent_id and a.channel_id = c.channel_id and a.commission_type = c.type_id
|
||
left join
|
||
ct_agent_commission_user d
|
||
on
|
||
a.agent_id = d.agent_id and a.channel_id = d.channel_id and c.type_id = d.type_id and a.user_id = d.user_id
|
||
) t
|
||
where
|
||
t.out_id not in (select out_id from ct_user_commission);
|
||
|
||
set nLine := nLine + 1;
|
||
|
||
-- 转移指定了接收代理编号的抽水金币数
|
||
update
|
||
sales_user a,
|
||
(
|
||
select
|
||
service_id,
|
||
agent_id,
|
||
channel_id,
|
||
sales_id,
|
||
type,
|
||
total_value,
|
||
total_value - sub_value real_value,
|
||
sub_value,
|
||
unix_timestamp() create_time
|
||
from
|
||
(
|
||
select
|
||
a.service_id,
|
||
a.agent_id,
|
||
a.channel_id,
|
||
a.sales_id,
|
||
a.total_value,
|
||
a.type,
|
||
case a.type
|
||
when 0 then 0
|
||
when 1 then a.value * a.total_value
|
||
when 2 then a.value
|
||
else 0
|
||
end sub_value,
|
||
case concat(a.agent_id, a.channel_id, a.sales_id)
|
||
when @g then @i := @i + 1
|
||
else @i := 1
|
||
end rn,
|
||
@g := concat(a.agent_id, a.channel_id, a.sales_id)
|
||
from
|
||
(
|
||
select
|
||
a.agent_id,
|
||
a.channel_id,
|
||
c.saus_salesid sales_id,
|
||
sum(a.commission_total) total_value,
|
||
b.id service_id,
|
||
b.type,
|
||
b.value,
|
||
b.min_value,
|
||
b.max_value
|
||
from
|
||
ct_user_commission a
|
||
inner join
|
||
ct_agent_service b
|
||
on
|
||
a.agent_id = b.agent_id and a.channel_id = b.channel_id
|
||
inner join
|
||
ct_sales_player c
|
||
on
|
||
a.agent_id = c.agent_id and a.channel_id = c.channel_id and a.target_id = c.play_playerid
|
||
where
|
||
ifnull(a.target_mode, 0) in (3, 4) and -- 转给指定的玩家对应的代理账号
|
||
a.is_settle = 0 and
|
||
b.type != 0
|
||
group by
|
||
a.agent_id,
|
||
a.channel_id,
|
||
c.saus_salesid,
|
||
b.type,
|
||
b.value,
|
||
b.min_value,
|
||
b.max_value
|
||
) a,
|
||
(select @g := '') g,
|
||
(select @i := 0) i
|
||
where
|
||
(a.total_value >= a.min_value or -1 = a.min_value) and
|
||
(a.total_value <= a.max_value or -1 = a.max_value)
|
||
) t
|
||
where
|
||
rn = 1
|
||
) b
|
||
set
|
||
#a.saus_bean = a.saus_bean + b.real_value
|
||
a.currency_total = ifnull(a.currency_total, 0) + b.real_value,
|
||
a.currency_withdraw = ifnull(a.currency_withdraw, 0) + b.real_value
|
||
where
|
||
a.saus_agentid = b.agent_id and
|
||
a.saus_channelid = b.channel_id and
|
||
a.saus_salesid = b.sales_id;
|
||
/*
|
||
set nLine := nLine + 1;
|
||
|
||
-- 更新统一用户帐户表
|
||
update
|
||
ct_user_account a,
|
||
(
|
||
select
|
||
a.service_id,
|
||
a.agent_id,
|
||
a.channel_id,
|
||
b.user_id,
|
||
a.sales_id,
|
||
a.total_value,
|
||
a.total_value - a.sub_value real_value,
|
||
a.sub_value,
|
||
now() create_time
|
||
from
|
||
(
|
||
select
|
||
a.service_id,
|
||
a.agent_id,
|
||
a.channel_id,
|
||
a.sales_id,
|
||
a.total_value,
|
||
a.type,
|
||
case a.type
|
||
when 0 then 0
|
||
when 1 then a.value * a.total_value
|
||
when 2 then a.value
|
||
else 0
|
||
end sub_value,
|
||
case concat(a.agent_id, a.channel_id, a.sales_id)
|
||
when @g then @i := @i + 1
|
||
else @i := 1
|
||
end rn,
|
||
@g := concat(a.agent_id, a.channel_id, a.sales_id)
|
||
from
|
||
(
|
||
select
|
||
a.agent_id,
|
||
a.channel_id,
|
||
c.saus_salesid sales_id,
|
||
sum(a.commission_total) total_value,
|
||
b.id service_id,
|
||
b.type,
|
||
b.value,
|
||
b.min_value,
|
||
b.max_value
|
||
from
|
||
ct_user_commission a
|
||
inner join
|
||
ct_agent_service b
|
||
on
|
||
a.agent_id = b.agent_id and a.channel_id = b.channel_id
|
||
inner join
|
||
ct_sales_player c
|
||
on
|
||
a.agent_id = c.agent_id and a.channel_id = c.channel_id and a.target_id = c.play_playerid
|
||
where
|
||
ifnull(a.target_mode, 0) in (3, 4) and -- 转给指定的玩家对应的代理账号
|
||
a.is_settle = 0 and
|
||
b.type != 0
|
||
group by
|
||
a.agent_id,
|
||
a.channel_id,
|
||
c.saus_salesid,
|
||
b.type,
|
||
b.value,
|
||
b.min_value,
|
||
b.max_value
|
||
) a,
|
||
(select @g := '') g,
|
||
(select @i := 0) i
|
||
where
|
||
(a.total_value >= a.min_value or -1 = a.min_value) and
|
||
(a.total_value <= a.max_value or -1 = a.max_value)
|
||
) a
|
||
inner join
|
||
sales_user b
|
||
on
|
||
a.agent_id = b.saus_agentid and a.channel_id = b.saus_channelid and a.sales_id = b.saus_salesid
|
||
where
|
||
rn = 1
|
||
) b
|
||
set
|
||
a.currency = a.currency + b.real_value
|
||
where
|
||
a.user_id = b.user_id;
|
||
*/
|
||
set nLine := nLine + 1;
|
||
|
||
-- 保存茶水费流水
|
||
insert into
|
||
ct_service_info
|
||
(
|
||
service_id,
|
||
agent_id,
|
||
channel_id,
|
||
user_id,
|
||
sales_id,
|
||
total_value,
|
||
real_value,
|
||
sub_value,
|
||
create_time,
|
||
service_index
|
||
)
|
||
select
|
||
a.service_id,
|
||
a.agent_id,
|
||
a.channel_id,
|
||
b.user_id,
|
||
a.sales_id,
|
||
a.total_value,
|
||
a.total_value - a.sub_value real_value,
|
||
a.sub_value,
|
||
now() create_time,
|
||
a.service_index + 1
|
||
from
|
||
(
|
||
select
|
||
a.service_id,
|
||
a.agent_id,
|
||
a.channel_id,
|
||
a.sales_id,
|
||
a.total_value,
|
||
a.type,
|
||
case a.type
|
||
when 0 then 0
|
||
when 1 then a.value * a.total_value
|
||
when 2 then a.value
|
||
else 0
|
||
end sub_value,
|
||
case concat(a.agent_id, a.channel_id, a.sales_id)
|
||
when @g then @i := @i + 1
|
||
else @i := 1
|
||
end rn,
|
||
a.service_index,
|
||
@g := concat(a.agent_id, a.channel_id, a.sales_id)
|
||
from
|
||
(
|
||
select
|
||
a.agent_id,
|
||
a.channel_id,
|
||
c.saus_salesid sales_id,
|
||
sum(a.commission_total) total_value,
|
||
b.id service_id,
|
||
b.type,
|
||
b.value,
|
||
b.min_value,
|
||
b.max_value,
|
||
d.service_index
|
||
from
|
||
ct_user_commission a
|
||
inner join
|
||
ct_agent_service b
|
||
on
|
||
a.agent_id = b.agent_id and a.channel_id = b.channel_id
|
||
inner join
|
||
ct_sales_player c
|
||
on
|
||
a.agent_id = c.agent_id and a.channel_id = c.channel_id and a.target_id = c.play_playerid
|
||
inner join
|
||
ct_channel_list d
|
||
on
|
||
a.agent_id = d.agent_id and a.channel_id = d.channel_id
|
||
where
|
||
ifnull(a.target_mode, 0) in (3, 4) and -- 转给指定的玩家对应的代理账号
|
||
a.is_settle = 0 and
|
||
b.type != 0
|
||
group by
|
||
a.agent_id,
|
||
a.channel_id,
|
||
c.saus_salesid,
|
||
b.type,
|
||
b.value,
|
||
b.min_value,
|
||
b.max_value,
|
||
d.service_index
|
||
) a,
|
||
(select @g := '') g,
|
||
(select @i := 0) i
|
||
where
|
||
(a.total_value >= a.min_value or -1 = a.min_value) and
|
||
(a.total_value <= a.max_value or -1 = a.max_value)
|
||
) a
|
||
inner join
|
||
sales_user b
|
||
on
|
||
a.agent_id = b.saus_agentid and a.channel_id = b.saus_channelid and a.sales_id = b.saus_salesid
|
||
where
|
||
rn = 1;
|
||
|
||
set nLine := nLine + 1;
|
||
|
||
-- 更新抽水记录的服务费/茶水费计算序号
|
||
update
|
||
ct_user_commission a,
|
||
ct_channel_list b
|
||
set
|
||
a.service_index = b.service_index + 1
|
||
where
|
||
a.agent_id = b.agent_id and a.channel_id = b.channel_id and
|
||
ifnull(a.target_mode, 0) in (3, 4) and -- 转给指定的玩家对应的代理账号
|
||
a.is_settle = 0;
|
||
|
||
|
||
-- 更新渠道的服务费/茶水费计算序号
|
||
update
|
||
ct_channel_list a,
|
||
(
|
||
select
|
||
a.agent_id, a.channel_id
|
||
from
|
||
ct_user_commission a
|
||
where
|
||
ifnull(a.target_mode, 0) in (3, 4) and -- 转给指定的玩家对应的代理账号
|
||
a.is_settle = 0
|
||
group by
|
||
a.agent_id, a.channel_id
|
||
) b
|
||
set
|
||
a.service_index = a.service_index + 1
|
||
where
|
||
a.agent_id = b.agent_id and a.channel_id = b.channel_id;
|
||
|
||
set nLine := nLine + 1;
|
||
|
||
-- 增加玩家绑定的代理的总计抽水金币数
|
||
update
|
||
sales_user a,
|
||
(
|
||
select
|
||
agent_id, channel_id, user_id, sum(ifnull(commission_user, 0)) commission_user
|
||
from
|
||
ct_user_commission
|
||
where
|
||
ifnull(target_mode, 0) = 0 and is_settle = 0
|
||
group by
|
||
agent_id, channel_id, user_id
|
||
) b
|
||
set
|
||
a.currency_total = ifnull(a.currency_total, 0) + b.commission_user,
|
||
a.currency_withdraw = ifnull(a.currency_withdraw, 0) + b.commission_user
|
||
where
|
||
a.saus_agentid = b.agent_id and
|
||
a.saus_channelid = b.channel_id and
|
||
a.saus_salesid = b.user_id;
|
||
|
||
set nLine := nLine + 1;
|
||
|
||
-- 增加玩家绑定的代理的上级代理的总计抽水金币数
|
||
update
|
||
sales_user a,
|
||
(
|
||
select
|
||
agent_id, channel_id, parent_user_id user_id, sum(ifnull(commission_parent_user, 0)) commission_user
|
||
from
|
||
ct_user_commission
|
||
where
|
||
ifnull(target_mode, 0) = 0 and is_settle = 0
|
||
group by
|
||
agent_id, channel_id, parent_user_id
|
||
) b
|
||
set
|
||
a.currency_total = ifnull(a.currency_total, 0) + b.commission_user,
|
||
a.currency_withdraw = ifnull(a.currency_withdraw, 0) + b.commission_user
|
||
where
|
||
a.saus_agentid = b.agent_id and
|
||
a.saus_channelid = b.channel_id and
|
||
a.saus_salesid = b.user_id;
|
||
|
||
set nLine := nLine + 1;
|
||
|
||
-- 添加房主的总计抽水金币数
|
||
update
|
||
sales_user a,
|
||
(
|
||
select
|
||
agent_id, channel_id, owner_id player_id, sum(ifnull(commission_owner, 0)) commission_user
|
||
from
|
||
ct_user_commission
|
||
where
|
||
ifnull(target_mode, 0) = 0 and is_settle = 0
|
||
group by
|
||
agent_id, channel_id, owner_id
|
||
) b
|
||
set
|
||
a.currency_total = ifnull(a.currency_total, 0) + b.commission_user,
|
||
a.currency_withdraw = ifnull(a.currency_withdraw, 0) + b.commission_user
|
||
where
|
||
a.saus_agentid = b.agent_id and
|
||
a.saus_channelid = b.channel_id and
|
||
a.player_id = b.player_id;
|
||
|
||
/*
|
||
set nLine := nLine + 1;
|
||
|
||
-- 计算可提现金币数
|
||
update
|
||
sales_user a,
|
||
(
|
||
select
|
||
agent_id, channel_id, user_id
|
||
from
|
||
ct_user_commission
|
||
where
|
||
is_settle = 0
|
||
union all
|
||
select
|
||
agent_id, channel_id, parent_user_id
|
||
from
|
||
ct_user_commission
|
||
where
|
||
is_settle = 0
|
||
) b
|
||
set
|
||
a.currency_withdraw = ifnull(a.currency_total, 0) - ifnull(a.currency_freeze, 0)
|
||
where
|
||
a.saus_agentid = b.agent_id and
|
||
a.saus_channelid = b.channel_id and
|
||
a.saus_salesid = b.user_id;
|
||
*/
|
||
set nLine := nLine + 1;
|
||
|
||
-- 变更状态
|
||
update
|
||
ct_user_commission
|
||
set
|
||
is_settle = 1
|
||
where
|
||
ifnull(is_settle, 0) = 0;
|
||
|
||
set nLine := nLine + 1;
|
||
|
||
-- 更新表(player)
|
||
update
|
||
player a,
|
||
game_db_temp.player b
|
||
set
|
||
a.play_nickname = b.play_nickname,
|
||
a.play_bean = b.play_bean,
|
||
a.play_roomcard = b.play_roomcard,
|
||
a.play_a_country = b.play_a_country,
|
||
a.play_a_province = b.play_a_province,
|
||
a.play_a_city = b.play_a_city,
|
||
a.play_a_citycode = b.play_a_citycode,
|
||
a.play_a_district = b.play_a_district,
|
||
a.play_a_street = b.play_a_street,
|
||
a.play_a_address = b.play_a_address,
|
||
a.play_longitude = b.play_longitude,
|
||
a.play_latitude = b.play_latitude,
|
||
a.play_marketid = b.play_marketid,
|
||
a.play_phoneinfo = b.play_phoneinfo,
|
||
a.play_whitelist = b.play_whitelist,
|
||
a.play_bankpower = b.play_bankpower,
|
||
a.play_bank = b.play_bank,
|
||
a.play_bankpwd = b.play_bankpwd
|
||
where
|
||
a.play_agentid = b.play_agentid and
|
||
a.play_channelid = b.play_channelid and
|
||
a.play_playerid = b.play_playerid;
|
||
|
||
set nLine := nLine + 1;
|
||
|
||
-- 更新金币平衡报表数据
|
||
set dtReport := date_add(now(), interval -1 day);
|
||
delete from ct_gold_balance where report_date = date_format(dtReport, '%Y-%m-%d');
|
||
insert into
|
||
ct_gold_balance
|
||
(
|
||
agent_id, -- 代理号
|
||
channel_id, -- 渠道号
|
||
channel_name, -- 渠道名
|
||
report_date, -- 日期
|
||
trans_sales, -- 转给代理的金币
|
||
trans_player, -- 转给玩家的金币
|
||
buy_sales, -- 代理购买的金币
|
||
buy_player, -- 玩家购买的金币
|
||
buy_third, -- 第三方代付购买的金币
|
||
request_sales, -- 代理索要的金币
|
||
request_player, -- 玩家索要的金币
|
||
robot_produce, -- 机器人输掉的金币
|
||
system_produce, -- 系统转出的金币
|
||
manager_produce, -- 总代理转出的金币
|
||
gift, -- 赠送的金币
|
||
stock_sales, -- 代理库存的金币
|
||
stock_player, -- 玩家库存的金币
|
||
bank_sales, -- 代理银行中的金币
|
||
bank_player, -- 玩家银行中的金币
|
||
consume_commission_system, -- 系统扣除的分成金币
|
||
consume_commission_service, -- 系统扣除的服务金币
|
||
robot_consume, -- 机器人赢的金币
|
||
system_consume, -- 系统扣罚的金币
|
||
manager_consume -- 总代理扣罚的金币
|
||
)
|
||
select
|
||
a.agent_id, -- 代理号
|
||
a.channel_id, -- 渠道号
|
||
a.nickname, -- 渠道名称
|
||
date_format(dtReport, '%Y-%m-%d'),
|
||
#ifnull(ab.card_trans_sales, 0), -- 转给代理房卡数
|
||
ifnull(ac.gold_trans_sales, 0), -- 转给代理金币数
|
||
#ifnull(ad.card_trans_player, 0), -- 转给玩家房卡数
|
||
ifnull(ae.gold_trans_player, 0), -- 转给玩家金币数
|
||
#ifnull(af.card_buy_sales, 0), -- 代理购买房卡
|
||
ifnull(af.gold_buy_sales, 0), -- 代理购买金币
|
||
#ifnull(af.card_buy_player, 0), -- 玩家购买房卡
|
||
ifnull(af.gold_buy_player, 0), -- 玩家购买金币
|
||
#ifnull(al.card_buy_third, 0), -- 第三方代付购买的房卡
|
||
ifnull(al.gold_buy_third, 0), -- 第三方代付购买的金币
|
||
#ifnull(ah.card_request_sales, 0), -- 代理索要房卡
|
||
ifnull(ah.gold_request_sales, 0), -- 代理索要金币
|
||
#ifnull(ah.card_request_player, 0), -- 玩家索要房卡
|
||
ifnull(ah.gold_request_player, 0), -- 玩家索要金币
|
||
#0 card_robot_produce, -- 机器人生产房卡
|
||
ifnull(ai.gold_robot_produce, 0), -- 机器人生产金币
|
||
#ifnull(aj.card_system_produce, 0), -- 系统转出去的房卡
|
||
ifnull(aj.gold_system_produce, 0), -- 系统转出去的金币
|
||
#ifnull(ak.card_manager_produce, 0), -- 总代理转出去的房卡
|
||
ifnull(ak.gold_manager_produce, 0), -- 总代理转出去的金币
|
||
#0 card_gift, -- 赠送房卡
|
||
0 gold_gift, -- 赠送金币
|
||
|
||
#ifnull(ba.card_stock_sales, 0) card_stock_sales, -- 代理库存房卡
|
||
ifnull(ba.gold_stock_sales, 0) gold_stock_sales, -- 代理库存金币
|
||
#ifnull(bb.card_stock_player, 0) card_stock_player, -- 玩家库存房卡
|
||
ifnull(bb.gold_stock_player, 0) gold_stock_player, -- 玩家库存金币
|
||
ifnull(ba.gold_bank_sales, 0) gold_bank_sales, -- 代理银行中的金币
|
||
ifnull(bb.gold_bank_player, 0) gold_bank_player, -- 玩家银行中的金币
|
||
|
||
ifnull(ca.gold_consume_commission_system, 0), -- 系统分成金币
|
||
ifnull(cb.gold_consume_commission_service, 0), -- 系统扣除服务费金币
|
||
ifnull(cc.gold_robot_consume, 0), -- 机器人消费金币
|
||
#ifnull(cd.card_system_consume, 0), -- 系统扣罚的房卡
|
||
ifnull(cd.gold_system_consume, 0), -- 系统扣罚的金币
|
||
#ifnull(ce.card_manager_consume, 0), -- 总代理扣罚的房卡
|
||
ifnull(ce.gold_manager_consume, 0) -- 总代理扣罚的金币
|
||
from
|
||
ct_channel_list a -- 渠道列表
|
||
-- 以下是生产数据
|
||
left join
|
||
(
|
||
select
|
||
a.satr_agentid agent_id,
|
||
a.channel_id,
|
||
-- a.from_sales sales_id,
|
||
sum(a.satr_amount) card_trans_sales
|
||
from
|
||
sales_transferbill a
|
||
inner join
|
||
sales_user b
|
||
on
|
||
a.satr_agentid = b.saus_agentid and a.channel_id = b.saus_channelid and a.from_sales = b.saus_salesid
|
||
where
|
||
ifnull(b.statistic_type, 0) = 1 and ifnull(b.saus_status, 1) = 0 and date_format(a.satr_transfertime, '%Y-%m-%d') = date_format(dtReport, '%Y-%m-%d')
|
||
group by
|
||
a.satr_agentid, a.channel_id-- , a.from_sales
|
||
) ab -- 转给代理的房卡数
|
||
on
|
||
a.agent_id = ab.agent_id and a.channel_id = ab.channel_id
|
||
left join
|
||
(
|
||
select
|
||
a.agent_id,
|
||
a.channel_id,
|
||
-- a.send_id sales_id,
|
||
sum(a.amount) gold_trans_sales
|
||
from
|
||
trans_star_record a
|
||
inner join
|
||
sales_user b
|
||
on
|
||
a.agent_id = b.saus_agentid and a.channel_id = b.saus_channelid and a.send_id = b.saus_salesid
|
||
where
|
||
ifnull(b.statistic_type, 0) = 1 and ifnull(b.saus_status, 1) = 0 and date_format(a.op_time, '%Y-%m-%d') = date_format(dtReport, '%Y-%m-%d')
|
||
group by
|
||
a.agent_id, a.channel_id-- , a.send_id
|
||
) ac -- 转给代理的金币数
|
||
on
|
||
a.agent_id = ac.agent_id and a.channel_id = ac.channel_id
|
||
left join
|
||
(
|
||
select
|
||
a.sase_agentid agent_id,
|
||
a.channel_id,
|
||
-- a.from_sales sales_id,
|
||
sum(a.sase_amount) card_trans_player
|
||
from
|
||
sales_sellbill a
|
||
inner join
|
||
sales_user b
|
||
on
|
||
a.sase_agentid = b.saus_agentid and a.channel_id = b.saus_channelid and a.from_sales = b.saus_salesid
|
||
where
|
||
ifnull(b.statistic_type, 0) = 1 and ifnull(b.saus_status, 1) = 0 and date_format(a.sase_selltime, '%Y-%m-%d') = date_format(dtReport, '%Y-%m-%d')
|
||
group by
|
||
a.sase_agentid, a.channel_id-- , a.from_sales
|
||
) ad -- 转给玩家的房卡数
|
||
on
|
||
a.agent_id = ad.agent_id and a.channel_id = ad.channel_id
|
||
left join
|
||
(
|
||
select
|
||
a.ssbe_agentid agent_id,
|
||
a.channel_id,
|
||
-- a.from_sales sales_id,
|
||
sum(a.ssbe_amount) gold_trans_player
|
||
from
|
||
sales_sellbill_bean a
|
||
inner join
|
||
sales_user b
|
||
on
|
||
a.ssbe_agentid = b.saus_agentid and a.channel_id = b.saus_channelid and a.from_sales = b.saus_salesid
|
||
where
|
||
ifnull(b.statistic_type, 0) = 1 and ifnull(b.saus_status, 1) = 0 and date_format(a.ssbe_selltime, '%Y-%m-%d') = date_format(dtReport, '%Y-%m-%d')
|
||
group by
|
||
a.ssbe_agentid, a.channel_id-- , a.from_sales
|
||
) ae -- 转给玩家的金币数
|
||
on
|
||
a.agent_id = ae.agent_id and a.channel_id = ae.channel_id
|
||
/*
|
||
left join
|
||
(
|
||
select
|
||
a.sabu_agentid agent_id,
|
||
a.sabu_channelid channel_id,
|
||
sum(case a.sabu_billtype when 1 then a.sabu_amount else 0 end) card_buy_sales,
|
||
sum(case a.sabu_billtype when 0 then a.sabu_amount else 0 end) card_buy_player
|
||
from
|
||
sales_buybill a
|
||
where
|
||
a.sabu_paystate = 1 and date_format(a.sabu_paytime, '%Y-%m-%d') = date_format(dtReport, '%Y-%m-%d')
|
||
group by
|
||
a.sabu_agentid, a.sabu_channelid
|
||
) af -- 购买的房卡数
|
||
on
|
||
a.agent_id = af.agent_id and a.channel_id = af.channel_id
|
||
left join
|
||
(
|
||
select
|
||
a.agent_id,
|
||
a.channel_id,
|
||
sum(case a.order_type when 1 then a.star_amount else 0 end) gold_buy_sales,
|
||
sum(case a.order_type when 0 then a.star_amount else 0 end) gold_buy_player
|
||
from
|
||
order_star a
|
||
where
|
||
a.status = 1 and date_format(a.pay_time, '%Y-%m-%d') = date_format(dtReport, '%Y-%m-%d')
|
||
) ag -- 购买的金币数
|
||
on
|
||
a.agent_id = ag.agent_id and a.channel_id = ag.channel_id
|
||
*/
|
||
left join
|
||
(
|
||
select
|
||
agent_id,
|
||
channel_id,
|
||
sum(case when product_type = 0 and order_type = 1 then product_amount else 0 end) card_buy_sales, # 代理购买房卡数
|
||
sum(case when product_type = 0 and order_type = 0 then product_amount else 0 end) card_buy_player, # 玩家购买房卡数
|
||
sum(case when product_type = 1 and order_type = 1 then product_amount else 0 end) gold_buy_sales, # 代理购买金币数
|
||
sum(case when product_type = 1 and order_type = 0 then product_amount else 0 end) gold_buy_player, # 玩家购买金币数
|
||
sum(case when product_type = 2 and order_type = 1 then product_amount else 0 end) diamond_buy_sales, # 代理购买钻石数
|
||
sum(case when product_type = 2 and order_type = 0 then product_amount else 0 end) diamond_buy_player # 玩家购买钻石数
|
||
from
|
||
ct_order_info
|
||
where
|
||
pay_status = 1 and date_format(from_unixtime(pay_time), '%Y-%m-%d') = date_format(dtReport, '%Y-%m-%d')
|
||
group by
|
||
agent_id, channel_id
|
||
) af -- 购买订单
|
||
on
|
||
a.agent_id = af.agent_id and a.channel_id = af.channel_id
|
||
left join
|
||
(
|
||
select
|
||
a.saab_agentid agent_id,
|
||
a.channel_id,
|
||
sum(case a.saab_type when 0 then a.saab_amount else 0 end) card_request_player, -- 玩家索要房卡
|
||
sum(case a.saab_type when 1 then a.saab_amount else 0 end) card_request_sales, -- 代理索要房卡
|
||
sum(case a.saab_type when 2 then a.saab_amount else 0 end) gold_request_player, -- 玩家索要金币
|
||
sum(case a.saab_type when 3 then a.saab_amount else 0 end) gold_request_sales -- 代理索要金币
|
||
from
|
||
sales_ask_bill a
|
||
inner join
|
||
sales_user b
|
||
on
|
||
a.saab_agentid = b.saus_agentid and a.channel_id = b.saus_channelid and a.saab_salesid = b.saus_salesid
|
||
where
|
||
a.saab_state = 1 and ifnull(b.statistic_type, 0) = 1 and ifnull(b.saus_status, 1) = 0 and date_format(a.saab_dealtime, '%Y-%m-%d') = date_format(dtReport, '%Y-%m-%d')
|
||
) ah -- 索要的房卡和金币数
|
||
on
|
||
a.agent_id = ah.agent_id and a.channel_id = ah.channel_id
|
||
left join
|
||
(
|
||
select
|
||
agent_id,
|
||
sum(grade) * -1 gold_robot_produce
|
||
from
|
||
ct_user_commission
|
||
where
|
||
is_robot = 1 and grade < 0 and date_format(create_time, '%Y-%m-%d') = date_format(dtReport, '%Y-%m-%d')
|
||
group by
|
||
agent_id
|
||
) ai -- 机器人输掉的
|
||
on
|
||
a.agent_id = ai.agent_id
|
||
left join
|
||
(
|
||
select
|
||
a.agent_id,
|
||
a.channel_id,
|
||
sum(case a.production_type when 1 then a.amount else 0 end) card_system_produce,
|
||
sum(case a.production_type when 2 then a.amount else 0 end) gold_system_produce
|
||
from
|
||
ct_production_info a
|
||
#inner join
|
||
# sales_user b
|
||
#on
|
||
# a.agent_id = b.saus_agentid and a.channel_id = b.saus_channelid and a.from_user = b.saus_salesid
|
||
where
|
||
a.amount > 0 and
|
||
#ifnull(b.statistic_type, 0) = 1 and
|
||
date_format(a.create_time, '%Y-%m-%d') = date_format(dtReport, '%Y-%m-%d')
|
||
group by
|
||
a.agent_id, a.channel_id
|
||
) aj -- 平台转出去的
|
||
on
|
||
a.agent_id = aj.agent_id and a.channel_id = aj.channel_id
|
||
left join
|
||
(
|
||
select
|
||
a.agent_id,
|
||
a.channel_id,
|
||
sum(case a.production_type when 1 then a.amount else 0 end) card_manager_produce,
|
||
sum(case a.production_type when 2 then a.amount else 0 end) gold_manager_produce
|
||
from
|
||
ct_manager_production_info a
|
||
inner join
|
||
sales_user b
|
||
on
|
||
a.agent_id = b.saus_agentid and a.channel_id = b.saus_channelid and a.from_user = b.saus_salesid
|
||
where
|
||
a.oper_type = 1 and ifnull(b.statistic_type, 0) = 1 and date_format(a.create_time, '%Y-%m-%d') = date_format(dtReport, '%Y-%m-%d')
|
||
group by
|
||
a.agent_id, a.channel_id
|
||
) ak -- 代理转出去的
|
||
on
|
||
a.agent_id = ak.agent_id and a.channel_id = ak.channel_id
|
||
left join
|
||
(
|
||
select
|
||
a.agent_id,
|
||
a.channel_id,
|
||
sum(case a.type when 1 then a.amount else 0 end) card_buy_third,
|
||
sum(case a.type when 2 then a.amount else 0 end) gold_buy_third
|
||
from
|
||
ct_pay_for_third a
|
||
where
|
||
date_format(a.create_time, '%Y-%m-%d') = date_format(dtReport, '%Y-%m-%d')
|
||
group by
|
||
a.agent_id, a.channel_id
|
||
) al -- 第三方代付购买的
|
||
on
|
||
a.agent_id = al.agent_id and a.channel_id = al.channel_id
|
||
|
||
-- 以上是生产数据
|
||
-- 以下是库存数据
|
||
left join
|
||
(
|
||
select
|
||
saus_agentid agent_id,
|
||
saus_channelid channel_id,
|
||
sum(saus_roomcard) card_stock_sales,
|
||
sum(saus_bean) gold_stock_sales,
|
||
0 card_bank_sales,
|
||
0 gold_bank_sales
|
||
from
|
||
sales_user
|
||
where
|
||
ifnull(statistic_type, 0) = 0
|
||
group by
|
||
saus_agentid, saus_channelid
|
||
) ba -- 代理的库存房卡和金币数
|
||
on
|
||
a.agent_id = ba.agent_id and a.channel_id = ba.channel_id
|
||
left join
|
||
(
|
||
select
|
||
play_agentid agent_id,
|
||
play_channelid channel_id,
|
||
sum(play_roomcard) card_stock_player,
|
||
sum(play_bean) gold_stock_player,
|
||
0 card_bank_player,
|
||
sum(play_bank) gold_bank_player
|
||
from
|
||
player
|
||
group by
|
||
play_agentid, play_channelid
|
||
) bb -- 玩家的库存房卡和金币数
|
||
on
|
||
a.agent_id = bb.agent_id and a.channel_id = bb.channel_id
|
||
-- 以上是库存数据
|
||
-- 以下是消耗数据
|
||
left join
|
||
(
|
||
select
|
||
agent_id,
|
||
channel_id,
|
||
sum(commission_system) gold_consume_commission_system
|
||
from
|
||
ct_user_commission
|
||
where
|
||
ifnull(is_settle, 0) != 0 and date_format(create_time, '%Y-%m-%d') = date_format(dtReport, '%Y-%m-%d')
|
||
group by
|
||
agent_id, channel_id
|
||
) ca -- 系统分成扣除的金币数
|
||
on
|
||
a.agent_id = ca.agent_id and a.channel_id = ca.channel_id
|
||
left join
|
||
(
|
||
select
|
||
agent_id,
|
||
channel_id,
|
||
sum(sub_value) gold_consume_commission_service
|
||
from
|
||
ct_service_info
|
||
where
|
||
date_format(create_time, '%Y-%m-%d') = date_format(dtReport, '%Y-%m-%d')
|
||
group by
|
||
agent_id, channel_id
|
||
) cb -- 茶水费扣除的服务费
|
||
on
|
||
a.agent_id = cb.agent_id and a.channel_id = cb.channel_id
|
||
left join
|
||
(
|
||
select
|
||
agent_id,
|
||
sum(grade) gold_robot_consume
|
||
from
|
||
ct_user_commission
|
||
where
|
||
is_robot = 1 and grade >= 0 and date_format(create_time, '%Y-%m-%d') = date_format(dtReport, '%Y-%m-%d')
|
||
group by
|
||
agent_id
|
||
) cc -- 机器人赢的
|
||
on
|
||
a.agent_id = cc.agent_id
|
||
left join
|
||
(
|
||
select
|
||
a.agent_id,
|
||
a.channel_id,
|
||
sum(case a.production_type when 1 then a.amount else 0 end) * -1 card_system_consume,
|
||
sum(case a.production_type when 2 then a.amount else 0 end) * -1 gold_system_consume
|
||
from
|
||
ct_production_info a
|
||
#inner join
|
||
# sales_user b
|
||
#on
|
||
# a.agent_id = b.saus_agentid and a.channel_id = b.saus_channelid and a.from_user = b.saus_salesid
|
||
where
|
||
a.amount < 0 and
|
||
#ifnull(b.statistic_type, 0) = 1 and
|
||
date_format(a.create_time, '%Y-%m-%d') = date_format(dtReport, '%Y-%m-%d')
|
||
group by
|
||
a.agent_id, a.channel_id
|
||
) cd -- 系统扣罚的
|
||
on
|
||
a.agent_id = cd.agent_id and a.channel_id = cd.channel_id
|
||
left join
|
||
(
|
||
select
|
||
a.agent_id,
|
||
a.channel_id,
|
||
sum(case a.production_type when 1 then a.amount else 0 end) * -1 card_manager_consume,
|
||
sum(case a.production_type when 2 then a.amount else 0 end) * -1 gold_manager_consume
|
||
from
|
||
ct_manager_production_info a
|
||
inner join
|
||
sales_user b
|
||
on
|
||
a.agent_id = b.saus_agentid and a.channel_id = b.saus_channelid and a.from_user = b.saus_salesid
|
||
where
|
||
a.oper_type = 2 and ifnull(b.statistic_type, 0) = 1 and date_format(a.create_time, '%Y-%m-%d') = date_format(dtReport, '%Y-%m-%d')
|
||
group by
|
||
a.agent_id, a.channel_id
|
||
) ce -- 总代扣罚的
|
||
on
|
||
a.agent_id = ce.agent_id and a.channel_id = ce.channel_id
|
||
-- 以上是消耗数据
|
||
where
|
||
a.is_open != 0;
|
||
|
||
set nLine := nLine + 1;
|
||
|
||
set nCursorDone := 0;
|
||
-- 打开游标
|
||
open cc_grade;
|
||
|
||
-- 开始循环
|
||
LoopCursor: loop
|
||
-- 提取游标里的数据,这里只有一个,多个的话也一样;
|
||
fetch cc_grade into szDatetime;
|
||
-- 声明结束的时候
|
||
if nCursorDone != 0 then
|
||
leave LoopCursor;
|
||
end if;
|
||
|
||
-- 插入战绩数据到分表中
|
||
set @_sql_command_ = concat(
|
||
'insert into', char(13), char(10),
|
||
' ct_grade_', szDatetime, char(13), char(10),
|
||
' (', char(13), char(10),
|
||
' agent_id,', char(13), char(10),
|
||
' channel_id,', char(13), char(10),
|
||
' game_id,', char(13), char(10),
|
||
' player_id,', char(13), char(10),
|
||
' room_code,', char(13), char(10),
|
||
' room_type,', char(13), char(10),
|
||
' owner_id,', char(13), char(10),
|
||
' room_card,', char(13), char(10),
|
||
' owner_card,', char(13), char(10),
|
||
' create_time,', char(13), char(10),
|
||
' makewar_time,', char(13), char(10),
|
||
' over_time,', char(13), char(10),
|
||
' short_number,', char(13), char(10),
|
||
' deduct_type,', char(13), char(10),
|
||
' deduct_card,', char(13), char(10),
|
||
' aset_count,', char(13), char(10),
|
||
' room_mode,', char(13), char(10),
|
||
' score,', char(13), char(10),
|
||
' is_winner,', char(13), char(10),
|
||
' room_hash,', char(13), char(10),
|
||
' out_id', char(13), char(10),
|
||
' )', char(13), char(10),
|
||
'select', char(13), char(10),
|
||
' plgr_agentid,', char(13), char(10),
|
||
' null,', char(13), char(10),
|
||
' plgr_gameid,', char(13), char(10),
|
||
' plgr_playerid,', char(13), char(10),
|
||
' plgr_roomcode,', char(13), char(10),
|
||
' plgr_roomtype,', char(13), char(10),
|
||
' plgr_ownerid,', char(13), char(10),
|
||
' plgr_roomcard,', char(13), char(10),
|
||
' plgr_ownercard,', char(13), char(10),
|
||
' plgr_createtime,', char(13), char(10),
|
||
' plgr_makewartime,', char(13), char(10),
|
||
' plgr_overtime,', char(13), char(10),
|
||
' plgr_shortcode,', char(13), char(10),
|
||
' plgr_deducttype,', char(13), char(10),
|
||
' plgr_deductcard,', char(13), char(10),
|
||
' plgr_asetcount,', char(13), char(10),
|
||
' plgr_roommode,', char(13), char(10),
|
||
' plgr_score,', char(13), char(10),
|
||
' plgr_winner,', char(13), char(10),
|
||
' concat(date_format(plgr_createtime, \'%Y%m%d%H%i%s\'), \'--\', md5(concat(plgr_agentid, plgr_gameid, plgr_roomcode, plgr_ownerid, unix_timestamp(plgr_createtime)))),', char(13), char(10),
|
||
' idx', char(13), char(10),
|
||
'from', char(13), char(10),
|
||
' game_db_temp.player_grade', char(13), char(10),
|
||
'where', char(13), char(10),
|
||
' date_format(plgr_makewartime, \'%Y%m\') = \'', szDatetime, '\' and ', char(13), char(10),
|
||
' idx not in (select out_id from ct_grade_', szDatetime, ');'
|
||
);
|
||
|
||
-- 预处理拼接好的字符串
|
||
prepare _sql_command_ from @_sql_command_;
|
||
-- 使用参数执行拼接好的字符串语句
|
||
execute _sql_command_;
|
||
-- 释放拼接的字符串语句
|
||
deallocate prepare _sql_command_;
|
||
|
||
/* 重建表索引 */
|
||
-- 设置脚本
|
||
set @_sql_command_ = concat(
|
||
'alter table ct_grade_', szDatetime, char(13), char(10),
|
||
'drop index pk_grade_', szDatetime, ',', char(13), char(10),
|
||
'drop index uk_grade_', szDatetime, ',', char(13), char(10),
|
||
'drop index nk_grade_', szDatetime, '_agent_id,', char(13), char(10),
|
||
'drop index nk_grade_', szDatetime, '_player_id,', char(13), char(10),
|
||
'drop index nk_grade_', szDatetime, '_owner_id,', char(13), char(10),
|
||
'drop index nk_grade_', szDatetime, '_create_time,', char(13), char(10),
|
||
'drop index nk_grade_', szDatetime, '_makewar_time,', char(13), char(10),
|
||
'drop index nk_grade_', szDatetime, '_over_time,', char(13), char(10),
|
||
'drop index nk_grade_', szDatetime, '_group_data,', char(13), char(10),
|
||
'add unique index pk_grade_', szDatetime, ' (id) using hash,', char(13), char(10),
|
||
'add unique index uk_grade_', szDatetime, ' (out_id) using hash,', char(13), char(10),
|
||
'add index nk_grade_', szDatetime, '_agent_id (agent_id) using hash,', char(13), char(10),
|
||
'add index nk_grade_', szDatetime, '_player_id (agent_id, player_id) using hash,', char(13), char(10),
|
||
'add index nk_grade_', szDatetime, '_owner_id (agent_id, owner_id) using hash,', char(13), char(10),
|
||
'add index nk_grade_', szDatetime, '_create_time (agent_id, short_number, create_time) using hash,', char(13), char(10),
|
||
'add index nk_grade_', szDatetime, '_makewar_time (agent_id, short_number, makewar_time) using hash,', char(13), char(10),
|
||
'add index nk_grade_', szDatetime, '_over_time (agent_id, short_number, over_time) using hash,', char(13), char(10),
|
||
'add index nk_grade_', szDatetime, '_group_data (agent_id, channel_id, game_id, player_id, short_number, create_time, makewar_time, over_time) using btree;'
|
||
);
|
||
|
||
-- 预处理拼接好的字符串
|
||
prepare _sql_command_ from @_sql_command_;
|
||
-- 使用参数执行拼接好的字符串语句
|
||
execute _sql_command_;
|
||
-- 释放拼接的字符串语句
|
||
deallocate prepare _sql_command_;
|
||
end loop;
|
||
|
||
-- 关闭游标
|
||
close cc_grade;
|
||
|
||
set nLine := nLine + 1;
|
||
|
||
set nCursorDone := 0;
|
||
open cc_user_commission;
|
||
|
||
-- 开始循环
|
||
LoopCursor: loop
|
||
-- 提取游标里的数据,这里只有一个,多个的话也一样;
|
||
fetch cc_user_commission into szDatetime;
|
||
-- 声明结束的时候
|
||
if nCursorDone != 0 then
|
||
leave LoopCursor;
|
||
end if;
|
||
|
||
set @_sql_command_ := concat(
|
||
'insert into', char(13), char(10),
|
||
' ct_user_commission_', szDatetime, char(13), char(10),
|
||
' (', char(13), char(10),
|
||
' agent_id,', char(13), char(10),
|
||
' channel_id,', char(13), char(10),
|
||
' game_id,', char(13), char(10),
|
||
' room_id,', char(13), char(10),
|
||
' player_id,', char(13), char(10),
|
||
' user_id,', char(13), char(10),
|
||
' parent_user_id,', char(13), char(10),
|
||
' room_code,', char(13), char(10),
|
||
' short_number,', char(13), char(10),
|
||
' used_card,', char(13), char(10),
|
||
' owner_id,', char(13), char(10),
|
||
' room_type,', char(13), char(10),
|
||
' room_mode,', char(13), char(10),
|
||
' commission_type,', char(13), char(10),
|
||
' grade,', char(13), char(10),
|
||
' source_mode,', char(13), char(10),
|
||
' target_mode,', char(13), char(10),
|
||
' target_id,', char(13), char(10),
|
||
' mode,', char(13), char(10),
|
||
' type,', char(13), char(10),
|
||
' commission_total,', char(13), char(10),
|
||
' commission_system,', char(13), char(10),
|
||
' commission_user,', char(13), char(10),
|
||
' commission_parent_user,', char(13), char(10),
|
||
' commission_owner,', char(13), char(10),
|
||
' commission_user_rate,', char(13), char(10),
|
||
' commission_parent_user_rate,', char(13), char(10),
|
||
' commission_owner_rate,', char(13), char(10),
|
||
' create_time,', char(13), char(10),
|
||
' is_settle,', char(13), char(10),
|
||
' is_robot,', char(13), char(10),
|
||
' service_index,', char(13), char(10),
|
||
' out_id', char(13), char(10),
|
||
' )', char(13), char(10),
|
||
'select', char(13), char(10),
|
||
' agent_id,', char(13), char(10),
|
||
' channel_id,', char(13), char(10),
|
||
' game_id,', char(13), char(10),
|
||
' room_id,', char(13), char(10),
|
||
' player_id,', char(13), char(10),
|
||
' user_id,', char(13), char(10),
|
||
' parent_user_id,', char(13), char(10),
|
||
' room_code,', char(13), char(10),
|
||
' short_number,', char(13), char(10),
|
||
' used_card,', char(13), char(10),
|
||
' owner_id,', char(13), char(10),
|
||
' room_type,', char(13), char(10),
|
||
' room_mode,', char(13), char(10),
|
||
' commission_type,', char(13), char(10),
|
||
' grade,', char(13), char(10),
|
||
' source_mode,', char(13), char(10),
|
||
' target_mode,', char(13), char(10),
|
||
' target_id,', char(13), char(10),
|
||
' mode,', char(13), char(10),
|
||
' type,', char(13), char(10),
|
||
' commission_total,', char(13), char(10),
|
||
' commission_system,', char(13), char(10),
|
||
' commission_user,', char(13), char(10),
|
||
' commission_parent_user,', char(13), char(10),
|
||
' commission_owner,', char(13), char(10),
|
||
' commission_user_rate,', char(13), char(10),
|
||
' commission_parent_user_rate,', char(13), char(10),
|
||
' commission_owner_rate,', char(13), char(10),
|
||
' create_time,', char(13), char(10),
|
||
' is_settle,', char(13), char(10),
|
||
' is_robot,', char(13), char(10),
|
||
' service_index,', char(13), char(10),
|
||
' out_id', char(13), char(10),
|
||
'from', char(13), char(10),
|
||
' ct_user_commission', char(13), char(10),
|
||
'where', char(13), char(10),
|
||
' date_format(create_time, \'%Y%m\') = \'', szDatetime, '\' and ', char(13), char(10),
|
||
' out_id not in (select out_id from ct_user_commission_', szDatetime, ')'
|
||
);
|
||
|
||
-- 预处理拼接好的字符串
|
||
prepare _sql_command_ from @_sql_command_;
|
||
-- 使用参数执行拼接好的字符串语句
|
||
execute _sql_command_;
|
||
-- 释放拼接的字符串语句
|
||
deallocate prepare _sql_command_;
|
||
|
||
set @_sql_command_ := concat(
|
||
'alter table ct_user_commission_', szDatetime, char(13), char(10),
|
||
'drop index `pk_user_commission_', szDatetime, '`,', char(13), char(10),
|
||
'drop index `uk_user_commission_', szDatetime, '_out_id`,', char(13), char(10),
|
||
'drop index `nk_user_commission_', szDatetime, '_user`,', char(13), char(10),
|
||
'drop index `nk_user_commission_', szDatetime, '_player_id`,', char(13), char(10),
|
||
'drop index `nk_user_commission_', szDatetime, '_user_id`,', char(13), char(10),
|
||
'drop index `nk_user_commission_', szDatetime, '_service_index`,', char(13), char(10),
|
||
'drop index `nk_user_commission_', szDatetime, '_target_mode_settle`,', char(13), char(10),
|
||
'drop index `nk_user_commission_', szDatetime, '_target_id`,', char(13), char(10),
|
||
'add unique index `pk_user_commission_', szDatetime, '` (`id`) using hash,', char(13), char(10),
|
||
'add unique index `uk_user_commission_', szDatetime, '_out_id` (`out_id`) using hash,', char(13), char(10),
|
||
'add index `nk_user_commission_', szDatetime, '_user` (`agent_id`,`channel_id`,`player_id`,`user_id`) using hash,', char(13), char(10),
|
||
'add index `nk_user_commission_', szDatetime, '_player_id` (`agent_id`,`channel_id`,`player_id`) using hash,', char(13), char(10),
|
||
'add index `nk_user_commission_', szDatetime, '_user_id` (`agent_id`,`channel_id`,`user_id`) using hash,', char(13), char(10),
|
||
'add index `nk_user_commission_', szDatetime, '_service_index` (`agent_id`,`channel_id`,`service_index`) using hash,', char(13), char(10),
|
||
'add index `nk_user_commission_', szDatetime, '_target_mode_settle` (`target_mode`, `is_settle`, `commission_total`, `create_time`) using hash,', char(13), char(10),
|
||
'add index `nk_user_commission_', szDatetime, '_target_id` (`agent_id`, `channel_id`, `target_id`) using hash;', char(13), char(10)
|
||
);
|
||
|
||
|
||
-- 预处理拼接好的字符串
|
||
prepare _sql_command_ from @_sql_command_;
|
||
-- 使用参数执行拼接好的字符串语句
|
||
execute _sql_command_;
|
||
-- 释放拼接的字符串语句
|
||
deallocate prepare _sql_command_;
|
||
end loop;
|
||
|
||
close cc_user_commission;
|
||
|
||
set nLine := nLine + 1;
|
||
|
||
-- 重建索引(ct_grade_temp)
|
||
alter table ct_grade_temp
|
||
drop index pk_grade_temp,
|
||
drop index uk_grade_temp,
|
||
drop index nk_grade_temp_player_id,
|
||
drop index nk_grade_temp_create_time,
|
||
drop index nk_grade_temp_group_data,
|
||
drop index nk_grade_temp_group_short_number_data,
|
||
add unique index pk_grade_temp (id) using hash,
|
||
add unique index uk_grade_temp (out_id) using hash,
|
||
add index nk_grade_temp_player_id (agent_id, channel_id, game_id, player_id) using btree,
|
||
add index nk_grade_temp_create_time (agent_id, channel_id, game_id, short_number, create_time) using btree,
|
||
add index nk_grade_temp_group_data (agent_id, channel_id, player_id, short_number, create_time) using btree,
|
||
add index nk_grade_temp_group_short_number_data (agent_id, short_number, create_time) using hash;
|
||
|
||
-- 重建索引(ct_user_commission)
|
||
alter table ct_user_commission
|
||
drop index pk_user_commission,
|
||
drop index uk_user_commission_out_id,
|
||
drop index nk_user_commission_user,
|
||
drop index nk_user_commission_player_id,
|
||
drop index nk_user_commission_user_id,
|
||
drop index nk_user_commission_service_index,
|
||
drop index nk_user_commission_target_mode_settle,
|
||
drop index nk_user_commission_target_id,
|
||
add unique index pk_user_commission (id) using hash,
|
||
add unique index uk_user_commission_out_id (out_id) using hash,
|
||
add index nk_user_commission_user (agent_id, channel_id, player_id, user_id) using hash,
|
||
add index nk_user_commission_player_id (agent_id, channel_id, player_id) using hash,
|
||
add index nk_user_commission_user_id (agent_id, channel_id, user_id) using hash,
|
||
add index nk_user_commission_service_index (agent_id, channel_id, service_index) using hash,
|
||
add index nk_user_commission_target_mode_settle (target_mode, is_settle, commission_total, create_time) using hash,
|
||
add index nk_user_commission_target_id (agent_id, channel_id, target_id) using hash;
|
||
|
||
-- 重建索引(sales_user)
|
||
alter table sales_user
|
||
drop index uk_sales_user_id,
|
||
drop index uk_sales_user_userid,
|
||
drop index uk_sales_user_salesid,
|
||
drop index uk_sales_user_playerid,
|
||
drop index uk_sales_user_openid,
|
||
drop index uk_sales_user_unionid,
|
||
drop index nk_sales_user_salesid,
|
||
add unique index uk_sales_user_id (idx) using hash,
|
||
add unique index uk_sales_user_userid (user_id, saus_agentid, saus_channelid) using hash,
|
||
add unique index uk_sales_user_salesid (saus_agentid, saus_channelid, saus_salesid) using hash,
|
||
add unique index uk_sales_user_playerid (saus_agentid, saus_channelid, player_id) using hash,
|
||
add unique index uk_sales_user_openid (saus_agentid, saus_channelid, saus_openid) using hash,
|
||
add unique index uk_sales_user_unionid (saus_agentid, saus_channelid, saus_unionid) using hash,
|
||
add index nk_sales_user_salesid (saus_agentid,saus_channelid,saus_salesid,saus_openid,saus_unionid,saus_status,password) using btree;
|
||
|
||
-- 重建索引(player)
|
||
alter table player
|
||
drop index player_index1,
|
||
drop index player_index2,
|
||
drop index uk_play_playerid,
|
||
drop index nk_player,
|
||
add unique index player_index1 (play_agentid,play_channelid,play_playerid) using hash,
|
||
add unique index player_index2 (play_agentid,play_channelid,play_unionid) using hash,
|
||
add unique index uk_play_playerid (play_agentid, play_playerid) using hash,
|
||
add index nk_player (play_agentid,play_playerid,play_channelid,play_openid,play_unionid,play_status) using btree;
|
||
|
||
-- 判断是否成功
|
||
if 1 = nErrorCode then
|
||
rollback;
|
||
insert into ct_exec_log(name, time, message) values ('cp_SynchronizeSettle', now(), concat('error: ', szMessages, '(', szSqlState, ')!with: ', nLine));
|
||
select concat('error: ', szMessages, '(', szSqlState, ')!');
|
||
else
|
||
commit;
|
||
insert into ct_exec_log(name, time, message) values ('cp_SynchronizeSettle', now(), 'success!');
|
||
select 'success!';
|
||
end if;
|
||
end
|
||
;;
|
||
delimiter ;
|
||
|
||
-- ----------------------------
|
||
-- Procedure structure for cp_third_change_roomcard
|
||
-- ----------------------------
|
||
DROP PROCEDURE IF EXISTS `cp_third_change_roomcard`;
|
||
delimiter ;;
|
||
CREATE PROCEDURE `cp_third_change_roomcard`(IN `agentid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci ,IN `channelid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci ,IN `gameid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci ,IN `openid` varchar(100) charset utf8mb4 collate utf8mb4_general_ci ,IN `unionid` varchar(100) charset utf8mb4 collate utf8mb4_general_ci ,IN `amount` int(11))
|
||
SQL SECURITY INVOKER
|
||
COMMENT '修改房卡数量'
|
||
label_cp: begin
|
||
declare result tinyint(1); -- 0:成功 >0:失败
|
||
declare error varchar(100); -- 失败描述
|
||
declare playerid int(8); -- 玩家id
|
||
declare roomcard int(11); -- 玩家房卡数量
|
||
|
||
-- 检查agentid
|
||
if not exists(select 1 from agent where agen_agentid = agentid) then
|
||
set result = 1;
|
||
set error = 'a参数错误';
|
||
select result, error;
|
||
leave label_cp;
|
||
end if;
|
||
|
||
-- 检查channelid
|
||
if not exists(select 1 from agent_channel where agch_agentid = agentid and agch_channelid = channelid) then
|
||
set result = 2;
|
||
set error = 'c参数错误';
|
||
select result, error;
|
||
leave label_cp;
|
||
end if;
|
||
|
||
-- 检查gameid
|
||
if not exists(select 1 from game where game_gameid = gameid) then
|
||
set result = 3;
|
||
set error = 'g参数错误';
|
||
select result, error;
|
||
leave label_cp;
|
||
end if;
|
||
|
||
-- 检查玩家
|
||
select play_roomcard into roomcard
|
||
from player
|
||
where play_agentid = agentid and play_unionid = unionid;
|
||
if isnull(roomcard) then
|
||
set result = 4;
|
||
set error = '玩家不存在';
|
||
select result, error;
|
||
leave label_cp;
|
||
end if;
|
||
|
||
if amount > 0 then
|
||
set result = 5;
|
||
set error = '没有该权限';
|
||
select result, error;
|
||
leave label_cp;
|
||
end if;
|
||
|
||
-- 检查房卡数量是否够
|
||
if roomcard < -1 * amount then
|
||
set result = 6;
|
||
set error = '玩家房卡数量不够';
|
||
select result, error;
|
||
leave label_cp;
|
||
end if;
|
||
|
||
update player set play_roomcard = play_roomcard + amount
|
||
where play_agentid = agentid and play_unionid = unionid;
|
||
|
||
-- 返回执行结果
|
||
set result = 0;
|
||
set error = '';
|
||
select result, error, play_playerid as playerid, play_roomcard as roomcard, amount
|
||
from player
|
||
where play_agentid = agentid and play_unionid = unionid;
|
||
end
|
||
;;
|
||
delimiter ;
|
||
|
||
-- ----------------------------
|
||
-- Procedure structure for cp_third_get_roomcard
|
||
-- ----------------------------
|
||
DROP PROCEDURE IF EXISTS `cp_third_get_roomcard`;
|
||
delimiter ;;
|
||
CREATE PROCEDURE `cp_third_get_roomcard`(IN `agentid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci ,IN `channelid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci ,IN `gameid` varchar(32) charset utf8mb4 collate utf8mb4_general_ci ,IN `openid` varchar(100) charset utf8mb4 collate utf8mb4_general_ci ,IN `unionid` varchar(100) charset utf8mb4 collate utf8mb4_general_ci ,IN `nickname` varchar(100) charset utf8mb4 collate utf8mb4_general_ci ,IN `avatar` varchar(200) charset utf8mb4 collate utf8mb4_general_ci ,IN `sex` int(11) ,IN `province` varchar(100) charset utf8mb4 collate utf8mb4_general_ci ,IN `city` varchar(100) charset utf8mb4 collate utf8mb4_general_ci)
|
||
SQL SECURITY INVOKER
|
||
COMMENT '获取房卡数量'
|
||
label_cp: begin
|
||
declare result tinyint(1); -- 0:成功 >0:失败
|
||
declare error varchar(100); -- 失败描述
|
||
declare playerid int(8); -- 玩家id
|
||
declare roomcard int(11); -- 玩家房卡数量
|
||
|
||
-- 检查agentid
|
||
if not exists(select 1 from agent where agen_agentid = agentid) then
|
||
set result = 1;
|
||
set error = 'a参数错误';
|
||
select result, error;
|
||
leave label_cp;
|
||
end if;
|
||
|
||
-- 检查channelid
|
||
if not exists(select 1 from agent_channel where agch_agentid = agentid and agch_channelid = channelid) then
|
||
set result = 2;
|
||
set error = 'c参数错误';
|
||
select result, error;
|
||
leave label_cp;
|
||
end if;
|
||
|
||
-- 检查gameid
|
||
if not exists(select 1 from game where game_gameid = gameid) then
|
||
set result = 3;
|
||
set error = 'g参数错误';
|
||
select result, error;
|
||
leave label_cp;
|
||
end if;
|
||
|
||
-- 检查是否是新玩家
|
||
select play_playerid, play_roomcard
|
||
into playerid, roomcard
|
||
from player
|
||
where play_agentid = agentid
|
||
and play_unionid = unionid;
|
||
|
||
if isnull(playerid) then
|
||
-- 新玩家
|
||
update agent set agen_maxplayerid = agen_maxplayerid + 1 where agen_agentid = agentid;
|
||
|
||
select agen_maxplayerid into playerid from agent where agen_agentid = agentid;
|
||
|
||
insert into player(play_agentid, play_playerid, play_channelid, play_openid,
|
||
play_unionid, play_nickname, play_avatar, play_sex,
|
||
play_province, play_city, play_regtime, play_lasttime)
|
||
values(agentid, playerid, channelid, openid, unionid, nickname, avatar, sex, province, city, now(), now());
|
||
|
||
select play_roomcard
|
||
into roomcard
|
||
from player
|
||
where play_agentid = agentid
|
||
and play_unionid = unionid;
|
||
|
||
-- 按日期统计新增玩家数量
|
||
call cp_report_agent_day(agentid, 0, 1);
|
||
else
|
||
-- 老玩家
|
||
update player set play_nickname = nickname, play_avatar = avatar, play_openid = openid,
|
||
play_sex = sex, play_province = province, play_city = city,
|
||
play_logindate = play_logindate + if(datediff(now(), play_lasttime) = 0, 0, 1),
|
||
play_lasttime = now()
|
||
where play_agentid = agentid
|
||
and play_unionid = unionid;
|
||
end if;
|
||
|
||
-- 统计玩家的最后登录时间和累积登录天数
|
||
if not exists(select 1 from agent_game_player
|
||
where agpl_agentid = agentid
|
||
and agpl_gameid = gameid
|
||
and agpl_playerid = playerid) then
|
||
insert into agent_game_player(agpl_agentid, agpl_gameid, agpl_playerid, agpl_openid, agpl_firsttime, agpl_lasttime)
|
||
values(agentid, gameid, playerid, openid, now(), now());
|
||
|
||
-- 按日期统计新增玩家数量
|
||
call cp_report_game_day(agentid, gameid, now(), 0, 1, null);
|
||
else
|
||
update agent_game_player
|
||
set agpl_logindate = agpl_logindate + if(datediff(now(), agpl_lasttime) = 0, 0, 1),
|
||
agpl_lasttime = now()
|
||
where agpl_agentid = agentid
|
||
and agpl_gameid = gameid
|
||
and agpl_playerid = playerid;
|
||
end if;
|
||
|
||
-- 返回执行结果
|
||
set result = 0;
|
||
set error = '';
|
||
select result, error, playerid, roomcard;
|
||
end
|
||
;;
|
||
delimiter ;
|
||
|
||
-- ----------------------------
|
||
-- Procedure structure for ct_CreateGoldBalanceData
|
||
-- ----------------------------
|
||
DROP PROCEDURE IF EXISTS `ct_CreateGoldBalanceData`;
|
||
delimiter ;;
|
||
CREATE PROCEDURE `ct_CreateGoldBalanceData`(IN `sDate` varchar(20) charset utf8mb4 collate utf8mb4_general_ci)
|
||
SQL SECURITY INVOKER
|
||
begin
|
||
delete from ct_gold_balance where report_date = sDate;
|
||
|
||
insert into
|
||
ct_gold_balance
|
||
(
|
||
agent_id, -- 代理号
|
||
channel_id, -- 渠道号
|
||
channel_name, -- 渠道名
|
||
report_date, -- 日期
|
||
trans_sales, -- 转给代理的金币
|
||
trans_player, -- 转给玩家的金币
|
||
buy_sales, -- 代理购买的金币
|
||
buy_player, -- 玩家购买的金币
|
||
buy_third, -- 第三方代付购买的金币
|
||
request_sales, -- 代理索要的金币
|
||
request_player, -- 玩家索要的金币
|
||
robot_produce, -- 机器人输掉的金币
|
||
system_produce, -- 系统转出的金币
|
||
manager_produce, -- 总代理转出的金币
|
||
gift, -- 赠送的金币
|
||
stock_sales, -- 代理库存的金币
|
||
stock_player, -- 玩家库存的金币
|
||
bank_sales, -- 代理银行中的金币
|
||
bank_player, -- 玩家银行中的金币
|
||
consume_commission_system, -- 系统扣除的分成金币
|
||
consume_commission_service, -- 系统扣除的服务金币
|
||
robot_consume, -- 机器人赢的金币
|
||
system_consume, -- 系统扣罚的金币
|
||
manager_consume -- 总代理扣罚的金币
|
||
)
|
||
select
|
||
a.agent_id, -- 代理号
|
||
a.channel_id, -- 渠道号
|
||
a.nickname, -- 渠道名称
|
||
sDate,
|
||
#ifnull(ab.card_trans_sales, 0), -- 转给代理房卡数
|
||
ifnull(ac.gold_trans_sales, 0), -- 转给代理金币数
|
||
#ifnull(ad.card_trans_player, 0), -- 转给玩家房卡数
|
||
ifnull(ae.gold_trans_player, 0), -- 转给玩家金币数
|
||
#ifnull(af.card_buy_sales, 0), -- 代理购买房卡
|
||
ifnull(af.gold_buy_sales, 0), -- 代理购买金币
|
||
#ifnull(af.card_buy_player, 0), -- 玩家购买房卡
|
||
ifnull(af.gold_buy_player, 0), -- 玩家购买金币
|
||
#ifnull(al.card_buy_third, 0), -- 第三方代付购买的房卡
|
||
ifnull(al.gold_buy_third, 0), -- 第三方代付购买的金币
|
||
#ifnull(ah.card_request_sales, 0), -- 代理索要房卡
|
||
ifnull(ah.gold_request_sales, 0), -- 代理索要金币
|
||
#ifnull(ah.card_request_player, 0), -- 玩家索要房卡
|
||
ifnull(ah.gold_request_player, 0), -- 玩家索要金币
|
||
#0 card_robot_produce, -- 机器人生产房卡
|
||
ifnull(ai.gold_robot_produce, 0), -- 机器人生产金币
|
||
#ifnull(aj.card_system_produce, 0), -- 系统转出去的房卡
|
||
ifnull(aj.gold_system_produce, 0), -- 系统转出去的金币
|
||
#ifnull(ak.card_manager_produce, 0), -- 总代理转出去的房卡
|
||
ifnull(ak.gold_manager_produce, 0), -- 总代理转出去的金币
|
||
#0 card_gift, -- 赠送房卡
|
||
0 gold_gift, -- 赠送金币
|
||
|
||
#ifnull(ba.card_stock_sales, 0) card_stock_sales, -- 代理库存房卡
|
||
ifnull(ba.gold_stock_sales, 0) gold_stock_sales, -- 代理库存金币
|
||
#ifnull(bb.card_stock_player, 0) card_stock_player, -- 玩家库存房卡
|
||
ifnull(bb.gold_stock_player, 0) gold_stock_player, -- 玩家库存金币
|
||
ifnull(ba.gold_bank_sales, 0) gold_bank_sales, -- 代理银行中的金币
|
||
ifnull(bb.gold_bank_player, 0) gold_bank_player, -- 玩家银行中的金币
|
||
|
||
ifnull(ca.gold_consume_commission_system, 0), -- 系统分成金币
|
||
ifnull(cb.gold_consume_commission_service, 0), -- 系统扣除服务费金币
|
||
ifnull(cc.gold_robot_consume, 0), -- 机器人消费金币
|
||
#ifnull(cd.card_system_consume, 0), -- 系统扣罚的房卡
|
||
ifnull(cd.gold_system_consume, 0), -- 系统扣罚的金币
|
||
#ifnull(ce.card_manager_consume, 0), -- 总代理扣罚的房卡
|
||
ifnull(ce.gold_manager_consume, 0) -- 总代理扣罚的金币
|
||
from
|
||
ct_channel_list a -- 渠道列表
|
||
-- 以下是生产数据
|
||
left join
|
||
(
|
||
select
|
||
a.satr_agentid agent_id,
|
||
a.channel_id,
|
||
-- a.from_sales sales_id,
|
||
sum(a.satr_amount) card_trans_sales
|
||
from
|
||
sales_transferbill a
|
||
inner join
|
||
sales_user b
|
||
on
|
||
a.satr_agentid = b.saus_agentid and a.channel_id = b.saus_channelid and a.from_sales = b.saus_salesid
|
||
where
|
||
ifnull(b.statistic_type, 0) = 1 and ifnull(b.saus_status, 1) = 0 and date_format(a.satr_transfertime, '%Y-%m-%d') = sDate
|
||
group by
|
||
a.satr_agentid, a.channel_id-- , a.from_sales
|
||
) ab -- 转给代理的房卡数
|
||
on
|
||
a.agent_id = ab.agent_id and a.channel_id = ab.channel_id
|
||
left join
|
||
(
|
||
select
|
||
a.agent_id,
|
||
a.channel_id,
|
||
-- a.send_id sales_id,
|
||
sum(a.amount) gold_trans_sales
|
||
from
|
||
trans_star_record a
|
||
inner join
|
||
sales_user b
|
||
on
|
||
a.agent_id = b.saus_agentid and a.channel_id = b.saus_channelid and a.send_id = b.saus_salesid
|
||
where
|
||
ifnull(b.statistic_type, 0) = 1 and ifnull(b.saus_status, 1) = 0 and date_format(a.op_time, '%Y-%m-%d') = sDate
|
||
group by
|
||
a.agent_id, a.channel_id-- , a.send_id
|
||
) ac -- 转给代理的金币数
|
||
on
|
||
a.agent_id = ac.agent_id and a.channel_id = ac.channel_id
|
||
left join
|
||
(
|
||
select
|
||
a.sase_agentid agent_id,
|
||
a.channel_id,
|
||
-- a.from_sales sales_id,
|
||
sum(a.sase_amount) card_trans_player
|
||
from
|
||
sales_sellbill a
|
||
inner join
|
||
sales_user b
|
||
on
|
||
a.sase_agentid = b.saus_agentid and a.channel_id = b.saus_channelid and a.from_sales = b.saus_salesid
|
||
where
|
||
ifnull(b.statistic_type, 0) = 1 and ifnull(b.saus_status, 1) = 0 and date_format(a.sase_selltime, '%Y-%m-%d') = sDate
|
||
group by
|
||
a.sase_agentid, a.channel_id-- , a.from_sales
|
||
) ad -- 转给玩家的房卡数
|
||
on
|
||
a.agent_id = ad.agent_id and a.channel_id = ad.channel_id
|
||
left join
|
||
(
|
||
select
|
||
a.ssbe_agentid agent_id,
|
||
a.channel_id,
|
||
-- a.from_sales sales_id,
|
||
sum(a.ssbe_amount) gold_trans_player
|
||
from
|
||
sales_sellbill_bean a
|
||
inner join
|
||
sales_user b
|
||
on
|
||
a.ssbe_agentid = b.saus_agentid and a.channel_id = b.saus_channelid and a.from_sales = b.saus_salesid
|
||
where
|
||
ifnull(b.statistic_type, 0) = 1 and ifnull(b.saus_status, 1) = 0 and date_format(a.ssbe_selltime, '%Y-%m-%d') = sDate
|
||
group by
|
||
a.ssbe_agentid, a.channel_id-- , a.from_sales
|
||
) ae -- 转给玩家的金币数
|
||
on
|
||
a.agent_id = ae.agent_id and a.channel_id = ae.channel_id
|
||
/*
|
||
left join
|
||
(
|
||
select
|
||
a.sabu_agentid agent_id,
|
||
a.sabu_channelid channel_id,
|
||
sum(case a.sabu_billtype when 1 then a.sabu_amount else 0 end) card_buy_sales,
|
||
sum(case a.sabu_billtype when 0 then a.sabu_amount else 0 end) card_buy_player
|
||
from
|
||
sales_buybill a
|
||
where
|
||
a.sabu_paystate = 1 and date_format(a.sabu_paytime, '%Y-%m-%d') = sDate
|
||
group by
|
||
a.sabu_agentid, a.sabu_channelid
|
||
) af -- 购买的房卡数
|
||
on
|
||
a.agent_id = af.agent_id and a.channel_id = af.channel_id
|
||
left join
|
||
(
|
||
select
|
||
a.agent_id,
|
||
a.channel_id,
|
||
sum(case a.order_type when 1 then a.star_amount else 0 end) gold_buy_sales,
|
||
sum(case a.order_type when 0 then a.star_amount else 0 end) gold_buy_player
|
||
from
|
||
order_star a
|
||
where
|
||
a.status = 1 and date_format(a.pay_time, '%Y-%m-%d') = sDate
|
||
) ag -- 购买的金币数
|
||
on
|
||
a.agent_id = ag.agent_id and a.channel_id = ag.channel_id
|
||
*/
|
||
left join
|
||
(
|
||
select
|
||
agent_id,
|
||
channel_id,
|
||
sum(case when product_type = 0 and order_type = 1 then product_amount else 0 end) card_buy_sales, # 代理购买房卡数
|
||
sum(case when product_type = 0 and order_type = 0 then product_amount else 0 end) card_buy_player, # 玩家购买房卡数
|
||
sum(case when product_type = 1 and order_type = 1 then product_amount else 0 end) gold_buy_sales, # 代理购买金币数
|
||
sum(case when product_type = 1 and order_type = 0 then product_amount else 0 end) gold_buy_player, # 玩家购买金币数
|
||
sum(case when product_type = 2 and order_type = 1 then product_amount else 0 end) diamond_buy_sales, # 代理购买钻石数
|
||
sum(case when product_type = 2 and order_type = 0 then product_amount else 0 end) diamond_buy_player # 玩家购买钻石数
|
||
from
|
||
ct_order_info
|
||
where
|
||
pay_status = 1 and date_format(from_unixtime(pay_time), '%Y-%m-%d') = sDate
|
||
group by
|
||
agent_id, channel_id
|
||
) af -- 购买订单
|
||
on
|
||
a.agent_id = af.agent_id and a.channel_id = af.channel_id
|
||
left join
|
||
(
|
||
select
|
||
a.saab_agentid agent_id,
|
||
a.channel_id,
|
||
sum(case a.saab_type when 0 then a.saab_amount else 0 end) card_request_player, -- 玩家索要房卡
|
||
sum(case a.saab_type when 1 then a.saab_amount else 0 end) card_request_sales, -- 代理索要房卡
|
||
sum(case a.saab_type when 2 then a.saab_amount else 0 end) gold_request_player, -- 玩家索要金币
|
||
sum(case a.saab_type when 3 then a.saab_amount else 0 end) gold_request_sales -- 代理索要金币
|
||
from
|
||
sales_ask_bill a
|
||
inner join
|
||
sales_user b
|
||
on
|
||
a.saab_agentid = b.saus_agentid and a.channel_id = b.saus_channelid and a.saab_salesid = b.saus_salesid
|
||
where
|
||
a.saab_state = 1 and ifnull(b.statistic_type, 0) = 1 and ifnull(b.saus_status, 1) = 0 and date_format(a.saab_dealtime, '%Y-%m-%d') = sDate
|
||
) ah -- 索要的房卡和金币数
|
||
on
|
||
a.agent_id = ah.agent_id and a.channel_id = ah.channel_id
|
||
left join
|
||
(
|
||
select
|
||
agent_id,
|
||
sum(grade) * -1 gold_robot_produce
|
||
from
|
||
ct_user_commission
|
||
where
|
||
is_robot = 1 and grade < 0 and date_format(create_time, '%Y-%m-%d') = sDate
|
||
group by
|
||
agent_id
|
||
) ai -- 机器人输掉的
|
||
on
|
||
a.agent_id = ai.agent_id
|
||
left join
|
||
(
|
||
select
|
||
a.agent_id,
|
||
a.channel_id,
|
||
sum(case a.production_type when 1 then a.amount else 0 end) card_system_produce,
|
||
sum(case a.production_type when 2 then a.amount else 0 end) gold_system_produce
|
||
from
|
||
ct_production_info a
|
||
#inner join
|
||
# sales_user b
|
||
#on
|
||
# a.agent_id = b.saus_agentid and a.channel_id = b.saus_channelid and a.from_user = b.saus_salesid
|
||
where
|
||
a.amount > 0 and
|
||
#ifnull(b.statistic_type, 0) = 1 and
|
||
date_format(a.create_time, '%Y-%m-%d') = sDate
|
||
group by
|
||
a.agent_id, a.channel_id
|
||
) aj -- 平台转出去的
|
||
on
|
||
a.agent_id = aj.agent_id and a.channel_id = aj.channel_id
|
||
left join
|
||
(
|
||
select
|
||
a.agent_id,
|
||
a.channel_id,
|
||
sum(case a.production_type when 1 then a.amount else 0 end) card_manager_produce,
|
||
sum(case a.production_type when 2 then a.amount else 0 end) gold_manager_produce
|
||
from
|
||
ct_manager_production_info a
|
||
inner join
|
||
sales_user b
|
||
on
|
||
a.agent_id = b.saus_agentid and a.channel_id = b.saus_channelid and a.from_user = b.saus_salesid
|
||
where
|
||
a.oper_type = 1 and ifnull(b.statistic_type, 0) = 1 and date_format(a.create_time, '%Y-%m-%d') = sDate
|
||
group by
|
||
a.agent_id, a.channel_id
|
||
) ak -- 代理转出去的
|
||
on
|
||
a.agent_id = ak.agent_id and a.channel_id = ak.channel_id
|
||
left join
|
||
(
|
||
select
|
||
a.agent_id,
|
||
a.channel_id,
|
||
sum(case a.type when 1 then a.amount else 0 end) card_buy_third,
|
||
sum(case a.type when 2 then a.amount else 0 end) gold_buy_third
|
||
from
|
||
ct_pay_for_third a
|
||
where
|
||
date_format(a.create_time, '%Y-%m-%d') = sDate
|
||
group by
|
||
a.agent_id, a.channel_id
|
||
) al -- 第三方代付购买的
|
||
on
|
||
a.agent_id = al.agent_id and a.channel_id = al.channel_id
|
||
|
||
-- 以上是生产数据
|
||
-- 以下是库存数据
|
||
left join
|
||
(
|
||
select
|
||
saus_agentid agent_id,
|
||
saus_channelid channel_id,
|
||
sum(saus_roomcard) card_stock_sales,
|
||
sum(saus_bean) gold_stock_sales,
|
||
0 card_bank_sales,
|
||
0 gold_bank_sales
|
||
from
|
||
sales_user
|
||
where
|
||
ifnull(statistic_type, 0) = 0
|
||
group by
|
||
saus_agentid, saus_channelid
|
||
) ba -- 代理的库存房卡和金币数
|
||
on
|
||
a.agent_id = ba.agent_id and a.channel_id = ba.channel_id
|
||
left join
|
||
(
|
||
select
|
||
play_agentid agent_id,
|
||
play_channelid channel_id,
|
||
sum(play_roomcard) card_stock_player,
|
||
sum(play_bean) gold_stock_player,
|
||
0 card_bank_player,
|
||
sum(play_bank) gold_bank_player
|
||
from
|
||
player
|
||
group by
|
||
play_agentid, play_channelid
|
||
) bb -- 玩家的库存房卡和金币数
|
||
on
|
||
a.agent_id = bb.agent_id and a.channel_id = bb.channel_id
|
||
-- 以上是库存数据
|
||
-- 以下是消耗数据
|
||
left join
|
||
(
|
||
select
|
||
agent_id,
|
||
channel_id,
|
||
sum(commission_system) gold_consume_commission_system
|
||
from
|
||
ct_user_commission
|
||
where
|
||
ifnull(is_settle, 0) != 0 and date_format(create_time, '%Y-%m-%d') = sDate
|
||
group by
|
||
agent_id, channel_id
|
||
) ca -- 系统分成扣除的金币数
|
||
on
|
||
a.agent_id = ca.agent_id and a.channel_id = ca.channel_id
|
||
left join
|
||
(
|
||
select
|
||
agent_id,
|
||
channel_id,
|
||
sum(sub_value) gold_consume_commission_service
|
||
from
|
||
ct_service_info
|
||
where
|
||
date_format(create_time, '%Y-%m-%d') = sDate
|
||
group by
|
||
agent_id, channel_id
|
||
) cb -- 茶水费扣除的服务费
|
||
on
|
||
a.agent_id = cb.agent_id and a.channel_id = cb.channel_id
|
||
left join
|
||
(
|
||
select
|
||
agent_id,
|
||
sum(grade) gold_robot_consume
|
||
from
|
||
ct_user_commission
|
||
where
|
||
is_robot = 1 and grade >= 0 and date_format(create_time, '%Y-%m-%d') = sDate
|
||
group by
|
||
agent_id
|
||
) cc -- 机器人赢的
|
||
on
|
||
a.agent_id = cc.agent_id
|
||
left join
|
||
(
|
||
select
|
||
a.agent_id,
|
||
a.channel_id,
|
||
sum(case a.production_type when 1 then a.amount else 0 end) * -1 card_system_consume,
|
||
sum(case a.production_type when 2 then a.amount else 0 end) * -1 gold_system_consume
|
||
from
|
||
ct_production_info a
|
||
#inner join
|
||
# sales_user b
|
||
#on
|
||
# a.agent_id = b.saus_agentid and a.channel_id = b.saus_channelid and a.from_user = b.saus_salesid
|
||
where
|
||
a.amount < 0 and
|
||
#ifnull(b.statistic_type, 0) = 1 and
|
||
date_format(a.create_time, '%Y-%m-%d') = sDate
|
||
group by
|
||
a.agent_id, a.channel_id
|
||
) cd -- 系统扣罚的
|
||
on
|
||
a.agent_id = cd.agent_id and a.channel_id = cd.channel_id
|
||
left join
|
||
(
|
||
select
|
||
a.agent_id,
|
||
a.channel_id,
|
||
sum(case a.production_type when 1 then a.amount else 0 end) * -1 card_manager_consume,
|
||
sum(case a.production_type when 2 then a.amount else 0 end) * -1 gold_manager_consume
|
||
from
|
||
ct_manager_production_info a
|
||
inner join
|
||
sales_user b
|
||
on
|
||
a.agent_id = b.saus_agentid and a.channel_id = b.saus_channelid and a.from_user = b.saus_salesid
|
||
where
|
||
a.oper_type = 2 and ifnull(b.statistic_type, 0) = 1 and date_format(a.create_time, '%Y-%m-%d') = sDate
|
||
group by
|
||
a.agent_id, a.channel_id
|
||
) ce -- 总代扣罚的
|
||
on
|
||
a.agent_id = ce.agent_id and a.channel_id = ce.channel_id
|
||
-- 以上是消耗数据
|
||
where
|
||
a.is_open != 0;
|
||
end
|
||
;;
|
||
delimiter ;
|
||
|
||
SET FOREIGN_KEY_CHECKS = 1;
|