Keine Beschreibung

models.py 3.4KB

    # -*- coding: utf-8 -*- from django.db import models from django.utils.translation import ugettext_lazy as _ from django_models_ext import BaseModelMixin from jsonfield import JSONField from shortuuidfield import ShortUUIDField class OrderInfo(BaseModelMixin): """ # Trade State of Wechat Query SUCCESS ——— 支付成功 REFUND ——— 转入退款 NOTPAY ——— 未支付 CLOSED ——— 已关闭 REVOKED ——— 已撤销(刷卡支付) USERPAYING ——— 用户支付中 PAYERROR ——— 支付失败(其他原因,如银行返回失败) """ WAITING_PAY = 0 PAID = 1 FAIL = 2 # DELETED = 9 PAY_STATUS = ( (WAITING_PAY, '待支付'), (PAID, '已支付'), (FAIL, '已失败'), # (DELETED, '已删除'), ) order_id = ShortUUIDField(_('order_id'), max_length=32, help_text='订单唯一标识', db_index=True) prepay_id = models.CharField(_('prepay_id'), max_length=64, blank=True, null=True, help_text='预支付交易会话标识') transaction_id = models.CharField(_('transaction_id'), max_length=32, blank=True, null=True, help_text='交易单号') pack_id = models.CharField(_('pack_id'), max_length=32, blank=True, null=True, help_text='包唯一标识', db_index=True) goods_info = JSONField(_('goods_info'), default=[], blank=True, null=True, help_text='商品信息') user_id = models.CharField(_('user_id'), max_length=32, blank=True, null=True, help_text='用户唯一标识', db_index=True) kol_id = models.CharField(_('kol_id'), max_length=32, blank=True, null=True, help_text='kol_id唯一标识', db_index=True) body = models.CharField(_('body'), max_length=255, blank=True, null=True, help_text='商品描述') total_fee = models.IntegerField(_('total_fee'), default=0, help_text='总金额') name = models.CharField(_('name'), max_length=255, blank=True, null=True, help_text='姓名') phone = models.CharField(_('phone'), max_length=255, blank=True, null=True, help_text='电话') address = models.CharField(_('address'), max_length=255, blank=True, null=True, help_text='地址') tracking_number = models.CharField(_('tracking_number'), max_length=255, blank=True, null=True, help_text='快递单号') has_send_template_message = models.BooleanField(_('has_send_template_message'), default=True, help_text='是否已发送模版消息', db_index=True) trade_type = models.CharField(_('trade_type'), max_length=255, blank=True, null=True, help_text='支付方式') pay_status = models.IntegerField(_('pay_status'), choices=PAY_STATUS, default=WAITING_PAY, help_text='支付状态', db_index=True) paid_at = models.DateTimeField(_('paid_at'), blank=True, null=True, help_text=_('支付时间')) reback_status = models.BooleanField(_('reback_status'), default=False, help_text='退款状态', db_index=True) reback_at = models.DateTimeField(_('reback_at'), blank=True, null=True, help_text=_('退款时间')) # 微信统一下单 unifiedorder_result = models.TextField(_('unifiedorder_result'), blank=True, null=True, help_text=_('统一下单结果')) # 微信支付回调 notify_msg = models.TextField(_('notify_msg'), blank=True, null=True, help_text='回调信息') class Meta: verbose_name = _('订单信息') verbose_name_plural = _('订单信息') def __unicode__(self): return self.pk