@@ -156,7 +156,7 @@ def decrypt(request, v='v2'): |
||
| 156 | 156 |
|
| 157 | 157 |
else: |
| 158 | 158 |
activities = ActivityInfo.objects.filter(status=True).order_by('-pk')
|
| 159 |
- coupon_infos = [act.coupon_info3 for act in activities if act and act.has_unexpired_activity(model.model_uni_name)] |
|
| 159 |
+ coupon_infos = [act.coupon_info3 for act in activities if act and act.has_unexpired_activity(model.model_name)] |
|
| 160 | 160 |
|
| 161 | 161 |
return response(200, data={
|
| 162 | 162 |
'plaintext': plaintext, |
@@ -252,7 +252,7 @@ def decrypt2(request, v='v2'): |
||
| 252 | 252 |
|
| 253 | 253 |
else: |
| 254 | 254 |
activities = ActivityInfo.objects.filter(status=True).order_by('-pk')
|
| 255 |
- coupon_infos = [act.coupon_info3 for act in activities if act.has_unexpired_activity(model.model_uni_name)] |
|
| 255 |
+ coupon_infos = [act.coupon_info3 for act in activities if act.has_unexpired_activity(model.model_name)] |
|
| 256 | 256 |
|
| 257 | 257 |
return response(200, data={
|
| 258 | 258 |
'plaintext': plaintext, |
@@ -899,7 +899,7 @@ class ActivityInfo(BaseModelMixin): |
||
| 899 | 899 |
return tc.local_string(utc_dt=final_expire_at, format=u'%Y年%m月%d日', isuc=True) |
| 900 | 900 |
|
| 901 | 901 |
def has_unexpired_activity(self, model_name): |
| 902 |
- return ((self.model_uni_names and model_name in self.model_uni_names) or not self.model_uni_names) and (self.start_at <= tc.utc_datetime() < self.end_at) |
|
| 902 |
+ return (self.model_uni_names and len([model_uni_name for model_uni_name in self.model_uni_names if model_uni_name in model_name]) > 0) and (self.start_at <= tc.utc_datetime() < self.end_at) |
|
| 903 | 903 |
|
| 904 | 904 |
def coupon_info(self, created_at=None): |
| 905 | 905 |
return {
|