# -*- coding: utf-8 -*-
# @Time    : 2020/3/25 5:38 PM
# @Author  : hexy

# coding:utf-8
from __future__ import unicode_literals


from django.core.management import BaseCommand
from pay.tool.refund_tool import RefundTool


# 使用方式 python manage.py do_repeat_refund

# crontab
# */10 * * * * python manage.py do_repeat_refund >> repeat_refund.txt 2>&1 &

class Command(BaseCommand):

    def handle(self, *args, **options):
        print '*******开始退款任务-{0}*******'.format(RefundTool.now_time())
        print '需要执行退款订单数量:{0}'.format(len(RefundTool.get_refund_fial_orders()))
        RefundTool.do_refund_fial_orders()
        print '*******结束退款任务-{0}*******\n'.format(RefundTool.now_time())
