brand_id

Kimi.Huang лет %!s(int64=6): %!d(string=назад)
Родитель
Сommit
87bcab0975
4 измененных файлов с 32 добавлено и 1 удалено
  1. 2 1
      api/mch_views.py
  2. 25 0
      mch/migrations/0031_auto_20190327_1718.py
  3. 4 0
      mch/models.py
  4. 1 0
      requirements_pywe.txt

+ 2 - 1
api/mch_views.py

@@ -135,6 +135,7 @@ def distributors_list(request):
135 135
 @logit
136 136
 def upgrade_api(request):
137 137
     """ APP 升级 """
138
+    brand_id = request.POST.get('brand_id', settings.KODO_DEFAULT_BRAND_ID)
138 139
     src = request.POST.get('src', '')
139 140
 
140 141
     if src == 'datascreen':
@@ -143,7 +144,7 @@ def upgrade_api(request):
143 144
         latestappmodel = LatestAppInfo
144 145
 
145 146
     try:
146
-        appinfo = latestappmodel.objects.filter(status=True)[0].adr
147
+        appinfo = latestappmodel.objects.filter(brand_id=brand_id, status=True)[0].adr
147 148
     except IndexError:
148 149
         appinfo = {
149 150
             'latest_version_code': '',

+ 25 - 0
mch/migrations/0031_auto_20190327_1718.py

@@ -0,0 +1,25 @@
1
+# -*- coding: utf-8 -*-
2
+# Generated by Django 1.11.20 on 2019-03-27 09:18
3
+from __future__ import unicode_literals
4
+
5
+from django.db import migrations, models
6
+
7
+
8
+class Migration(migrations.Migration):
9
+
10
+    dependencies = [
11
+        ('mch', '0030_auto_20190301_1402'),
12
+    ]
13
+
14
+    operations = [
15
+        migrations.AddField(
16
+            model_name='latestappinfo',
17
+            name='brand_id',
18
+            field=models.CharField(blank=True, db_index=True, help_text='\u54c1\u724c\u552f\u4e00\u6807\u8bc6', max_length=32, null=True, verbose_name='brand_id'),
19
+        ),
20
+        migrations.AddField(
21
+            model_name='latestappscreeninfo',
22
+            name='brand_id',
23
+            field=models.CharField(blank=True, db_index=True, help_text='\u54c1\u724c\u552f\u4e00\u6807\u8bc6', max_length=32, null=True, verbose_name='brand_id'),
24
+        ),
25
+    ]

+ 4 - 0
mch/models.py

@@ -385,6 +385,8 @@ class BrandModelDistributorPriceInfo(BaseModelMixin):
385 385
 
386 386
 
387 387
 class LatestAppInfo(BaseModelMixin):
388
+    brand_id = models.CharField(_(u'brand_id'), max_length=32, blank=True, null=True, help_text=u'品牌唯一标识', db_index=True)
389
+
388 390
     latest_adr_version_code = models.IntegerField(_(u'latest_adr_version_code'), default=0, help_text=u'最新安卓版本号')
389 391
     latest_adr_version_name = models.CharField(_(u'latest_adr_version_name'), max_length=16, blank=True, null=True, help_text=u'最新安卓版本名')
390 392
     latest_adr_app = models.FileField(_(u'latest_adr_app'), upload_to=upload_path, blank=True, null=True, help_text=u'最新版安卓 APP')
@@ -426,6 +428,8 @@ class LatestAppInfo(BaseModelMixin):
426 428
 
427 429
 
428 430
 class LatestAppScreenInfo(BaseModelMixin):
431
+    brand_id = models.CharField(_(u'brand_id'), max_length=32, blank=True, null=True, help_text=u'品牌唯一标识', db_index=True)
432
+
429 433
     latest_adr_version_code = models.IntegerField(_(u'latest_adr_version_code'), default=0, help_text=u'最新安卓版本号')
430 434
     latest_adr_version_name = models.CharField(_(u'latest_adr_version_name'), max_length=16, blank=True, null=True, help_text=u'最新安卓版本名')
431 435
     latest_adr_app = models.FileField(_(u'latest_adr_app'), upload_to=upload_path, blank=True, null=True, help_text=u'最新版安卓 APP')

+ 1 - 0
requirements_pywe.txt

@@ -1,3 +1,4 @@
1
+pywe-card==1.0.0
1 2
 pywe-component==1.0.1
2 3
 pywe-component-preauthcode==1.0.3
3 4
 pywe-jssdk==1.1.0