from django.db import models from django.conf import settings from django.utils import timezone from django.utils.translation import gettext_lazy as _ class FXCRMLeads(models.Model): SYNC_STATUS_PENDING = 'pending' SYNC_STATUS_SUCCESS = 'success' SYNC_STATUS_FAILED = 'failed' SYNC_STATUS_CHOICES = ( (SYNC_STATUS_PENDING, _('pending')), (SYNC_STATUS_SUCCESS, _('success')), (SYNC_STATUS_FAILED, _('failed')), ) LEADS_POLL_COMMUNITY = '5fae880a42afdc0001defb8b' LEADS_POLL_MARKTING = '5fc76790f3f0920001fe0baf' LEADS_POLL_COMMUNITY_TRANSFORM = '5fc5ffe9d3fa260001e9e33d' LEADS_POLL_CEG = '6296d784e4cdcb0001f947f0' LEADS_POLL_CHOICES = ( (LEADS_POLL_COMMUNITY, '社区'), (LEADS_POLL_COMMUNITY_TRANSFORM, '社区转化'), (LEADS_POLL_MARKTING, '商业'), (LEADS_POLL_CEG, 'CEG'), ) leads_type = models.CharField( max_length=32, help_text='线索类型') leads_poll_id = models.CharField( max_length=32, help_text='线索池 ID', choices=LEADS_POLL_CHOICES, default=LEADS_POLL_COMMUNITY) source_code = models.CharField( max_length=32, help_text='来源(代码) - 旧版') source_text = models.CharField( max_length=32, blank=True, null=True, help_text='来源(描述) - 旧版') primary_source_code = models.CharField( max_length=32, blank=True, null=True, help_text='一级来源(代码)') primary_source_text = models.CharField( max_length=32, blank=True, null=True, help_text='一级来源(描述)') secondary_source_code = models.CharField( max_length=32, blank=True, null=True, help_text='二级来源(代码)') secondary_source_text = models.CharField( max_length=32, blank=True, null=True, help_text='二级来源(描述)') leads_stage_code = models.CharField( max_length=32, blank=True, null=True, help_text='线索阶段(代码)') leads_stage_text = models.CharField( max_length=32, blank=True, null=True, help_text='线索阶段(描述)') user_id = models.CharField(max_length=64, blank=True, null=True, help_text='用户 ID') username = models.CharField(max_length=64, blank=True, null=True, help_text='用户名') phone = models.CharField(max_length=16, blank=True, null=True, help_text='电话') email = models.CharField(max_length=64, blank=True, null=True, help_text='邮箱') wechat_id = models.CharField(max_length=100, blank=True, null=True, help_text='微信') name = models.CharField(max_length=200, blank=True, null=True, help_text='姓名') address = models.CharField(max_length=400, blank=True, null=True, help_text='地址') company = models.CharField(max_length=100, blank=True, null=True, help_text='公司') industry_type_code = models.CharField( max_length=64, blank=True, null=True, help_text='行业类型(代码)') industry_type_text = models.CharField( max_length=64, blank=True, null=True, help_text='行业类型(描述)') member_range_code = models.CharField( max_length=64, blank=True, null=True, help_text='公司人数规模(代码)') member_range_text = models.CharField( max_length=64, blank=True, null=True, help_text='公司人数规模(描述)') job_title_code = models.CharField( max_length=64, blank=True, null=True, help_text='职位(代码)') job_title_text = models.CharField( max_length=64, blank=True, null=True, help_text='职位(描述)') consult_category_code = models.CharField( max_length=64, blank=True, null=True, help_text='咨询类别(代码)') consult_category_text = models.CharField( max_length=64, blank=True, null=True, help_text='咨询类别(描述)') customer_type_code = models.CharField( max_length=64, blank=True, null=True, help_text='客户类型(代码)') customer_type_text = models.CharField( max_length=64, blank=True, null=True, help_text='客户类型(描述)') cql_code = models.CharField( max_length=64, blank=True, null=True, help_text='CQL(代码)') cql_text = models.CharField( max_length=64, blank=True, null=True, help_text='CQL(描述)') utm_source = models.CharField(max_length=64, blank=True, null=True) utm_medium = models.CharField(max_length=64, blank=True, null=True) utm_campaign = models.CharField(max_length=64, blank=True, null=True) utm_term = models.CharField(max_length=64, blank=True, null=True) referer = models.TextField( max_length=2000, default='', blank=True, null=True, help_text='留资来源 URL') referer2 = models.TextField( max_length=2000, default='', blank=True, null=True, help_text='留资前一页面 URL') contact_us_url = models.TextField( max_length=2000, default='', blank=True, null=True, help_text='留资当前页面 URL') person_source = models.CharField( max_length=100, default='', blank=True, null=True, help_text='留资页面用户来源渠道') person_source_details = models.CharField( max_length=100, default='', blank=True, null=True, help_text='留资页面用户来源渠道说明') mark_mql_at_str = models.CharField( max_length=32, blank=True, null=True, help_text='标记 MQL 的时间') crm_remark = models.TextField( max_length=2000, blank=True, null=True, help_text='备注') related_user = models.ForeignKey( settings.AUTH_USER_MODEL, on_delete=models.DO_NOTHING, related_name='related_fxcrm_leads', blank=True, null=True) # FXiaoKe CRM useropenid: # - 周胜虎: FSUID_F34464EB17C5814C338902BD3D3FE78B # - Billmay: FSUID_EE7A00DA91B32217C313554BCDD45793 # - 王迪: FSUID_23E63B3AF2AB77F91DF9A723D681E198 # - 霍昊: FSUID_AE002F0279387D21D5E4944085BB9C4C crm_creator_openid = models.CharField( max_length=64, help_text='CRM 线索创建者 OpenID') sync_status = models.CharField( max_length=16, default=SYNC_STATUS_PENDING, choices=SYNC_STATUS_CHOICES) sync_at = models.DateTimeField(blank=True, null=True) request_body = models.TextField(blank=True, null=True) response_body = models.TextField(blank=True, null=True) crm_leads_object_id = models.CharField(max_length=64, blank=True, null=True) remark = models.TextField(blank=True, null=True) created_at = models.DateTimeField(default=timezone.now) creator = models.ForeignKey( settings.AUTH_USER_MODEL, on_delete=models.DO_NOTHING, related_name='created_fxcrm_leads', blank=True, null=True) class Meta: db_table = 'pingcap_crm_leads' class FXCRMJointSolutionMutualCertification(models.Model): SYNC_STATUS_PENDING = 'pending' SYNC_STATUS_SUCCESS = 'success' SYNC_STATUS_FAILED = 'failed' SYNC_STATUS_CHOICES = ( (SYNC_STATUS_PENDING, _('pending')), (SYNC_STATUS_SUCCESS, _('success')), (SYNC_STATUS_FAILED, _('failed')), ) company = models.CharField(max_length=100) company_address = models.CharField(max_length=100) company_area_code = models.CharField(max_length=100, blank=True, null=True, help_text='公司所在的区域(代码)') company_area_text = models.CharField(max_length=100, blank=True, null=True, help_text='公司所在的区域(描述)') application_type_code = models.CharField(max_length=100, blank=True, null=True, help_text='申请类型(代码)') application_type_text = models.CharField(max_length=100, blank=True, null=True, help_text='申请类型(描述)') contact_name = models.CharField(max_length=100, help_text='联系人') contact_job_title = models.CharField(max_length=100, help_text='联系人职位') contact_phone = models.CharField(max_length=100, help_text='联系人电话') contact_address = models.CharField(max_length=100, help_text='联系人地址') joint_solution_name = models.CharField(max_length=100, help_text='联合解决方案名称') joint_solution_description = models.TextField(max_length=800, help_text='联合解决方案描述') joint_solution_industry_code = models.CharField(max_length=100, blank=True, null=True, help_text='联合解决方案行业(代码)') joint_solution_industry_text = models.CharField(max_length=100, blank=True, null=True, help_text='联合解决方案行业(描述)') joint_solution_contact_name = models.CharField(max_length=100, help_text='联合解决方案联系人') joint_solution_contact_job_title = models.CharField(max_length=100, help_text='联合解决方案联系人职位') attachment_1 = models.ForeignKey( 'pingcap_sso.Upload', blank=True, null=True, on_delete=models.DO_NOTHING, related_name='fxcrm_joint_solution_mutual_certification_attachment_1' ) attachment_2 = models.ForeignKey( 'pingcap_sso.Upload', blank=True, null=True, on_delete=models.DO_NOTHING, related_name='fxcrm_joint_solution_mutual_certification_attachment_2' ) user = models.ForeignKey( settings.AUTH_USER_MODEL, on_delete=models.DO_NOTHING, related_name='created_fxcrm_joint_solution_mutual_certification', blank=True, null=True ) created_at = models.DateTimeField(default=timezone.now) crm_creator_openid = models.CharField( max_length=64, default='FSUID_8D4890ED424F97459A11A7B4DCA523F0', blank=True, help_text='CRM 线索创建者 OpenID, 默认为王静' ) sync_status = models.CharField( max_length=16, default=SYNC_STATUS_PENDING, choices=SYNC_STATUS_CHOICES, blank=True ) sync_at = models.DateTimeField(blank=True, null=True) request_body = models.TextField(blank=True, null=True) response_body = models.TextField(blank=True, null=True) crm_leads_object_id = models.CharField(max_length=64, blank=True, null=True) class Meta: db_table = 'pingcap_crm_joint_solution_mutual_certification'