redpack_info_list

Brightcells 7 anni fa
parent
commit
df2748991e
2 ha cambiato i file con 14 aggiunte e 1 eliminazioni
  1. 1 1
      api/encrypt_views.py
  2. 13 0
      logs/models.py

+ 1 - 1
api/encrypt_views.py

@@ -157,6 +157,6 @@ def decrypt(request):
157 157
         },
158 158
         'has_unexpired_activity': has_unexpired_activity,
159 159
         'coupon_info': coupon_info,
160
-        'redpack_info': elog.redpack_info if elog else {},
160
+        'redpack_info': elog.redpack_info_list if elog else {},
161 161
         'integral': model.integral,
162 162
     })

+ 13 - 0
logs/models.py

@@ -60,6 +60,11 @@ class MchInfoEncryptLogInfo(BaseModelMixin):
60 60
             'clerk_nickname': self.clerk_nickname,
61 61
         }
62 62
 
63
+    @property
64
+    def redpack_info_list(self):
65
+        logs = RedpackSendLogInfo.objects.filter(sn=self.sn, is_clerk_redpack=False)
66
+        return [log.redpack_info for log in logs]
67
+
63 68
 
64 69
 class MchInfoDecryptLogInfo(BaseModelMixin):
65 70
     ciphertext = models.CharField(_(u'ciphertext'), max_length=64, blank=True, null=True, help_text=u'待解密字符串', db_index=True)
@@ -124,3 +129,11 @@ class RedpackSendLogInfo(BaseModelMixin):
124 129
 
125 130
     def __unicode__(self):
126 131
         return unicode(self.pk)
132
+
133
+    @property
134
+    def redpack_info(self):
135
+        return {
136
+            'user_id': self.user_id,
137
+            'nickname': self.nickname,
138
+            'redpack_amount': self.redpack_amount,
139
+        }