@@ -12,7 +12,7 @@ from TimeConvert import TimeConvert as tc |
||
12 | 12 |
|
13 | 13 |
from account.models import UserInfo |
14 | 14 |
from mch.models import (AdministratorInfo, BrandInfo, ConsumeInfoSubmitLogInfo, DistributorInfo, LatestAppInfo, |
15 |
- ModelInfo, OperatorInfo) |
|
15 |
+ LatestAppScreenInfo, ModelInfo, OperatorInfo) |
|
16 | 16 |
from statistic.models import (ConsumeDistributorSaleStatisticInfo, ConsumeModelSaleStatisticInfo, |
17 | 17 |
ConsumeProvinceSaleStatisticInfo, ConsumeSaleStatisticInfo) |
18 | 18 |
from utils.error.errno_utils import (AdministratorStatusCode, OperatorStatusCode, ProductBrandStatusCode, |
@@ -144,8 +144,15 @@ def distributors_list(request): |
||
144 | 144 |
@logit |
145 | 145 |
def upgrade_api(request): |
146 | 146 |
""" APP 升级 """ |
147 |
+ src = request.POST.get('scr', '') |
|
148 |
+ |
|
149 |
+ if src == 'datascreen': |
|
150 |
+ latestappmodel = LatestAppScreenInfo |
|
151 |
+ else: |
|
152 |
+ latestappmodel = LatestAppInfo |
|
153 |
+ |
|
147 | 154 |
try: |
148 |
- appinfo = LatestAppInfo.objects.filter(status=True)[0].adr |
|
155 |
+ appinfo = latestappmodel.objects.filter(status=True)[0].adr |
|
149 | 156 |
except IndexError: |
150 | 157 |
appinfo = { |
151 | 158 |
'latest_version_code': '', |
@@ -9,7 +9,7 @@ from django_models_ext import ProvinceShortModelMixin |
||
9 | 9 |
from pysnippets.strsnippets import strip |
10 | 10 |
|
11 | 11 |
from mch.models import (AdministratorInfo, BrandInfo, ConsumeInfoSubmitLogInfo, DistributorInfo, LatestAppInfo, |
12 |
- ModelInfo, OperatorInfo, SaleclerkInfo) |
|
12 |
+ LatestAppScreenInfo, ModelInfo, OperatorInfo, SaleclerkInfo) |
|
13 | 13 |
|
14 | 14 |
|
15 | 15 |
class AdministratorInfoAdmin(DeleteModelAdmin, admin.ModelAdmin): |
@@ -171,6 +171,20 @@ class LatestAppInfoAdmin(admin.ModelAdmin): |
||
171 | 171 |
obj.save() |
172 | 172 |
|
173 | 173 |
|
174 |
+class LatestAppScreenInfoAdmin(admin.ModelAdmin): |
|
175 |
+ list_display = ('latest_adr_version_code', 'latest_adr_version_name', 'latest_adr_app', 'latest_adr_url', 'status', 'created_at', 'updated_at') |
|
176 |
+ list_filter = ('status', ) |
|
177 |
+ readonly_fields = ('status', ) |
|
178 |
+ |
|
179 |
+ def save_model(self, request, obj, form, change): |
|
180 |
+ if not obj.pk and LatestAppInfo.objects.filter(status=True).exists(): |
|
181 |
+ return |
|
182 |
+ obj.latest_adr_version_name = strip(obj.latest_adr_version_name) |
|
183 |
+ obj.latest_adr_app = strip(obj.latest_adr_app) |
|
184 |
+ obj.latest_adr_url = strip(obj.latest_adr_url) |
|
185 |
+ obj.save() |
|
186 |
+ |
|
187 |
+ |
|
174 | 188 |
class ConsumeInfoSubmitLogInfoAdmin(ReadOnlyModelAdmin, admin.ModelAdmin): |
175 | 189 |
list_display = ('user_id', 'phone', 'lat', 'lon', 'serialNo', 'verifyResult', 'test_user', 'status', 'created_at', 'updated_at') |
176 | 190 |
list_filter = ('test_user', 'verifyResult', 'status') |
@@ -185,4 +199,5 @@ admin.site.register(DistributorInfo, DistributorInfoAdmin) |
||
185 | 199 |
admin.site.register(SaleclerkInfo, SaleclerkInfoAdmin) |
186 | 200 |
# admin.site.register(BrandModelDistributorPriceInfo, BrandModelDistributorPriceInfoAdmin) |
187 | 201 |
admin.site.register(LatestAppInfo, LatestAppInfoAdmin) |
202 |
+admin.site.register(LatestAppScreenInfo, LatestAppScreenInfoAdmin) |
|
188 | 203 |
admin.site.register(ConsumeInfoSubmitLogInfo, ConsumeInfoSubmitLogInfoAdmin) |
@@ -402,6 +402,47 @@ class LatestAppInfo(BaseModelMixin): |
||
402 | 402 |
} |
403 | 403 |
|
404 | 404 |
|
405 |
+class LatestAppScreenInfo(BaseModelMixin): |
|
406 |
+ latest_adr_version_code = models.IntegerField(_(u'latest_adr_version_code'), default=0, help_text=u'最新安卓版本号') |
|
407 |
+ latest_adr_version_name = models.CharField(_(u'latest_adr_version_name'), max_length=16, blank=True, null=True, help_text=u'最新安卓版本名') |
|
408 |
+ latest_adr_app = models.FileField(_(u'latest_adr_app'), upload_to=upload_path, blank=True, null=True, help_text=u'最新版安卓 APP') |
|
409 |
+ latest_adr_url = models.URLField(_(u'latest_adr_url'), max_length=255, blank=True, null=True, help_text=u'最新版 APP 链接') |
|
410 |
+ |
|
411 |
+ latest_ios_version_code = models.IntegerField(_(u'latest_ios_version_code'), default=0, help_text=u'最新 iOS 版本号') |
|
412 |
+ latest_ios_version_name = models.CharField(_(u'latest_ios_version_name'), max_length=16, blank=True, null=True, help_text=u'最新 iOS 版本名') |
|
413 |
+ latest_ios_url = models.URLField(_(u'latest_ios_url'), max_length=255, blank=True, null=True, help_text=u'最新版 iOS 链接') |
|
414 |
+ |
|
415 |
+ class Meta: |
|
416 |
+ verbose_name = _(u'升级配置信息(数据大屏)') |
|
417 |
+ verbose_name_plural = _(u'升级配置信息(数据大屏)') |
|
418 |
+ |
|
419 |
+ def __unicode__(self): |
|
420 |
+ return u'{0.pk}'.format(self) |
|
421 |
+ |
|
422 |
+ @property |
|
423 |
+ def final_latest_adr_url(self): |
|
424 |
+ return self.latest_adr_url or upload_file_url(self.latest_adr_app) |
|
425 |
+ |
|
426 |
+ @property |
|
427 |
+ def data(self): |
|
428 |
+ return { |
|
429 |
+ 'latest_adr_version_code': self.latest_adr_version_code, |
|
430 |
+ 'latest_adr_version_name': self.latest_adr_version_name, |
|
431 |
+ 'latest_adr_url': self.final_latest_adr_url, |
|
432 |
+ 'latest_ios_version_code': self.latest_ios_version_code, |
|
433 |
+ 'latest_ios_version_name': self.latest_ios_version_name, |
|
434 |
+ 'latest_ios_url': self.latest_ios_url, |
|
435 |
+ } |
|
436 |
+ |
|
437 |
+ @property |
|
438 |
+ def adr(self): |
|
439 |
+ return { |
|
440 |
+ 'latest_adr_version_code': self.latest_adr_version_code, |
|
441 |
+ 'latest_adr_version_name': self.latest_adr_version_name, |
|
442 |
+ 'latest_adr_url': self.final_latest_adr_url, |
|
443 |
+ } |
|
444 |
+ |
|
445 |
+ |
|
405 | 446 |
class ConsumeInfoSubmitLogInfo(BaseModelMixin): |
406 | 447 |
user_id = models.CharField(_(u'user_id'), max_length=32, blank=True, null=True, help_text=u'用户唯一标识', db_index=True) |
407 | 448 |
|
@@ -7,7 +7,7 @@ from django_logit import logit |
||
7 | 7 |
from django_response import response |
8 | 8 |
from ipaddr import client_ip |
9 | 9 |
from pywe_membercard import get_miniapp_extraData |
10 |
-from pywe_miniapp import get_userinfo, store_session_key, get_session_key |
|
10 |
+from pywe_miniapp import get_session_key, get_userinfo, store_session_key |
|
11 | 11 |
from pywe_storage import RedisStorage |
12 | 12 |
from TimeConvert import TimeConvert as tc |
13 | 13 |
|