final_coupon_expire_at

Kimi.Huang %!s(int64=6) %!d(string=hace) años
padre
commit
db34d77655
Se han modificado 2 ficheros con 20 adiciones y 2 borrados
  1. 1 1
      api/encrypt_views.py
  2. 19 1
      mch/models.py

+ 1 - 1
api/encrypt_views.py

@@ -111,7 +111,7 @@ def decrypt(request):
111 111
     act = ActivityInfo.objects.filter(brand_id=brand.brand_id, status=True).order_by('-pk').first()
112 112
     has_unexpired_activity = True if act and act.has_unexpired_activity(model.model_uni_name) else False
113 113
     coupon_info = {
114
-        'coupon_expire_at': act.coupon_expire_at,
114
+        'coupon_expire_at': act.final_coupon_expire_at,
115 115
         'coupon_value': act.coupon_value,
116 116
     } if has_unexpired_activity else {
117 117
         'coupon_expire_at': '',

+ 19 - 1
mch/models.py

@@ -512,6 +512,15 @@ class ConsumeInfoSubmitLogInfo(BaseModelMixin):
512 512
         return unicode(self.pk)
513 513
 
514 514
     @property
515
+    def final_coupon_expire_at(self):
516
+        if not self.coupon_expire_at:
517
+            return ''
518
+        y = tc.local_string(self.coupon_expire_at, format='%Y')
519
+        m = tc.local_string(self.coupon_expire_at, format='%m')
520
+        d = tc.local_string(self.coupon_expire_at, format='%d')
521
+        return u'{}年{}月{}日'.format(y, m, d)
522
+
523
+    @property
515 524
     def model_info(self):
516 525
         try:
517 526
             info = ModelInfo.objects.get(model_id=self.model_id).fulldata
@@ -533,7 +542,7 @@ class ConsumeInfoSubmitLogInfo(BaseModelMixin):
533 542
             'verifyResult': self.verifyResult,
534 543
             'submit_during_activity': self.submit_during_activity,
535 544
             'coupon_info': {
536
-                'coupon_expire_at': self.coupon_expire_at,
545
+                'coupon_expire_at': self.final_coupon_expire_at,
537 546
                 'coupon_value': self.coupon_value,
538 547
             },
539 548
         }
@@ -559,5 +568,14 @@ class ActivityInfo(BaseModelMixin):
559 568
     def __unicode__(self):
560 569
         return unicode(self.pk)
561 570
 
571
+    @property
572
+    def final_coupon_expire_at(self):
573
+        if not self.coupon_expire_at:
574
+            return ''
575
+        y = tc.local_string(self.coupon_expire_at, format='%Y')
576
+        m = tc.local_string(self.coupon_expire_at, format='%m')
577
+        d = tc.local_string(self.coupon_expire_at, format='%d')
578
+        return u'{}年{}月{}日'.format(y, m, d)
579
+
562 580
     def has_unexpired_activity(self, model_name):
563 581
         return (self.model_uni_names and model_name in self.model_uni_names) and (self.start_at <= tc.utc_datetime() < self.end_at)