ass="icon octicon octicon-issue-opened"> Issues 0 Pull Requests 0 Commits 588 Releases 0

No Description

models.py 9.0KB

    # -*- coding: utf-8 -*- from django.db import models from django.utils.translation import ugettext_lazy as _ from models_ext import BaseModelMixin, upload_file_url, upload_path from shortuuidfield import ShortUUIDField class OperatorInfo(BaseModelMixin): ACTIVATED = 1 DISABLED = 2 USER_STATUS_TUPLE = ( (ACTIVATED, u'已激活'), (DISABLED, u'已禁用'), ) operator_id = ShortUUIDField(_(u'operator_id'), max_length=32, blank=True, null=True, help_text=u'操作员唯一标识', db_index=True, unique=True) phone = models.CharField(_(u'phone'), max_length=16, blank=True, null=True, help_text=u'操作员电话', db_index=True) password = models.CharField(_(u'password'), max_length=255, blank=True, null=True, help_text=u'操作员密码') encryption = models.CharField(_(u'encryption'), max_length=255, blank=True, null=True, help_text=u'操作员密码') name = models.CharField(_(u'name'), max_length=255, blank=True, null=True, help_text=u'操作员姓名') brand_id = models.CharField(_(u'brand_id'), max_length=32, blank=True, null=True, help_text=u'品牌唯一标识', db_index=True) brand_name = models.CharField(_(u'brand_name'), max_length=255, blank=True, null=True, help_text=u'品牌名称') user_status = models.IntegerField(_(u'user_status'), choices=USER_STATUS_TUPLE, default=ACTIVATED, help_text=u'操作员状态', db_index=True) class Meta: verbose_name = _(u'操作员信息') verbose_name_plural = _(u'操作员信息') def __unicode__(self): return u'{}-{}'.format(self.name, self.phone) class BrandInfo(BaseModelMixin): brand_id = ShortUUIDField(_(u'brand_id'), max_length=32, help_text=u'品牌唯一标识', db_index=True, unique=True) brand_name = models.CharField(_(u'brand_name'), max_length=255, blank=True, null=True, help_text=u'品牌名称') brand_descr = models.TextField(_(u'brand_descr'), max_length=255, blank=True, null=True, help_text=u'品牌描述') brand_logo = models.ImageField(_(u'brand_logo'), upload_to=upload_path, blank=True, null=True, help_text=u'品牌商标') position = models.IntegerField(_(u'position'), default=1, help_text=u'排序') class Meta: verbose_name = _(u'品牌信息') verbose_name_plural = _(u'品牌信息') def __unicode__(self): return unicode(self.pk) @property def brand_logo_url(self): return upload_file_url(self.brand_logo) @property def data(self): return { 'brand_id': str(self.pk), 'brand_name': self.brand_name, 'brand_descr': self.brand_descr, } class ModelInfo(BaseModelMixin): brand_id = models.CharField(_(u'brand_id'), max_length=32, blank=True, null=True, help_text=u'品牌唯一标识', db_index=True) brand_name = models.CharField(_(u'brand_name'), max_length=255, blank=True, null=True, help_text=u'品牌名称') model_id = ShortUUIDField(_(u'model_id'), max_length=32, help_text=u'型号唯一标识', db_index=True, unique=True) model_name = models.CharField(_(u'model_name'), max_length=255, blank=True, null=True, help_text=u'型号名称') model_descr = models.TextField(_(u'model_descr'), max_length=255, blank=True, null=True, help_text=u'型号描述') position = models.IntegerField(_(u'position'), default=1, help_text=u'排序') class Meta: verbose_name = _(u'型号信息') verbose_name_plural = _(u'型号信息') def __unicode__(self): return unicode(self.pk) @property def data(self): return { 'model_id': str(self.pk), 'model_name': self.model_name, 'model_descr': self.model_descr, } @property def images(self): imgs = ModelImageInfo.objects.filter(model_id=self.model_id, status=True) return [img.data for img in imgs] class ModelImageInfo(BaseModelMixin): 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'型号名称') image = models.ImageField(_(u'image'), upload_to=upload_path, blank=True, null=True, help_text=u'图片') url = models.CharField(_(u'url'), max_length=255, blank=True, null=True, help_text=u'链接') position = models.IntegerField(_(u'position'), default=1, help_text=u'排序') class Meta: verbose_name = _(u'型号图片信息') verbose_name_plural = _(u'型号图片信息') def __unicode__(self): return unicode(self.pk) @property def image_url(self): return upload_file_url(self.image) @property def data(self): return { 'image_url': self.image_url, 'url': self.url, } class DistributorInfo(BaseModelMixin): brand_id = models.CharField(_(u'brand_id'), max_length=32, blank=True, null=True, help_text=u'品牌唯一标识', db_index=True) brand_name = models.CharField(_(u'brand_name'), max_length=255, blank=True, null=True, help_text=u'品牌名称') distributor_id = ShortUUIDField(_(u'distributor_id'), max_length=32, help_text=u'经销商唯一标识', db_index=True, unique=True) distributor_name = models.CharField(_(u'distributor_name'), max_length=255, blank=True, null=True, help_text=u'经销商名称') distributor_descr = models.TextField(_(u'distributor_descr'), max_length=255, blank=True, null=True, help_text=u'经销商描述') position = models.IntegerField(_(u'position'), default=1, help_text=u'排序') class Meta: verbose_name = _(u'经销商信息') verbose_name_plural = _(u'经销商信息') def __unicode__(self): return unicode(self.pk) @property def data(self): return { 'distributor_id': str(self.pk), 'distributor_name': self.distributor_name, 'distributor_descr': self.distributor_descr, } class LatestAppInfo(BaseModelMixin): latest_adr_version_code = models.IntegerField(_(u'latest_adr_version_code'), default=0, help_text=u'最新安卓版本号') latest_adr_version_name = models.CharField(_(u'latest_adr_version_name'), max_length=16, blank=True, null=True, help_text=u'最新安卓版本名') latest_adr_app = models.FileField(_(u'latest_adr_app'), upload_to=upload_path, blank=True, null=True, help_text=u'最新版安卓 APP') latest_adr_url = models.URLField(_(u'latest_adr_url'), max_length=255, blank=True, null=True, help_text=u'最新版 APP 链接') latest_ios_version_code = models.IntegerField(_(u'latest_ios_version_code'), default=0, help_text=u'最新 iOS 版本号') latest_ios_version_name = models.CharField(_(u'latest_ios_version_name'), max_length=16, blank=True, null=True, help_text=u'最新 iOS 版本名') latest_ios_url = models.URLField(_(u'latest_ios_url'), max_length=255, blank=True, null=True, help_text=u'最新版 iOS 链接') class Meta: verbose_name = _(u'升级配置信息') verbose_name_plural = _(u'升级配置信息') def __unicode__(self): return u'{0.pk}'.format(self) @property def final_latest_adr_url(self): return self.latest_adr_url or upload_file_url(self.latest_adr_app) @property def data(self): return { 'latest_adr_version_code': self.latest_adr_version_code, 'latest_adr_version_name': self.latest_adr_version_name, 'latest_adr_url': self.final_latest_adr_url, 'latest_ios_version_code': self.latest_ios_version_code, 'latest_ios_version_name': self.latest_ios_version_name, 'latest_ios_url': self.latest_ios_url, } @property def adr(self): return { 'latest_adr_version_code': self.latest_adr_version_code, 'latest_adr_version_name': self.latest_adr_version_name, 'latest_adr_url': self.final_latest_adr_url, } class ConsumeInfoSubmitLogInfo(BaseModelMixin): user_id = models.CharField(_(u'user_id'), max_length=32, blank=True, null=True, help_text=u'用户唯一标识', db_index=True) phone = models.CharField(_(u'phone'), max_length=11, blank=True, null=True, help_text=u'用户手机', db_index=True) iv = models.CharField(_(u'iv'), max_length=255, blank=True, null=True, help_text=u'iv') encryptedData = models.CharField(_(u'encryptedData'), max_length=255, blank=True, null=True, help_text=u'encryptedData') lat = models.FloatField(_(u'lat'), default=1.0, help_text=u'纬度') lon = models.FloatField(_(u'lon'), default=1.0, help_text=u'经度') serialNo = models.CharField(_(u'serialNo'), max_length=16, blank=True, null=True, help_text=u'序列号', db_index=True) verifyResult = models.IntegerField(_(u'verifyResult'), default=0, help_text=u'验证结果') class Meta: verbose_name = _(u'消费者信息提交记录') verbose_name_plural = _(u'消费者信息提交记录') def __unicode__(self): return unicode(self.pk)
