# Generated by Django 4.2.17 on 2025-08-23 17:41

from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import xj_user.utils.j_ulid_field


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='BaseInfo',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False, verbose_name='ID')),
                ('uuid', xj_user.utils.j_ulid_field.JULIDField(blank=True, db_index=True, default='1k3b4v3jv09y', max_length=32, null=True, unique=True, verbose_name='UUID')),
                ('user_no', models.CharField(blank=True, db_index=True, max_length=32, null=True, unique=True, verbose_name='用户编号')),
                ('username', models.CharField(blank=True, db_index=True, help_text='登录的用户名', max_length=32, null=True, unique=True, verbose_name='用户名')),
                ('nickname', models.CharField(blank=True, max_length=128, null=True, verbose_name='昵称')),
                ('fullname', models.CharField(blank=True, db_index=True, help_text='用户的姓名（未实名验证）', max_length=128, null=True, verbose_name='姓名')),
                ('phone', models.CharField(blank=True, db_index=True, help_text='登录绑定手机号', max_length=16, null=True, verbose_name='手机')),
                ('email', models.EmailField(blank=True, db_index=True, help_text='登录绑定邮箱', max_length=254, null=True, verbose_name='邮箱')),
                ('avatar', models.CharField(blank=True, max_length=255, null=True, verbose_name='个人头像')),
                ('user_type', models.CharField(blank=True, choices=[('PERSON', '个人用户'), ('COMPANY', '企业用户'), ('COMPANYADMIN', '企业管理员'), ('ADMIN', '管理员用户')], db_index=True, default='PERSON', help_text='PERSON 个人用户, COMPANY 企业用户, ADMIN 管理员用户', max_length=32, null=True, verbose_name='用户类型')),
                ('user_vip', models.IntegerField(blank=True, choices=[(1, '普通用户'), (2, '高级会员'), (3, '超级会员'), (4, '年费会员')], db_index=True, default=1, help_text='用户会员权限', verbose_name='用户会员')),
                ('user_level', models.IntegerField(blank=True, db_index=True, default=1, verbose_name='用户等级')),
                ('user_info', models.JSONField(blank=True, help_text='用户扩展信息', null=True, verbose_name='用户信息')),
                ('register_time', models.DateTimeField(blank=True, default=django.utils.timezone.now, null=True, verbose_name='注册时间')),
                ('register_ip', models.GenericIPAddressField(blank=True, null=True, verbose_name='注册IP')),
                ('privacies', models.JSONField(blank=True, help_text='用户隐私设置', null=True, verbose_name='用户隐私设置')),
                ('is_auth', models.BooleanField(blank=True, default=False, null=True, verbose_name='是否实名认证')),
                ('is_delete', models.BooleanField(blank=True, default=False, null=True, verbose_name='是否删除')),
                ('is_using', models.BooleanField(blank=True, default=True, null=True, verbose_name='是否使用')),
            ],
            options={
                'verbose_name_plural': '01. 用户 - 基础信息',
                'db_table': 'user_base_info',
            },
        ),
        migrations.CreateModel(
            name='ExtendField',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('field_index', models.CharField(blank=True, choices=[('field_1', '自定义字段1'), ('field_2', '自定义字段2'), ('field_3', '自定义字段3'), ('field_4', '自定义字段4'), ('field_5', '自定义字段5'), ('field_6', '自定义字段6'), ('field_7', '自定义字段7'), ('field_8', '自定义字段8'), ('field_9', '自定义字段9'), ('field_10', '自定义字段10'), ('field_11', '自定义字段11'), ('field_12', '自定义字段12'), ('field_13', '自定义字段13'), ('field_14', '自定义字段14'), ('field_15', '自定义字段15')], help_text='映射到扩展数据表的字段名，如：field_x', max_length=8, null=True, unique=True, verbose_name='映射索引名')),
                ('field', models.CharField(blank=True, help_text='当已有字段不能满足的时候的扩展字段', max_length=32, null=True, unique=True, verbose_name='自定义字段')),
                ('label', models.CharField(blank=True, help_text='自定义字段的标签，用于前端显示', max_length=32, null=True, unique=True, verbose_name='标签')),
                ('type', models.CharField(blank=True, choices=[('bool', '布尔型-bool'), ('int', '整型-int'), ('float', '浮点型-float'), ('number', '数字类型-number'), ('string', '字符串型-string'), ('text', '长文本型-text'), ('plain', '普通文字-plain'), ('input', '输入框-plain'), ('password', '密码框-password'), ('textarea', '多行文本框-textarea'), ('editor', '富文本编辑器-editor'), ('switch', '开关切换-switch'), ('select', '选择框-select'), ('radio', '单选框-radio'), ('checkbox', '多选框-checkbox'), ('cascader', '级联选择器-cascader'), ('color', '色彩选择器-color'), ('slot', '插槽-slot'), ('image', '图片-image'), ('audio', '音频-audio'), ('video', '视频-video'), ('file', '文件-file'), ('upload', '上传类型-upload'), ('time', ' 时间-time'), ('datetime', '日期时间-datetime'), ('date', '日期-date'), ('month', '月份-month'), ('year', '年-year')], help_text='自定义字段的数据类型，必须和前端相匹配', max_length=32, null=True, verbose_name='类型')),
                ('unit', models.CharField(blank=True, help_text='自定义字段的显示单位，空值表示不需要配置单位', max_length=32, null=True, verbose_name='单位')),
                ('default', models.CharField(blank=True, help_text='自定义字段的默认值，当前端用户不配置字段值时，使用该默认值', max_length=255, null=True, verbose_name='默认值')),
                ('config', models.JSONField(blank=True, help_text='用于前端自由配置一些属性，如选择列表', null=True, verbose_name='配置')),
                ('sort', models.IntegerField(blank=True, null=True, verbose_name='排序')),
                ('description', models.CharField(blank=True, max_length=255, null=True, verbose_name='字段描述')),
            ],
            options={
                'verbose_name_plural': '04. 用户 - 扩展字段',
                'db_table': 'user_extend_field',
            },
        ),
        migrations.CreateModel(
            name='Platform',
            fields=[
                ('id', models.IntegerField(help_text='必填。自动生成。', primary_key=True, serialize=False, verbose_name='ID')),
                ('platform_id', models.IntegerField(help_text='必填。不自动生成，由运营人员统一设置。', unique=True, verbose_name='平台ID')),
                ('platform_code', models.CharField(help_text='必填。平台唯一识别码', max_length=16, unique=True, verbose_name='平台代码')),
                ('platform_name', models.CharField(help_text='必填。平台名称可以是中文、英文、俄文等。', max_length=32, verbose_name='平台名称')),
                ('root_category_value', models.CharField(help_text='唯一值，信息模块根类别值', max_length=32, verbose_name='根类别值')),
            ],
            options={
                'verbose_name_plural': '07. 用户 - 平台表',
                'db_table': 'user_platform',
            },
        ),
        migrations.CreateModel(
            name='UserSsoServe',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('sso_code', models.CharField(blank=True, max_length=255, null=True, verbose_name='单点登录代码')),
                ('sso_name', models.CharField(blank=True, max_length=255, null=True, verbose_name='单点登录名')),
                ('sso_url', models.CharField(blank=True, max_length=255, null=True, verbose_name='单点登录地址')),
                ('sso_appid', models.CharField(blank=True, max_length=255, null=True, verbose_name='AppID')),
                ('description', models.CharField(blank=True, max_length=255, null=True, verbose_name='描述')),
                ('sso_account', models.ForeignKey(db_column='sso_account_id', db_constraint=False, on_delete=django.db.models.deletion.DO_NOTHING, to='xj_user.baseinfo', verbose_name='单点登录绑定账户')),
            ],
            options={
                'verbose_name_plural': '11. 用户 - 单点登录服务表',
                'db_table': 'user_sso_serve',
            },
        ),
        migrations.CreateModel(
            name='UserSsoToUser',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('sso_unicode', models.CharField(blank=True, help_text='？？？', max_length=255, null=True, verbose_name='单点登录地址')),
                ('sso_ticket', models.CharField(blank=True, max_length=255, null=True, verbose_name='单点登录票据')),
                ('union_code', models.CharField(blank=True, max_length=255, null=True, verbose_name='微信唯一ID')),
                ('create_time', models.DateTimeField(auto_now_add=True, verbose_name='创建时间')),
                ('is_delete', models.BooleanField(default=False, verbose_name='是否删除')),
                ('sso_serve', models.ForeignKey(db_constraint=False, on_delete=django.db.models.deletion.DO_NOTHING, to='xj_user.userssoserve', verbose_name='单点登录服务ID')),
                ('user', models.ForeignKey(db_constraint=False, on_delete=django.db.models.deletion.DO_NOTHING, to='xj_user.baseinfo', verbose_name='用户')),
            ],
            options={
                'verbose_name_plural': '12. 用户 - 多对多单点登录记录表',
                'db_table': 'user_sso_to_user',
            },
        ),
        migrations.CreateModel(
            name='UserBankCards',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False, verbose_name='ID')),
                ('bank_card_num', models.CharField(blank=True, max_length=32, null=True, verbose_name='银行卡号')),
                ('open_account_bank', models.CharField(blank=True, max_length=32, null=True, verbose_name='开户银行')),
                ('opening_branch', models.CharField(blank=True, max_length=128, null=True, verbose_name='开户支行')),
                ('is_default', models.BooleanField(blank=True, null=True, verbose_name='是否默认卡')),
                ('ext', models.JSONField(blank=True, null=True, verbose_name='扩展数据')),
                ('sort', models.IntegerField(blank=True, null=True, verbose_name='排序')),
                ('remark', models.CharField(blank=True, max_length=128, null=True, verbose_name='备注')),
                ('user', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='xj_user.baseinfo', verbose_name='开户人')),
            ],
            options={
                'verbose_name_plural': '15. 用户 - 用户银行卡信息',
                'db_table': 'user_bank_cards',
            },
        ),
        migrations.CreateModel(
            name='PlatformsToUsers',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('platform_user_id', models.BigIntegerField(blank=True, db_index=True, null=True, verbose_name='平台用户ID')),
                ('platform', models.ForeignKey(db_constraint=False, on_delete=django.db.models.deletion.DO_NOTHING, to='xj_user.platform', to_field='platform_id', verbose_name='平台')),
                ('user', models.ForeignKey(db_column='user_id', on_delete=django.db.models.deletion.DO_NOTHING, to='xj_user.baseinfo', verbose_name='用户')),
            ],
            options={
                'verbose_name_plural': '09. 用户 - 多对多平台记录表',
                'db_table': 'user_platforms_to_users',
                'unique_together': {('user', 'platform')},
            },
        ),
        migrations.CreateModel(
            name='DetailInfo',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('real_name', models.CharField(blank=True, db_index=True, help_text='实名认证后的真名', max_length=50, null=True, verbose_name='实名姓名')),
                ('sex', models.CharField(blank=True, choices=[('0', '未知'), ('1', '男'), ('2', '女')], help_text='0未知 1男 2女', max_length=1, null=True, verbose_name='性别')),
                ('birth', models.DateField(blank=True, null=True, verbose_name='生日')),
                ('tags', models.CharField(blank=True, help_text='多个标签以英文;号为分隔符', max_length=255, null=True, verbose_name='个人标签')),
                ('signature', models.CharField(blank=True, max_length=255, null=True, verbose_name='个性签名')),
                ('avatar', models.CharField(blank=True, max_length=2000, null=True, verbose_name='个人头像')),
                ('cover', models.CharField(blank=True, max_length=2000, null=True, verbose_name='个人主页封面')),
                ('id_card_type', models.CharField(blank=True, choices=[('IDENTITY', '身份证'), ('PASSPORT', '护照'), ('DRIVING', '驾驶证'), ('BUSINESS', '营业执照')], help_text='用于实名认证姓名时的证件类型', max_length=32, null=True, verbose_name='证件类型')),
                ('id_card_no', models.CharField(blank=True, max_length=32, null=True, verbose_name='证件号码')),
                ('language', models.CharField(blank=True, choices=[('cn', '简体中文'), ('en', 'English'), ('ru', 'Русский'), ('tc', '繁体中文'), ('fr', 'Français'), ('de', 'Deutsch'), ('jp', '日本語')], max_length=2, null=True, verbose_name='我使用的语言')),
                ('region_code', models.BigIntegerField(blank=True, null=True, verbose_name='所在地行政区划编码')),
                ('more', models.JSONField(blank=True, help_text='更多信息用来存放用户可能填写的扩展内容，由于很多信息不是必填或必须存在的，因此不单独建字段。', null=True, verbose_name='更多信息')),
                ('field_1', models.CharField(blank=True, max_length=255, null=True, verbose_name='字段1')),
                ('field_2', models.CharField(blank=True, max_length=255, null=True, verbose_name='字段2')),
                ('field_3', models.CharField(blank=True, max_length=255, null=True, verbose_name='字段3')),
                ('field_4', models.CharField(blank=True, max_length=255, null=True, verbose_name='字段4')),
                ('field_5', models.CharField(blank=True, max_length=255, null=True, verbose_name='字段5')),
                ('field_6', models.CharField(blank=True, max_length=255, null=True, verbose_name='字段6')),
                ('field_7', models.CharField(blank=True, max_length=255, null=True, verbose_name='字段7')),
                ('field_8', models.CharField(blank=True, max_length=255, null=True, verbose_name='字段8')),
                ('field_9', models.CharField(blank=True, max_length=255, null=True, verbose_name='字段9')),
                ('field_10', models.CharField(blank=True, max_length=255, null=True, verbose_name='字段10')),
                ('field_11', models.TextField(blank=True, null=True, verbose_name='字段11')),
                ('field_12', models.TextField(blank=True, null=True, verbose_name='字段12')),
                ('field_13', models.TextField(blank=True, null=True, verbose_name='字段13')),
                ('field_14', models.TextField(blank=True, null=True, verbose_name='字段14')),
                ('field_15', models.TextField(blank=True, null=True, verbose_name='字段15')),
                ('user', models.OneToOneField(db_column='user_id', db_constraint=False, help_text='登录用的用户名', on_delete=django.db.models.deletion.DO_NOTHING, related_name='user_detail_info', to='xj_user.baseinfo', verbose_name='用户')),
            ],
            options={
                'verbose_name_plural': '02. 用户 - 详细信息',
                'db_table': 'user_detail_info',
            },
        ),
        migrations.AddField(
            model_name='baseinfo',
            name='platforms_to_users',
            field=models.ManyToManyField(through='xj_user.PlatformsToUsers', to='xj_user.platform'),
        ),
        migrations.CreateModel(
            name='Auth',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('password', models.CharField(blank=True, help_text='登录的密码', max_length=255, null=True, verbose_name='密码')),
                ('plaintext', models.CharField(blank=True, max_length=255, null=True, verbose_name='PT')),
                ('salt', models.CharField(blank=True, help_text='加密盐由六位数字和字母组成，区分大小写', max_length=32, null=True, verbose_name='盐')),
                ('algorithm', models.CharField(blank=True, choices=[('DEFAULT', 'Default'), ('DISCUZ', 'Discuz (md5(md5(pwd).salt))'), ('SPSS', 'Spss (sha1(rsa(cip).salt))')], help_text='系统同时支持多种加密算法，旧版为MD5，新版为SHA1', max_length=16, null=True, verbose_name='加密算法')),
                ('token', models.CharField(blank=True, help_text='用户令牌，用于验证用户有效期', max_length=255, null=True, verbose_name='临时令牌')),
                ('ticket', models.CharField(blank=True, help_text='用户提供第三方单点登录的票据', max_length=255, null=True, verbose_name='临时票据')),
                ('last_update_ip', models.GenericIPAddressField(blank=True, null=True, verbose_name='最后登录网络地址')),
                ('create_time', models.DateTimeField(auto_now_add=True, verbose_name='创建时间')),
                ('update_time', models.DateTimeField(auto_now=True, null=True, verbose_name='最后登录时间')),
                ('platform', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='xj_user.platform', verbose_name='平台')),
                ('user', models.ForeignKey(db_constraint=False, on_delete=django.db.models.deletion.DO_NOTHING, to='xj_user.baseinfo', verbose_name='用户')),
            ],
            options={
                'verbose_name_plural': '03. 用户 - 安全认证',
                'db_table': 'user_auth',
            },
        ),
    ]
