暂无描述

models.py 3.5KB

    # -*- coding: utf-8 -*- from django.db import models from django.utils.translation import ugettext_lazy as _ from django_models_ext import BaseModelMixin from shortuuidfield import ShortUUIDField from jsonfield import JSONField from TimeConvert import TimeConvert as tc 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, u'待支付'), (PAID, u'已支付'), (FAIL, u'已失败'), # (DELETED, u'已删除'), ) order_id = ShortUUIDField(_(u'order_id'), max_length=32, help_text=u'订单唯一标识', db_index=True) prepay_id = models.CharField(_(u'prepay_id'), max_length=64, blank=True, null=True, help_text=u'预支付交易会话标识') transaction_id = models.CharField(_(u'transaction_id'), max_length=32, blank=True, null=True, help_text=u'交易单号') pack_id = models.CharField(_(u'pack_id'), max_length=32, blank=True, null=True, help_text=u'包唯一标识', db_index=True) goods_info = JSONField(_('goods_info'), default=[], blank=True, null=True, help_text='商品信息') user_id = models.CharField(_(u'kol_id'), max_length=32, blank=True, null=True, help_text=u'用户唯一标识', db_index=True) kol_id = models.CharField(_(u'kol_id'), max_length=32, blank=True, null=True, help_text=u'kol_id唯一标识', db_index=True) body = models.CharField(_(u'body'), max_length=255, blank=True, null=True, help_text=u'商品描述') total_fee = models.IntegerField(_(u'total_fee'), default=0, help_text=u'总金额') name = models.CharField(_(u'name'), max_length=255, blank=True, null=True, help_text=u'姓名') phone = models.CharField(_(u'phone'), max_length=255, blank=True, null=True, help_text=u'电话') address = models.CharField(_(u'address'), max_length=255, blank=True, null=True, help_text=u'地址') tracking_number = models.CharField(_(u'tracking_number'), max_length=255, blank=True, null=True, help_text=u'快递单号') has_send_template_message = models.BooleanField(_(u'has_send_template_message'), default=True, help_text=u'是否已发送模版消息', db_index=True) trade_type = models.CharField(_(u'trade_type'), max_length=255, blank=True, null=True, help_text=u'支付方式') pay_status = models.IntegerField(_(u'pay_status'), choices=PAY_STATUS, default=WAITING_PAY, help_text=u'支付状态', db_index=True) paid_at = models.DateTimeField(_(u'paid_at'), blank=True, null=True, help_text=_(u'支付时间')) reback_status = models.BooleanField(_(u'reback_status'), default=False, help_text=u'退款状态', db_index=True) reback_at = models.DateTimeField(_(u'reback_at'), blank=True, null=True, help_text=_(u'退款时间')) # 微信统一下单 unifiedorder_result = models.TextField(_(u'unifiedorder_result'), blank=True, null=True, help_text=_(u'统一下单结果')) # 微信支付回调 notify_msg = models.TextField(_(u'notify_msg'), blank=True, null=True, help_text=u'回调信息') class Meta: verbose_name = _(u'订单信息') verbose_name_plural = _(u'订单信息') def __unicode__(self): return u'{0.pk}'.format(self)