@@ -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 |
@@ -112,6 +111,14 @@ def decrypt(request): |
||
| 112 | 111 |
act = ActivityInfo.objects.filter(status=True).order_by('-pk').first()
|
| 113 | 112 |
has_unexpired_activity = True if act and act.has_unexpired_activity(model.model_uni_name) else False |
| 114 | 113 |
|
| 114 |
+ coupon_info = {
|
|
| 115 |
+ 'coupon_expire_at': act.coupon_expire_at, |
|
| 116 |
+ 'coupon_value': act.coupon_value, |
|
| 117 |
+ } if has_unexpired_activity else {
|
|
| 118 |
+ 'coupon_expire_at': '', |
|
| 119 |
+ 'coupon_value': 0, |
|
| 120 |
+ } |
|
| 121 |
+ |
|
| 115 | 122 |
return response(200, data={
|
| 116 | 123 |
'plaintext': plaintext, |
| 117 | 124 |
'logo_url': brand.brand_logo_url if brand else '', |
@@ -125,4 +132,5 @@ def decrypt(request): |
||
| 125 | 132 |
'SerialNo': sn, |
| 126 | 133 |
}, |
| 127 | 134 |
'has_unexpired_activity': has_unexpired_activity, |
| 135 |
+ 'coupon_info': coupon_info |
|
| 128 | 136 |
}) |
@@ -297,6 +297,8 @@ def consumer_info_api(request): |
||
| 297 | 297 |
verifyResult=verifyResult, |
| 298 | 298 |
dupload=dupload, |
| 299 | 299 |
submit_during_activity=during_activity, |
| 300 |
+ coupon_expire_at=coupon_expire_at if during_activity else None, |
|
| 301 |
+ coupon_value=coupon_value if during_activity else 0, |
|
| 300 | 302 |
test_user=user.test_user, |
| 301 | 303 |
) |
| 302 | 304 |
|
@@ -186,7 +186,7 @@ class ConsumeInfoSubmitLogInfoAdmin(ReadOnlyModelAdmin, admin.ModelAdmin): |
||
| 186 | 186 |
|
| 187 | 187 |
|
| 188 | 188 |
class ActivityInfoAdmin(admin.ModelAdmin): |
| 189 |
- list_display = ('activity_name', 'model_uni_names', 'start_at', 'end_at', 'status', 'created_at', 'updated_at')
|
|
| 189 |
+ list_display = ('activity_name', 'model_uni_names', 'start_at', 'end_at', 'coupon_expire_at', 'coupon_value', 'status', 'created_at', 'updated_at')
|
|
| 190 | 190 |
|
| 191 | 191 |
|
| 192 | 192 |
admin.site.register(AdministratorInfo, AdministratorInfoAdmin) |
@@ -493,6 +493,8 @@ class ConsumeInfoSubmitLogInfo(BaseModelMixin): |
||
| 493 | 493 |
dupload = models.BooleanField(_(u'dupload'), default=False, help_text=_(u'是否为重复提交'), db_index=True) |
| 494 | 494 |
|
| 495 | 495 |
submit_during_activity = models.BooleanField(_(u'submit_during_activity'), default=False, help_text=_(u'是否为活动期间上传'), db_index=True) |
| 496 |
+ coupon_expire_at = models.DateTimeField(_(u'coupon_expire_at'), blank=True, null=True, help_text=_(u'维修券过期时间')) |
|
| 497 |
+ coupon_value = models.IntegerField(_(u'coupon_value'), default=0, help_text=_(u'维修券金额(单位:分)')) |
|
| 496 | 498 |
|
| 497 | 499 |
test_user = models.BooleanField(_(u'test_user'), default=False, help_text=_(u'是否为测试用户'), db_index=True) |
| 498 | 500 |
|
@@ -524,6 +526,10 @@ class ConsumeInfoSubmitLogInfo(BaseModelMixin): |
||
| 524 | 526 |
'serialNo': self.serialNo, |
| 525 | 527 |
'verifyResult': self.verifyResult, |
| 526 | 528 |
'submit_during_activity': self.submit_during_activity, |
| 529 |
+ 'coupon_info': {
|
|
| 530 |
+ 'coupon_expire_at': self.coupon_expire_at, |
|
| 531 |
+ 'coupon_value': self.coupon_value, |
|
| 532 |
+ }, |
|
| 527 | 533 |
} |
| 528 | 534 |
|
| 529 | 535 |
|
@@ -535,6 +541,9 @@ class ActivityInfo(BaseModelMixin): |
||
| 535 | 541 |
start_at = models.DateTimeField(_(u'start_at'), help_text=_(u'start_at')) |
| 536 | 542 |
end_at = models.DateTimeField(_(u'end_at'), help_text=_(u'end_at')) |
| 537 | 543 |
|
| 544 |
+ coupon_expire_at = models.DateTimeField(_(u'coupon_expire_at'), blank=True, null=True, help_text=_(u'维修券过期时间')) |
|
| 545 |
+ coupon_value = models.IntegerField(_(u'coupon_value'), default=0, help_text=_(u'维修券金额(单位:分)')) |
|
| 546 |
+ |
|
| 538 | 547 |
class Meta: |
| 539 | 548 |
verbose_name = _(u'活动信息') |
| 540 | 549 |
verbose_name_plural = _(u'活动信息') |