brand_id

Kimi.Huang 6 jaren geleden
bovenliggende
commit
ea43d895b2
2 gewijzigde bestanden met toevoegingen van 4 en 4 verwijderingen
  1. 2 4
      api/encrypt_views.py
  2. 2 0
      mch/models.py

+ 2 - 4
api/encrypt_views.py

@@ -6,7 +6,6 @@ import random
6 6
 
7 7
 from django_logit import logit
8 8
 from django_response import response
9
-from TimeConvert import TimeConvert as tc
10 9
 
11 10
 from logs.models import MchInfoDecryptLogInfo, MchInfoEncryptLogInfo
12 11
 from mch.models import ActivityInfo, BrandInfo, ModelInfo
@@ -109,8 +108,7 @@ def decrypt(request):
109 108
         mdli.decrypt_count += 1
110 109
         mdli.save()
111 110
 
112
-    act = ActivityInfo.objects.filter(status=True).order_by('-pk').first()
113
-    has_unexpired_activity = True if act and act.has_unexpired_activity else False
111
+    act = ActivityInfo.objects.filter(brand_id=brand.brand_id, status=True).order_by('-pk').first()
114 112
 
115 113
     return response(200, data={
116 114
         'plaintext': plaintext,
@@ -124,5 +122,5 @@ def decrypt(request):
124 122
             'DistributorID': distributor_pk,
125 123
             'SerialNo': sn,
126 124
         },
127
-        'has_unexpired_activity': has_unexpired_activity,
125
+        'has_unexpired_activity': True if act and act.has_unexpired_activity else False,
128 126
     })

+ 2 - 0
mch/models.py

@@ -531,6 +531,8 @@ class ConsumeInfoSubmitLogInfo(BaseModelMixin):
531 531
 
532 532
 
533 533
 class ActivityInfo(BaseModelMixin):
534
+    brand_id = models.CharField(_(u'brand_id'), max_length=32, blank=True, null=True, help_text=u'品牌唯一标识', db_index=True)
535
+
534 536
     activity_name = models.CharField(_(u'activity_name'), max_length=255, blank=True, null=True, help_text=u'活动名称')
535 537
 
536 538
     start_at = models.DateTimeField(_(u'start_at'), help_text=_(u'start_at'))