暂无描述

models.py 7.0KB

    # -*- coding: utf-8 -*- from django.db import models from django.utils.translation import ugettext_lazy as _ from django_models_ext import BaseModelMixin, upload_file_url, upload_path from shortuuidfield import ShortUUIDField from TimeConvert import TimeConvert as tc from mch.models import ModelInfo, OperatorInfo class MchInfoEncryptLogInfo(BaseModelMixin): plaintext = models.CharField(_(u'plaintext'), max_length=64, blank=True, null=True, help_text=u'待加密字符串', db_index=True, unique=True) alg = models.CharField(_(u'alg'), max_length=16, blank=True, null=True, help_text=u'加密算法') ciphertext = models.CharField(_(u'ciphertext'), max_length=64, blank=True, null=True, help_text=u'加密字符串') brand_pk = models.IntegerField(_(u'brand_pk'), default=0, help_text=u'品牌PK', db_index=True) model_pk = models.IntegerField(_(u'model_pk'), default=0, help_text=u'型号PK', db_index=True) distributor_pk = models.IntegerField(_(u'distributor_pk'), default=0, help_text=u'经销商PK', db_index=True) sn = models.CharField(_(u'sn'), max_length=32, blank=True, null=True, help_text=u'序列号', db_index=True) # 二维码版本 version = models.IntegerField(_(u'version'), default=2, help_text=u'二维码版本', db_index=True) # 一物一码 application_id = models.IntegerField(_(u'application_id'), default=0, help_text=u'申请单号', db_index=True) code = models.CharField(_(u'code'), max_length=16, blank=True, null=True, help_text=u'九位的字符串原始码', db_index=True) code_url = models.CharField(_(u'code_url'), max_length=128, blank=True, null=True, help_text=u'28位普通码字符 ', db_index=True) operator_id = models.CharField(_(u'operator_id'), max_length=32, blank=True, null=True, help_text=u'操作员唯一标识', db_index=True) class Meta: verbose_name = _(u'mchinfoencryptloginfo') verbose_name_plural = _(u'mchinfoencryptloginfo') def __unicode__(self): return '%d' % self.pk @property def admindata(self): model = ModelInfo.objects.get(pk=self.model_pk, status=True) try: operator_name = OperatorInfo.objects.get(operator_id=self.operator_id).name except OperatorInfo.DoesNotExist: operator_name = '深圳捷成' return { 'sn': self.sn, 'model_pk': self.model_pk, 'model_uni_name': model.model_uni_name, 'model_name': model.model_name, 'operator_name': operator_name, 'created_at': tc.local_string(utc_dt=self.created_at, format='%Y-%m-%d %H:%M:%S') } class MchInfoDecryptLogInfo(BaseModelMixin): ciphertext = models.CharField(_(u'ciphertext'), max_length=64, blank=True, null=True, help_text=u'待解密字符串', db_index=True) brand_pk = models.IntegerField(_(u'brand_pk'), default=0, help_text=u'品牌PK', db_index=True) model_pk = models.IntegerField(_(u'model_pk'), default=0, help_text=u'型号PK', db_index=True) distributor_pk = models.IntegerField(_(u'distributor_pk'), default=0, help_text=u'经销商PK', db_index=True) sn = models.CharField(_(u'sn'), max_length=32, blank=True, null=True, help_text=u'序列号', db_index=True) # 一物一码 application_id = models.IntegerField(_(u'application_id'), default=0, help_text=u'申请单号', db_index=True) code = models.CharField(_(u'code'), max_length=16, blank=True, null=True, help_text=u'九位的字符串原始码', db_index=True) code_url = models.CharField(_(u'code_url'), max_length=128, blank=True, null=True, help_text=u'28位普通码字符 ', db_index=True) decrypt_count = models.IntegerField(_(u'decrypt_count'), default=1, help_text=u'解密次数') class Meta: verbose_name = _(u'mchinfodecryptloginfo') verbose_name_plural = _(u'mchinfodecryptloginfo') def __unicode__(self): return '%d' % self.pk class MchLogInfo(BaseModelMixin): log_id = ShortUUIDField(_(u'log_id'), max_length=32, help_text=u'日志唯一标识', db_index=True) log_file = models.FileField(_(u'log_file'), upload_to=upload_path, blank=True, null=True, help_text=u'日志文件') operator_id = models.CharField(_(u'operator_id'), max_length=32, blank=True, null=True, help_text=u'操作员唯一标识', db_index=True) app_version = models.IntegerField(_(u'app_version'), default=0, help_text=u'APP 版本号', db_index=True) class Meta: verbose_name = _(u'mchloginfo') verbose_name_plural = _(u'mchloginfo') def __unicode__(self): return '%d' % self.pk class MchSearchModelAndCameraLogInfo(BaseModelMixin): user_id = models.CharField(_(u'user_id'), max_length=32, blank=True, null=True, help_text=u'用户唯一标识', db_index=True) log_id = ShortUUIDField(_(u'log_id'), max_length=32, help_text=u'日志唯一标识', db_index=True) is_search_model = models.IntegerField(_(u'is_search_model'), default=0, help_text=u'搜索镜头型号', db_index=True) is_selected_model = models.IntegerField(_(u'is_selected_model'), default=0, help_text=u'搜索相机型号', db_index=True) is_search_camera = models.IntegerField(_(u'is_search_model'), default=0, help_text=u'搜索相机型号', db_index=True) is_search_model_camera = models.IntegerField(_(u'is_search_model'), default=0, help_text=u'搜索相机型号和镜头型号', db_index=True) is_search_camera_after_model = models.IntegerField(_(u'is_search_camera_after_model'), default=0, help_text=u'选择镜头后搜索相机型号', db_index=True) class Meta: verbose_name = _(u'mchsearchmodelandcameraloginfo') verbose_name_plural = _(u'mchsearchmodelandcameraloginfo') def __unicode__(self): return '%d' % self.pk class ComplementCodeLogInfo(BaseModelMixin): user_id = models.CharField(_(u'user_id'), max_length=32, blank=True, null=True, help_text=u'用户唯一标识', db_index=True) log_id = ShortUUIDField(_(u'log_id'), max_length=32, help_text=u'日志唯一标识', db_index=True) name = models.CharField(_(u'name'), max_length=255, blank=True, null=True, help_text=u'用户姓名') phone = models.CharField(_(u'phone'), max_length=11, blank=True, null=True, help_text=u'用户电话', db_index=True) model_id = models.CharField(_(u'model_id'), max_length=32, blank=True, null=True, help_text=u'型号唯一标识', db_index=True) model_name = models.CharField(_(u'model_name'), max_length=255, blank=True, null=True, help_text=u'型号名称') sn = models.CharField(_(u'sn'), max_length=32, blank=True, null=True, help_text=u'序列号', db_index=True) shot_image = models.ImageField(_(u'shot_image'), upload_to=upload_path, blank=True, null=True, help_text=u'镜头机身照片') invoice_image = models.ImageField(_(u'invoice_image'), upload_to=upload_path, blank=True, null=True, help_text=u'购买凭证照片') class Meta: verbose_name = _(u'补码记录') verbose_name_plural = _(u'补码记录') def __unicode__(self): return '%d' % self.pk