expire_payments.py 文件源码

python
阅读 18 收藏 0 点赞 0 评论 0

项目:ccvpn3 作者: CCrypto 项目源码 文件源码
def handle(self, *args, **options):
        now = timezone.now()
        expdate = now - parse_duration(options['exp_time'])

        self.stdout.write("Now: " + now.isoformat())
        self.stdout.write("Exp: " + expdate.isoformat())

        expired = Payment.objects.filter(created__lte=expdate, status='new',
                                         paid_amount=0)

        for p in expired:
            self.stdout.write("Payment #%d (%s): %s" % (p.id, p.user.username, p.created))
            if not options['sim']:
                p.status = 'cancelled'
                p.save()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号