# Generated by Django 4.2.27 on 2026-06-18 03:51

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='AbnormalUserLog',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('account_id', models.CharField(db_index=True, max_length=20, verbose_name='账号ID（phone）')),
                ('ip_address', models.GenericIPAddressField(blank=True, null=True, verbose_name='IP地址')),
                ('real_ip', models.GenericIPAddressField(blank=True, null=True, verbose_name='真实IP（穿透代理后）')),
                ('x_forwarded_for', models.CharField(blank=True, default='', max_length=255, verbose_name='X-Forwarded-For')),
                ('user_agent', models.CharField(blank=True, default='', max_length=500, verbose_name='User-Agent')),
                ('request_method', models.CharField(blank=True, default='', max_length=10, verbose_name='请求方法')),
                ('request_path', models.CharField(blank=True, default='', max_length=500, verbose_name='请求路径')),
                ('request_params', models.TextField(blank=True, default='', verbose_name='请求参数（GET/POST）')),
                ('request_body', models.TextField(blank=True, default='', verbose_name='请求体（原始）')),
                ('request_headers', models.TextField(blank=True, default='', verbose_name='请求头（JSON格式）')),
                ('attempt_type', models.CharField(blank=True, default='', max_length=50, verbose_name='攻击类型')),
                ('detail', models.TextField(blank=True, default='', verbose_name='详细描述')),
                ('CreateTime', models.DateTimeField(auto_now_add=True, verbose_name='创建时间')),
            ],
            options={
                'verbose_name': '异常用户日志',
                'verbose_name_plural': '异常用户日志',
                'db_table': 'abnormal_user_log',
            },
        ),
        migrations.CreateModel(
            name='LeaderDailyStats',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('LeaderID', models.CharField(db_column='yonghuid', db_index=True, max_length=7, verbose_name='组长用户ID')),
                ('Date', models.DateField(db_column='riqi', db_index=True, verbose_name='日期')),
                ('InvitedManagerCount', models.IntegerField(db_column='yaoqing_guanshi_shu', default=0, verbose_name='邀请管事总数')),
                ('TotalIncome', models.DecimalField(db_column='shouru_zonge', decimal_places=2, default=0.0, max_digits=12, verbose_name='收入总额（分佣）')),
                ('CommissionAmount', models.DecimalField(db_column='fenyong_jine', decimal_places=2, default=0.0, max_digits=12, verbose_name='分佣金额')),
            ],
            options={
                'verbose_name': '组长每日统计',
                'db_table': 'zuzhang_ri_tongji',
            },
        ),
        migrations.CreateModel(
            name='ManagerDailyStats',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('ManagerID', models.CharField(db_column='yonghuid', db_index=True, max_length=7, verbose_name='管事用户ID')),
                ('Date', models.DateField(db_column='riqi', db_index=True, verbose_name='日期')),
                ('InvitedPlayerCount', models.IntegerField(db_column='yaoqing_dashou_shu', default=0, verbose_name='邀请打手总数')),
                ('RechargedPlayerCount', models.IntegerField(db_column='chongzhi_dashou_shu', default=0, verbose_name='充值打手数量')),
                ('TotalIncome', models.DecimalField(db_column='shouru_zonge', decimal_places=2, default=0.0, max_digits=12, verbose_name='收入总额')),
            ],
            options={
                'verbose_name': '管事每日统计',
                'db_table': 'guanshi_ri_tongji',
            },
        ),
        migrations.CreateModel(
            name='ManagerRenewalDailyStats',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('ManagerID', models.CharField(db_column='yonghuid', db_index=True, max_length=7, verbose_name='管事用户ID')),
                ('Date', models.DateField(db_column='riqi', db_index=True, verbose_name='日期')),
                ('RenewalTotal', models.IntegerField(db_column='xufei_zongshu', default=0, verbose_name='今日续费总数')),
                ('RenewalRevenue', models.DecimalField(db_column='xufei_shouyi', decimal_places=2, default=0.0, max_digits=12, verbose_name='续费收益金额')),
            ],
            options={
                'verbose_name': '管事续费每日统计',
                'db_table': 'guanshi_xufei_ri_tongji',
            },
        ),
        migrations.CreateModel(
            name='MerchantDailyStats',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('MerchantID', models.CharField(db_column='yonghuid', db_index=True, max_length=7, verbose_name='商家用户ID')),
                ('Date', models.DateField(db_column='riqi', db_index=True, verbose_name='日期')),
                ('AssignedOrderCount', models.IntegerField(db_column='paifa_dingdan_shu', default=0, verbose_name='派发订单总数')),
                ('AssignedAmount', models.DecimalField(db_column='paifa_jine', decimal_places=2, default=0.0, max_digits=12, verbose_name='派发订单总金额')),
                ('SettledOrderCount', models.IntegerField(db_column='jiesuan_dingdan_shu', default=0, verbose_name='结算订单总数')),
                ('SettledAmount', models.DecimalField(db_column='jiesuan_jine', decimal_places=2, default=0.0, max_digits=12, verbose_name='结算总金额')),
                ('RefundOrderCount', models.IntegerField(db_column='tuikuan_dingdan_shu', default=0, verbose_name='退款订单总数')),
                ('RefundAmount', models.DecimalField(db_column='tuikuan_jine', decimal_places=2, default=0.0, max_digits=12, verbose_name='退款总金额')),
            ],
            options={
                'verbose_name': '商家每日统计',
                'db_table': 'shangjia_ri_tongji',
            },
        ),
        migrations.CreateModel(
            name='Permission',
            fields=[
                ('perm_id', models.AutoField(primary_key=True, serialize=False, verbose_name='权限ID')),
                ('perm_code', models.CharField(db_index=True, max_length=100, unique=True, verbose_name='权限编码')),
                ('perm_name', models.CharField(max_length=100, verbose_name='权限名称')),
                ('description', models.CharField(blank=True, default='', max_length=200, verbose_name='权限描述')),
                ('CreateTime', models.DateTimeField(auto_now_add=True, verbose_name='创建时间')),
                ('UpdateTime', models.DateTimeField(auto_now=True, verbose_name='更新时间')),
            ],
            options={
                'verbose_name': '权限',
                'verbose_name_plural': '权限',
                'db_table': 'permission',
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='PlayerDailyStats',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('PlayerID', models.CharField(db_column='yonghuid', db_index=True, max_length=7, verbose_name='打手用户ID')),
                ('Date', models.DateField(db_column='riqi', db_index=True, verbose_name='日期')),
                ('AcceptedOrderTotal', models.IntegerField(db_column='jiedan_zongliang', default=0, verbose_name='接单总量')),
                ('CompletedOrderTotal', models.IntegerField(db_column='chengjiao_zongliang', default=0, verbose_name='成交单总量')),
                ('AcceptedAmount', models.DecimalField(db_column='jiedan_zonge', decimal_places=2, default=0.0, max_digits=12, verbose_name='接单总金额')),
                ('CompletedAmount', models.DecimalField(db_column='chengjiao_zonge', decimal_places=2, default=0.0, max_digits=12, verbose_name='成交总金额')),
                ('RefundCount', models.IntegerField(db_column='tuikuan_liang', default=0, verbose_name='退款订单量')),
                ('RefundAmount', models.DecimalField(db_column='tuikuan_jine', decimal_places=2, default=0.0, max_digits=12, verbose_name='退款总金额')),
            ],
            options={
                'verbose_name': '打手每日统计',
                'db_table': 'dashou_ri_tongji',
            },
        ),
        migrations.CreateModel(
            name='Role',
            fields=[
                ('role_id', models.AutoField(primary_key=True, serialize=False, verbose_name='角色ID')),
                ('role_code', models.CharField(db_index=True, max_length=50, unique=True, verbose_name='角色编码')),
                ('role_name', models.CharField(max_length=50, verbose_name='角色名称')),
                ('description', models.CharField(blank=True, default='', max_length=200, verbose_name='角色描述')),
                ('CreateTime', models.DateTimeField(auto_now_add=True, verbose_name='创建时间')),
                ('UpdateTime', models.DateTimeField(auto_now=True, verbose_name='更新时间')),
            ],
            options={
                'verbose_name': '角色',
                'verbose_name_plural': '角色',
                'db_table': 'role',
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='WithdrawalDailyStats',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('Date', models.DateField(db_column='riqi', db_index=True, verbose_name='日期')),
                ('WithdrawalType', models.IntegerField(choices=[(1, '打手'), (2, '管事'), (3, '组长'), (4, '考核官'), (5, '打手押金'), (6, '商家余额')], db_column='leixing', verbose_name='用户类型')),
                ('total_amount', models.DecimalField(decimal_places=2, default=0.0, max_digits=12, verbose_name='当天提现总额(元)')),
            ],
            options={
                'verbose_name': '每日提现统计',
                'db_table': 'tixian_ri_tongji',
                'indexes': [models.Index(fields=['Date', 'WithdrawalType'], name='tixian_ri_t_riqi_c18bb2_idx')],
                'unique_together': {('Date', 'WithdrawalType')},
            },
        ),
        migrations.CreateModel(
            name='UserRole',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False)),
                ('account_id', models.CharField(db_index=True, max_length=11, verbose_name='账号ID')),
                ('CreateTime', models.DateTimeField(auto_now_add=True, verbose_name='创建时间')),
                ('UpdateTime', models.DateTimeField(auto_now=True, verbose_name='更新时间')),
                ('role', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='backend.role', verbose_name='角色')),
            ],
            options={
                'verbose_name': '用户角色关联',
                'verbose_name_plural': '用户角色关联',
                'db_table': 'user_role',
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='RolePermission',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False)),
                ('CreateTime', models.DateTimeField(auto_now_add=True, verbose_name='创建时间')),
                ('permission', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='backend.permission', verbose_name='权限')),
                ('role', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='backend.role', verbose_name='角色')),
            ],
            options={
                'verbose_name': '角色权限关联',
                'verbose_name_plural': '角色权限关联',
                'db_table': 'role_permission',
                'managed': True,
            },
        ),
        migrations.AddIndex(
            model_name='role',
            index=models.Index(fields=['role_code'], name='role_role_co_b9f497_idx'),
        ),
        migrations.AddIndex(
            model_name='playerdailystats',
            index=models.Index(fields=['Date', '-AcceptedOrderTotal'], name='dashou_ri_t_riqi_95a785_idx'),
        ),
        migrations.AddIndex(
            model_name='playerdailystats',
            index=models.Index(fields=['Date', '-CompletedOrderTotal'], name='dashou_ri_t_riqi_ad9c1a_idx'),
        ),
        migrations.AddIndex(
            model_name='playerdailystats',
            index=models.Index(fields=['Date', '-AcceptedAmount'], name='dashou_ri_t_riqi_5da703_idx'),
        ),
        migrations.AddIndex(
            model_name='playerdailystats',
            index=models.Index(fields=['Date', '-CompletedAmount'], name='dashou_ri_t_riqi_0a3156_idx'),
        ),
        migrations.AlterUniqueTogether(
            name='playerdailystats',
            unique_together={('PlayerID', 'Date')},
        ),
        migrations.AddIndex(
            model_name='permission',
            index=models.Index(fields=['perm_code'], name='permission_perm_co_56cbe3_idx'),
        ),
        migrations.AddIndex(
            model_name='merchantdailystats',
            index=models.Index(fields=['Date', '-AssignedAmount'], name='shangjia_ri_riqi_d00f7f_idx'),
        ),
        migrations.AddIndex(
            model_name='merchantdailystats',
            index=models.Index(fields=['Date', '-SettledAmount'], name='shangjia_ri_riqi_25772a_idx'),
        ),
        migrations.AddIndex(
            model_name='merchantdailystats',
            index=models.Index(fields=['Date', '-AssignedOrderCount'], name='shangjia_ri_riqi_e05c54_idx'),
        ),
        migrations.AlterUniqueTogether(
            name='merchantdailystats',
            unique_together={('MerchantID', 'Date')},
        ),
        migrations.AddIndex(
            model_name='managerrenewaldailystats',
            index=models.Index(fields=['Date', '-RenewalTotal'], name='guanshi_xuf_riqi_7c128f_idx'),
        ),
        migrations.AddIndex(
            model_name='managerrenewaldailystats',
            index=models.Index(fields=['Date', '-RenewalRevenue'], name='guanshi_xuf_riqi_8f09b5_idx'),
        ),
        migrations.AlterUniqueTogether(
            name='managerrenewaldailystats',
            unique_together={('ManagerID', 'Date')},
        ),
        migrations.AddIndex(
            model_name='managerdailystats',
            index=models.Index(fields=['Date', '-InvitedPlayerCount'], name='guanshi_ri__riqi_075e1a_idx'),
        ),
        migrations.AddIndex(
            model_name='managerdailystats',
            index=models.Index(fields=['Date', '-RechargedPlayerCount'], name='guanshi_ri__riqi_78a79d_idx'),
        ),
        migrations.AddIndex(
            model_name='managerdailystats',
            index=models.Index(fields=['Date', '-TotalIncome'], name='guanshi_ri__riqi_334f52_idx'),
        ),
        migrations.AlterUniqueTogether(
            name='managerdailystats',
            unique_together={('ManagerID', 'Date')},
        ),
        migrations.AddIndex(
            model_name='leaderdailystats',
            index=models.Index(fields=['Date', '-InvitedManagerCount'], name='zuzhang_ri__riqi_87169e_idx'),
        ),
        migrations.AddIndex(
            model_name='leaderdailystats',
            index=models.Index(fields=['Date', '-TotalIncome'], name='zuzhang_ri__riqi_1d7e51_idx'),
        ),
        migrations.AlterUniqueTogether(
            name='leaderdailystats',
            unique_together={('LeaderID', 'Date')},
        ),
        migrations.AddIndex(
            model_name='abnormaluserlog',
            index=models.Index(fields=['account_id'], name='abnormal_us_account_425899_idx'),
        ),
        migrations.AddIndex(
            model_name='abnormaluserlog',
            index=models.Index(fields=['ip_address'], name='abnormal_us_ip_addr_3d612b_idx'),
        ),
        migrations.AddIndex(
            model_name='abnormaluserlog',
            index=models.Index(fields=['CreateTime'], name='abnormal_us_create__ee16da_idx'),
        ),
        migrations.AlterUniqueTogether(
            name='userrole',
            unique_together={('account_id', 'role')},
        ),
        migrations.AlterUniqueTogether(
            name='rolepermission',
            unique_together={('role', 'permission')},
        ),
    ]
