add user_coupon_id

FFIB 5 ans auparavant
Parent
Commettre
024bcba754
1 fichiers modifiés avec 3 ajouts et 1 suppressions
  1. 3 1
      coupon/models.py

+ 3 - 1
coupon/models.py

@@ -47,6 +47,7 @@ class UserCouponInfo(BaseModelMixin):
47 47
     brand_id = models.CharField(_(u'brand_id'), max_length=32, blank=True, null=True, help_text=u'品牌唯一标识', db_index=True)
48 48
     brand_name = models.CharField(_(u'brand_name'), max_length=255, blank=True, null=True, help_text=u'品牌名称')
49 49
 
50
+    user_coupon_id = ShortUUIDField(_(u'user_coupon_id'), max_length=32, blank=True, null=True, help_text=u'用户券唯一标识', db_index=True, unique=True)
50 51
     coupon_id = ShortUUIDField(_(u'coupon_id'), max_length=32, blank=True, null=True, help_text=u'券唯一标识', db_index=True)
51 52
     user_id = models.CharField(_(u'user_id'), max_length=32, blank=True, null=True, help_text=u'用户唯一标识', db_index=True)
52 53
 
@@ -83,6 +84,7 @@ class UserCouponInfo(BaseModelMixin):
83 84
     @property
84 85
     def data(self):
85 86
         return {
87
+            'user_coupon_id': self.user_coupon_id,
86 88
             'coupon_id': self.coupon_id,
87 89
             'coupon_title': self.coupon_title,
88 90
             'coupon_detail': self.coupon_detail,
@@ -90,7 +92,7 @@ class UserCouponInfo(BaseModelMixin):
90 92
             'coupon_value': self.coupon_value,
91 93
             'coupon_image_url': self.coupon_image_url,
92 94
             'active_at': tc.local_string(self.active_at, format='%Y%m%d'),
93
-            'expire_at': tc.local_string(self.expire_at, format='%Y%m%d'),
95
+            'expire_at': tc.local_string(self.expire_at, format='%Y-%m-%d'),
94 96
             'coupon_valid_period': self.coupon_valid_period,
95 97
             'coupon_limit_brand_ids': self.coupon_limit_brand_ids,
96 98
             'has_used': self.has_used,