pai2 - Gogs: Go Git Service

拍爱

Brightcells: 9295b82620 Fix Bug: 'dict' object is not callable 9 年之前
account d4f34707b9 Return user_info of tgu_group_user_locations_api the same as tg_group_detail_api 9 年之前
api 6e5652151a Add api tgu_group_user_remove_api 9 年之前
geo 5c37fe6af6 Fix Bug: User Has Not Join Group 9 年之前
group 9295b82620 Fix Bug: 'dict' object is not callable 9 年之前
message f818f4127f Docstring simplify 9 年之前
operation 1fac624f0e Add paage tgu_group_detail 9 年之前
page 1fac624f0e Add paage tgu_group_detail 9 年之前
pai2 1fac624f0e Add paage tgu_group_detail 9 年之前
pay f818f4127f Docstring simplify 9 年之前
photo 0ab056c3fd Change ip_addr to get_client_ip 9 年之前
utils d4f34707b9 Return user_info of tgu_group_user_locations_api the same as tg_group_detail_api 9 年之前
website 8263625d9c new website 10 年之前
wechat e440bc76ee Change to use pywe-oauth 10 年之前
.editorconfig 4defb80fdc gogs first init 11 年之前
.gitignore 2f29afecbd modify version in operation 10 年之前
.isort.cfg afcdf74a49 add api group_data_api 10 年之前
TODO.md 633c2598ed Update TODO.md - Add Remove Unused Api 9 年之前
check.sh 95c1d32792 put isort and pep8 in check.sh 10 年之前
isort.sh 6626af8a8d add api lensman_wx_authorize_api 10 年之前
manage.py fabef63211 set line_length=200 for isort 10 年之前
pep8.sh 4defb80fdc gogs first init 11 年之前
requirements.txt 70f5faad11 Add tg_group_token_api/tg_group_transfer_api 9 年之前