sn

Brightcells 7 jaren geleden
bovenliggende
commit
a056ee5d64
3 gewijzigde bestanden met toevoegingen van 10 en 3 verwijderingen
  1. 8 1
      api/hb_views.py
  2. 1 1
      api/mch_views.py
  3. 1 1
      commands/management/commands/hb.py

+ 8 - 1
api/hb_views.py

@@ -7,13 +7,20 @@ from django_we.models import SubscribeUserInfo
7 7
 
8 8
 from logs.models import RedpackSendLogInfo
9 9
 from miniapp.redpack_views import send_jsapi_hb
10
+from utils.redis.connect import r
11
+from utils.redis.rkeys import REDPACK_WAITING_SEND_LIST
10 12
 
11 13
 
12
-def exec_send_jsapi_hb(user, elog, amount):
14
+def exec_send_jsapi_hb(user, elog, amount, sn=None):
13 15
     if elog.redpack_send_num >= 3:
14 16
         return
15 17
 
16 18
     if not SubscribeUserInfo.objects.filter(extraid=user.brand_id, unionid=user.unionid, openid=user.openid, subscribe=True).exists():
19
+        r.rpushjson(REDPACK_WAITING_SEND_LIST, {
20
+            'sn': sn,
21
+            'user_id': user.user_id,
22
+            'amount': amount,
23
+        })
17 24
         return
18 25
 
19 26
     pre_amount = elog.pre_redpack_send_amount or elog.redpack_amount or elog.redpack_max_amount

+ 1 - 1
api/mch_views.py

@@ -399,7 +399,7 @@ def consumer_info_api(request):
399 399
         if elog.redpack_max_amount:
400 400
             amount = random.randint(100, elog.redpack_max_amount)
401 401
         if user.openid:
402
-            exec_send_jsapi_hb(user, elog, amount)
402
+            exec_send_jsapi_hb(user, elog, amount, sn=serialNo)
403 403
         else:
404 404
             r.rpushjson(REDPACK_WAITING_SEND_LIST, {
405 405
                 'sn': serialNo,

+ 1 - 1
commands/management/commands/hb.py

@@ -59,6 +59,6 @@ class Command(CompatibilityBaseCommand):
59 59
                 if v.get('user_id', '') == 1:
60 60
                     exec_clerk_send_jsapi_hb(user, elog, v.get('amount', 100))
61 61
                 else:
62
-                    exec_send_jsapi_hb(user, elog, v.get('amount', 100))
62
+                    exec_send_jsapi_hb(user, elog, v.get('amount', 100), sn=v.get('sn', ''))
63 63
 
64 64
             close_old_connections()