class=" item" href="/Kodo/kodo/issues"> Issues 0 Pull Requests 0 Commits 927 Releases 0

No Description

hb.py 1.8KB

    # -*- coding: utf-8 -*- import logging from django.db import transaction from django_six import CompatibilityBaseCommand, close_old_connections from account.models import UserInfo from api.hb_views import exec_clerk_send_jsapi_hb, exec_send_jsapi_hb from logs.models import MchInfoEncryptLogInfo from utils.redis.connect import r from utils.redis.rkeys import REDPACK_WAITING_SEND_LIST logger = logging.getLogger('console') class Command(CompatibilityBaseCommand): def handle(self, *args, **options): logger.info('Redpack is dealing') while True: # r.rpushjson('REDPACK_WAITING_SEND_LIST', { # 'sn': 'sn', # 'user_id': 'user_id', # 'amount': amount, # 'is_clerk': 1, # }) k, v = r.blpopjson(REDPACK_WAITING_SEND_LIST, 60) if not v: continue logger.info(v) close_old_connections() with transaction.atomic(): try: elog = MchInfoEncryptLogInfo.objects.select_for_update().get(sn=v.get('sn', '')) except MchInfoEncryptLogInfo.DoesNotExist: continue except MchInfoEncryptLogInfo.MultipleObjectsReturned: continue try: user = UserInfo.objects.get(user_id=v.get('user_id', '')) except UserInfo.DoesNotExist: continue if not user.openid: r.rpushjson(REDPACK_WAITING_SEND_LIST, v) continue if v.get('user_id', '') == 1: exec_clerk_send_jsapi_hb(user, elog, v.get('amount', 100)) else: exec_send_jsapi_hb(user, elog, v.get('amount', 100)) close_old_connections()
ftime/ttime · 4eef16491f - Gogs: Go Git Service

ftime/ttime

Kimi.Huang 7 years ago
parent
commit
4eef16491f
1 changed files with 4 additions and 4 deletions
  1. 4 4
      page/sale_views.py

+ 4 - 4
page/sale_views.py

@@ -716,10 +716,10 @@ def clerk_integral_list_api(request):
716 716
         return response(SaleclerkStatusCode.CLERK_NOT_FOUND)
717 717
 
718 718
     integrals = SaleclerkIntegralIncomeExpensesInfo.objects.filter(clerk_id=clerk.clerk_id).order_by('-pk')
719
-    if ftime and ttime:
720
-        fdt = tc.string_to_utc_datetime(ftime)
721
-        tdt = tc.string_to_utc_datetime(ttime)
722
-        integrals = integrals.filter(created_at__gte=fdt, created_at__lte=tdt)
719
+    if ftime:
720
+        integrals = integrals.filter(created_at__gte=tc.string_to_utc_datetime(ftime))
721
+    if ttime:
722
+        integrals = integrals.filter(created_at__lte=tc.string_to_utc_datetime(ttime))
723 723
     integrals, left = pagination(integrals, page, num)
724 724
     integrals = [integral.data for integral in integrals]
725 725