|
|
@@ -1,16 +1,12 @@
|
1
|
1
|
# -*- coding: utf-8 -*-
|
2
|
2
|
|
3
|
3
|
import logging
|
4
|
|
-import time
|
5
|
4
|
|
6
|
|
-from django_six import CompatibilityBaseCommand, close_old_connections
|
7
|
|
-from TimeConvert import TimeConvert as tc
|
|
5
|
+from django_six import CompatibilityBaseCommand
|
8
|
6
|
|
9
|
7
|
from account.models import UserInfo
|
10
|
8
|
from coupon.models import CouponInfo, UserCouponInfo
|
11
|
9
|
from member.models import RightInfo
|
12
|
|
-from utils.redis.connect import r
|
13
|
|
-from utils.redis.rkeys import MEMBER_SEND_COUPON_LIST
|
14
|
10
|
|
15
|
11
|
|
16
|
12
|
logger = logging.getLogger('console')
|
|
|
@@ -18,6 +14,8 @@ logger = logging.getLogger('console')
|
18
|
14
|
|
19
|
15
|
class Command(CompatibilityBaseCommand):
|
20
|
16
|
def handle(self, *args, **options):
|
|
17
|
+ UserInfo.objects.all().update(coupon_expire_at=None)
|
|
18
|
+
|
21
|
19
|
coupon_ids = []
|
22
|
20
|
|
23
|
21
|
rights = RightInfo.objects.filter(is_send_coupon=True, status=True)
|
|
|
@@ -35,7 +33,7 @@ class Command(CompatibilityBaseCommand):
|
35
|
33
|
|
36
|
34
|
users = UserInfo.objects.all()
|
37
|
35
|
for user in users:
|
38
|
|
- coupons = UserCouponInfo.objects.filter(coupon_id__in=coupon_ids, status=True).order_by('-expire_at')
|
|
36
|
+ coupons = UserCouponInfo.objects.filter(user_id=user.user_id, coupon_id__in=coupon_ids, status=True).order_by('-expire_at')
|
39
|
37
|
if not coupons:
|
40
|
38
|
continue
|
41
|
39
|
|