158 lines
7.3 KiB
Python
158 lines
7.3 KiB
Python
"""集团多俱乐部数据模型(新建表,不修改 gvsdsdk)。"""
|
||
import uuid
|
||
from decimal import Decimal
|
||
|
||
from django.db import models
|
||
from gvsdsdk.model_base import QModel
|
||
|
||
|
||
class Club(QModel):
|
||
"""子公司 / 俱乐部主表。"""
|
||
club_id = models.CharField(max_length=16, primary_key=True, verbose_name='俱乐部ID')
|
||
name = models.CharField(max_length=64, verbose_name='展示名')
|
||
status = models.IntegerField(default=1, verbose_name='1启用0停用')
|
||
wx_appid = models.CharField(max_length=32, blank=True, default='')
|
||
wx_secret = models.CharField(max_length=128, blank=True, default='')
|
||
mch_id = models.CharField(max_length=32, blank=True, default='')
|
||
pay_app_id = models.CharField(max_length=32, blank=True, default='')
|
||
api_v3_key = models.CharField(max_length=128, blank=True, default='')
|
||
cert_serial_no = models.CharField(max_length=64, blank=True, default='')
|
||
private_key_path = models.CharField(max_length=255, blank=True, default='')
|
||
platform_cert_dir = models.CharField(max_length=255, blank=True, default='')
|
||
official_appid = models.CharField(max_length=32, blank=True, default='')
|
||
official_secret = models.CharField(max_length=128, blank=True, default='')
|
||
official_token = models.CharField(max_length=64, blank=True, default='')
|
||
encoding_aes_key = models.CharField(max_length=64, blank=True, default='')
|
||
template_id = models.CharField(max_length=64, blank=True, default='')
|
||
template_max_per_minute = models.IntegerField(default=950)
|
||
h5_domain = models.CharField(max_length=128, blank=True, default='')
|
||
oss_prefix = models.CharField(max_length=128, blank=True, default='')
|
||
goeasy_appkey = models.CharField(max_length=64, blank=True, default='')
|
||
goeasy_secret = models.CharField(max_length=128, blank=True, default='')
|
||
config_json = models.JSONField(default=dict, blank=True)
|
||
company_uuid = models.BinaryField(max_length=16, null=True, blank=True)
|
||
sort_order = models.IntegerField(default=0)
|
||
CreateTime = models.DateTimeField(auto_now_add=True)
|
||
UpdateTime = models.DateTimeField(auto_now=True)
|
||
|
||
class Meta:
|
||
db_table = 'club'
|
||
verbose_name = '俱乐部'
|
||
|
||
|
||
class UserWxOpenid(QModel):
|
||
"""微信 openid 与俱乐部用户绑定(club_id + openid 唯一)。"""
|
||
club_id = models.CharField(max_length=16, db_index=True)
|
||
openid = models.CharField(max_length=64, db_index=True)
|
||
yonghuid = models.CharField(max_length=7, db_index=True, verbose_name='用户ID')
|
||
unionid = models.CharField(max_length=64, null=True, blank=True)
|
||
CreateTime = models.DateTimeField(auto_now_add=True)
|
||
|
||
class Meta:
|
||
db_table = 'user_wx_openid'
|
||
unique_together = [['club_id', 'openid']]
|
||
|
||
|
||
class AdminAssignment(QModel):
|
||
"""管理任职:集团或子公司后台权限范围。"""
|
||
yonghuid = models.CharField(max_length=7, db_index=True)
|
||
club_id = models.CharField(max_length=16, null=True, blank=True, db_index=True,
|
||
verbose_name='NULL=集团任职')
|
||
role_code = models.CharField(max_length=50, default='CLUB_ADMIN')
|
||
data_scope = models.CharField(max_length=20, default='SINGLE_CLUB')
|
||
is_primary = models.BooleanField(default=False)
|
||
granted_by = models.CharField(max_length=7, blank=True, default='')
|
||
status = models.IntegerField(default=1, verbose_name='1有效0停用')
|
||
CreateTime = models.DateTimeField(auto_now_add=True)
|
||
UpdateTime = models.DateTimeField(auto_now=True)
|
||
|
||
class Meta:
|
||
db_table = 'admin_assignment'
|
||
unique_together = [['yonghuid', 'club_id', 'role_code']]
|
||
|
||
|
||
class AdminAuditLog(QModel):
|
||
"""后台敏感操作审计(改余额等)。"""
|
||
club_id = models.CharField(max_length=16, null=True, blank=True, db_index=True)
|
||
operator_yonghuid = models.CharField(max_length=16, db_index=True)
|
||
operator_role_code = models.CharField(max_length=50, blank=True, default='')
|
||
target_yonghuid = models.CharField(max_length=7, null=True, blank=True)
|
||
action = models.CharField(max_length=64, db_index=True)
|
||
resource_type = models.CharField(max_length=32, blank=True, default='')
|
||
resource_id = models.CharField(max_length=64, blank=True, default='')
|
||
field_name = models.CharField(max_length=64, blank=True, default='')
|
||
value_before = models.TextField(null=True, blank=True)
|
||
value_after = models.TextField(null=True, blank=True)
|
||
request_ip = models.CharField(max_length=64, blank=True, default='')
|
||
remark = models.CharField(max_length=500, blank=True, default='')
|
||
CreateTime = models.DateTimeField(auto_now_add=True)
|
||
|
||
class Meta:
|
||
db_table = 'admin_audit_log'
|
||
indexes = [models.Index(fields=['club_id', '-CreateTime'])]
|
||
|
||
|
||
class ClubHuiyuanPrice(QModel):
|
||
"""各俱乐部会员售价/分成(全局 huiyuan_id 定义不变)。"""
|
||
club_id = models.CharField(max_length=16, db_index=True)
|
||
huiyuan_id = models.CharField(max_length=6, db_index=True)
|
||
jiage = models.DecimalField(max_digits=10, decimal_places=2, default=Decimal('0.00'))
|
||
guanshifc = models.DecimalField(max_digits=10, decimal_places=2, default=Decimal('0.00'))
|
||
zuzhangfc = models.DecimalField(max_digits=10, decimal_places=2, default=Decimal('0.00'))
|
||
is_enabled = models.BooleanField(default=True)
|
||
bankuai_id = models.IntegerField(null=True, blank=True)
|
||
CreateTime = models.DateTimeField(auto_now_add=True)
|
||
UpdateTime = models.DateTimeField(auto_now=True)
|
||
|
||
class Meta:
|
||
db_table = 'club_huiyuan_price'
|
||
unique_together = [['club_id', 'huiyuan_id']]
|
||
|
||
|
||
class ClubLilubiao(QModel):
|
||
"""各俱乐部分红/手续费配置(对应 lilubiao.fadanpingtai)。"""
|
||
club_id = models.CharField(max_length=16, db_index=True)
|
||
config_type = models.IntegerField(db_index=True, verbose_name='同 lilubiao.fadanpingtai')
|
||
lilv = models.DecimalField(max_digits=10, decimal_places=4, default=Decimal('0.0000'))
|
||
remark = models.CharField(max_length=255, blank=True, default='')
|
||
CreateTime = models.DateTimeField(auto_now_add=True)
|
||
UpdateTime = models.DateTimeField(auto_now=True)
|
||
|
||
class Meta:
|
||
db_table = 'club_lilubiao'
|
||
unique_together = [['club_id', 'config_type']]
|
||
|
||
|
||
class ClubWithdrawConfig(QModel):
|
||
club_id = models.CharField(max_length=16, primary_key=True)
|
||
mode = models.IntegerField(default=1, verbose_name='1自动2手动')
|
||
CreateTime = models.DateTimeField(auto_now_add=True)
|
||
UpdateTime = models.DateTimeField(auto_now=True)
|
||
|
||
class Meta:
|
||
db_table = 'club_withdraw_config'
|
||
|
||
|
||
class ClubTixianQuota(QModel):
|
||
club_id = models.CharField(max_length=16, db_index=True)
|
||
leixing = models.IntegerField(db_index=True)
|
||
daily_limit = models.DecimalField(max_digits=12, decimal_places=2, default=Decimal('0.00'))
|
||
CreateTime = models.DateTimeField(auto_now_add=True)
|
||
UpdateTime = models.DateTimeField(auto_now=True)
|
||
|
||
class Meta:
|
||
db_table = 'club_tixian_quota'
|
||
unique_together = [['club_id', 'leixing']]
|
||
|
||
|
||
class ClubFadanFenhongLilv(QModel):
|
||
club_id = models.CharField(max_length=16, db_index=True)
|
||
shenfen = models.IntegerField(db_index=True)
|
||
lilv = models.DecimalField(max_digits=10, decimal_places=4, default=Decimal('0.0000'))
|
||
CreateTime = models.DateTimeField(auto_now_add=True)
|
||
UpdateTime = models.DateTimeField(auto_now=True)
|
||
|
||
class Meta:
|
||
db_table = 'club_fadan_fenhong_lilv'
|
||
unique_together = [['club_id', 'shenfen']]
|