Exemple #1
0
 def handle(self, start, end, *args, **options):
     now = datetime.now()
     if end is None:
         end_datetime = now
     else:
         end_datetime = utils.string_to_datetime(end, format_str="%Y-%m-%d")
     if start is None:
         start_datetime = end_datetime - timedelta(3)
     else:
         start_datetime = utils.string_to_datetime(start,
                                                   format_str="%Y-%m-%d")
     start_date = start_datetime.date()
     end_date = end_datetime.date()
     print "__sync jk child user rmb", start_date, end_date
     print now
     default_user = get_user_by_username("13300000000")
     # SYFTrade
     used_trans_ids = set(
         models.JKChildProfit.objects.values_list("trans_id", flat=True))
     objs = models.JKProfit.objects.all()
     for obj in objs:
         if obj.trans_id in used_trans_ids:
             continue
         adatetime = utils.string_to_datetime(obj.trade_date[:10],
                                              format_str="%Y-%m-%d")
         adate = adatetime.date()
         if start_date <= adate <= end_date:
             process_jk_child_rmb(obj, default_user)
     print "ok"
Exemple #2
0
 def handle(self, start, end, *args, **options):
     now = datetime.now()
     if end is None:
         end_datetime = now
     else:
         end_datetime = utils.string_to_datetime(end, format_str="%Y-%m-%d")
     if start is None:
         start_datetime = end_datetime - timedelta(3)
     else:
         start_datetime = utils.string_to_datetime(start,
                                                   format_str="%Y-%m-%d")
     start_date = start_datetime.date()
     end_date = end_datetime.date()
     print "__sync jk user rmb", start_date, end_date
     print now
     default_user = get_user_by_username("13300000000")
     # SYFTrade
     used_trans_ids = set(
         models.JKProfit.objects.values_list("trans_id", flat=True))
     objs = models.JKTrade.objects.filter(card_type=u"贷记").filter(
         return_code="00")
     # if obj.trade_card_type == u"贷记卡" and obj.return_code == "00" and obj.trade_rmb != "299.0":
     for obj in objs:
         if obj.trans_id in used_trans_ids:
             continue
         if obj.product.strip() == "" and obj.trade_category.strip(
         ) == "" and obj.trade_rmb != "220.0" and obj.trade_rmb != "300.0":
             adatetime = utils.string_to_datetime(obj.trade_date[:10],
                                                  format_str="%Y-%m-%d")
             adate = adatetime.date()
             if start_date <= adate <= end_date:
                 process_jk_rmb(obj, default_user)
     print "ok"
Exemple #3
0
 def handle(self, phone, *args, **options):
     now = datetime.now()
     print "__sync xyf user tixian"
     print now
     if phone == "all":
         objs = models.XYFUserRMB.objects.filter(is_auto=True)
         tixian(objs)
     else:
         user = get_user_by_username(phone)
         if not user:
             print "no user", phone
             return
         if hasattr(user, "xyfuserrmb"):
             objs = [user.xyfuserrmb]
             tixian(objs)
     print "ok"
Exemple #4
0
 def handle(self, start, end, table, *args, **options):
     if end is None:
         end_datetime = datetime.now() - timedelta(4)
     else:
         end_datetime = utils.string_to_datetime(end, format_str="%Y-%m-%d")
     if start is None:
         start_datetime = end_datetime - timedelta(3)
     else:
         start_datetime = utils.string_to_datetime(start, format_str="%Y-%m-%d")
     start_date = start_datetime.date()
     end_date = end_datetime.date()
     # start = utils.datetime_to_string(start_date, format_str="%Y-%m-%d")
     # end = utils.datetime_to_string(end_date, format_str="%Y-%m-%d")
     print "__sync user rmb", start_date, end_date, table
     print datetime.now()
     default_user = get_user_by_username("13300000000")
     # D0
     if table in ("d0", "all"):
         used_trans_ids = set(models.ProfitD0.objects.values_list("trans_id", flat=True))
         objs = models.LKLD0.objects.filter(fee_rmb="2").filter(trans_type=u"正交易").filter(trans_status=u"成功")
         for obj in objs:
             if obj.trans_id in used_trans_ids:
                 continue
             adatetime = utils.string_to_datetime(obj.draw_date, format_str="%Y%m%d %H:%M:%S")
             adate = adatetime.date()
             if start_date <= adate <= end_date:
                 process_d0_rmb(obj, default_user)
     # D1
     if table in ("d1", "all"):
         used_trans_ids = set(models.ProfitD1.objects.values_list("trans_id", flat=True))
         objs = models.LKLD1.objects.filter(card_type=u"贷记卡")
         for obj in objs:
             if obj.trans_id in used_trans_ids:
                 continue
             adatetime = utils.string_to_datetime(obj.pay_date, format_str="%Y-%m-%d %H:%M:%S.0")
             adate = adatetime.date()
             if start_date <= adate <= end_date:
                 process_d1_rmb(obj, default_user)