class WeizoomCardRule(models.Model): """ 微众卡规则 """ owner = models.ForeignKey(User) name = models.CharField(max_length=20, db_index=True) #名称 money = models.DecimalField(max_digits=65, decimal_places=2) #微众卡金额 count = models.IntegerField(default=0) #发放总数量 remark = models.CharField(max_length=20, db_index=True) #备注 expired_time = models.DateTimeField() #过期时间 valid_time_from = models.DateTimeField() #有效范围开始时间 valid_time_to = models.DateTimeField() #有效范围结束时间 created_at = models.DateTimeField(auto_now_add=True) #添加时间 card_type = models.IntegerField(default=WEIZOOM_CARD_EXTERNAL_USER) #微众卡类型 card_attr = models.IntegerField(default=0) #微众卡属性 shop_limit_list = models.CharField(max_length=2048, default='-1') #专属商家 shop_black_list = models.CharField(max_length=2048, default='-1') #不能使用微众卡的商家 is_new_member_special = models.BooleanField(default=False) #是否为新会员专属卡 valid_restrictions = models.DecimalField(max_digits=65, decimal_places=2) #订单满多少可以使用规则 class Meta(object): db_table = 'market_tool_weizoom_card_rule' verbose_name = '微众卡规则' verbose_name_plural = '微众卡规则'
class CouponRule(models.Model): """ 优惠券规则 """ owner = models.ForeignKey(User) name = models.CharField(max_length=20) #名称 valid_days = models.IntegerField(default=0) #过期天数 is_active = models.BooleanField(default=True) #是否可用 created_at = models.DateTimeField(auto_now_add=True) #添加时间 start_date = models.DateTimeField() #有效期开始时间 end_date = models.DateTimeField() #有效期结束时间 # v2 valid_restrictions = models.IntegerField(default=-1) #订单满多少可以使用规则 money = models.DecimalField() #金额 count = models.IntegerField(default=0) #发放总数量 remained_count = models.IntegerField(default=0) #剩余数量 limit_counts = models.IntegerField(default=0) #每人限领 limit_product = models.BooleanField(default=False) #限制指定商品 limit_product_id = models.CharField(max_length=2048, default=0) #限制指定商品ID remark = models.TextField(default='') #备注 get_person_count = models.IntegerField(default=0) #领取人数 get_count = models.IntegerField(default=0) #领取次数 use_count = models.IntegerField(default=0) #使用次数 receive_rule = models.BooleanField(default=False) #领取规则,仅未下单用户可领取 class Meta(object): db_table = 'market_tool_coupon_rule'
class WeizoomCard(models.Model): """ 微众卡存储模型 @note WeizoomCardHasAccount.account.id即owner_id """ owner = models.ForeignKey(User) target_user_id = models.IntegerField(default=0, verbose_name="微众卡发放目标") weizoom_card_rule = models.ForeignKey(WeizoomCardRule) status = models.IntegerField(default=WEIZOOM_CARD_STATUS_INACTIVE) #微众卡状态 weizoom_card_id = models.CharField(max_length=50) #微众卡号 money = models.DecimalField(max_digits=65, decimal_places=2) #剩余金额 password = models.CharField(max_length=50) #微众卡密码 expired_time = models.DateTimeField() #过期时间 is_expired = models.BooleanField(default=False) #是否过期 activated_at = models.DateTimeField(null=True) #激活时间 created_at = models.DateTimeField(auto_now_add=True) #添加时间 remark = models.CharField(max_length=20, db_index=True) #备注 activated_to = models.CharField(max_length=20) #申请人 department = models.CharField(max_length=20) #申请部门 active_card_user_id = models.IntegerField(default=1) #激活卡片人 class Meta(object): db_table = 'market_tool_weizoom_card' verbose_name = '微众卡' verbose_name_plural = '微众卡'
class ChannelDistributionQrcodeSettings(models.Model): """ 渠道分销二维码 """ owner = models.ForeignKey(User) # 所有者? bing_member_title = models.CharField(max_length=512) # 关联会员头衔 award_prize_info = models.TextField( default='{"id":-1,"name":"no-prize"}') # 关注奖励,奖品信息 reply_type = models.IntegerField(default=0) # 扫码后行为:0普通关注一致,1回复文字,2回复图文 reply_detail = models.TextField(default='') # 回复文字, 当reply_type为1时有效 reply_material_id = models.IntegerField( default=0) # 图文id,reply_type为2时有效 ? coupon_ids = models.TextField() # 配置过的优惠券id集合 bing_member_id = models.IntegerField(default=0) # 关联会员:创建二维码时选择关联的会员的ID return_standard = models.IntegerField(default=0) # 多少天结算标准 group_id = models.IntegerField(default=-1) # 会员分组 distribution_rewards = models.BooleanField( default=False) # 分销奖励 False:没有 True:佣金 commission_rate = models.IntegerField() # 佣金返现率 minimun_return_rate = models.IntegerField() # 最低返现折扣 commission_return_standard = models.DecimalField( max_digits=65, decimal_places=2) # 佣金返现标准 ticket = models.CharField(default='', max_length=256) # ticket bing_member_count = models.IntegerField(default=0) # 关注数量,该二维码下边的关注人数 total_transaction_volume = models.DecimalField( max_digits=65, decimal_places=2, default=0) # 总交易额:二维码自创建以来的所有交易额 total_return = models.DecimalField( max_digits=65, decimal_places=2, default=0) # 返现总额: 二维码所有的返现总额, 只包含已经体现的金额 will_return_reward = models.DecimalField(max_digits=65, decimal_places=2, default=0) # 实施奖励 created_at = models.DateTimeField(auto_now_add=True) # 添加时间 class Meta: db_table = 'market_tool_channel_distribution_qrcode_setting'
class WeizoomCardHasOrder(models.Model): owner_id = models.IntegerField() #商家 card_id = models.IntegerField() #weizoom card id order_id = models.CharField(max_length=50, default='-1') #订单号 order_id == -1 是积分兑换 money = models.DecimalField(max_digits=65, decimal_places=2) #金额 created_at = models.DateTimeField(auto_now_add=True) #添加时间 event_type = models.CharField(max_length=64, verbose_name='事件类型') member_integral_log_id = models.IntegerField(default=0, verbose_name='积分日志id') trade_id = models.CharField(max_length=100, default='') # 交易号 card_code = models.CharField(max_length=50, default='') # 微众卡号 class Meta(object): db_table = 'market_tool_weizoom_card_has_order' verbose_name = '微众卡支付交易记录' verbose_name_plural = '微众卡支付交易记录'
class RedEnvelopeRule(models.Model): """ 红包规则 """ owner = models.ForeignKey(User) name = models.CharField(max_length=128) coupon_rule_id = models.IntegerField(default=0) limit_time = models.BooleanField(default=False) start_time = models.DateTimeField(default=DEFAULT_DATETIME) end_time = models.DateTimeField(default=DEFAULT_DATETIME) limit_order_money = models.DecimalField(default=0.0) use_info = models.TextField() share_title = models.CharField(max_length=256) share_pic = models.CharField(max_length=256) is_delete = models.BooleanField(default=False) status = models.BooleanField(default=False) #状态默认关闭 receive_method = models.BooleanField(default=False) #领取方式默认为下单领取 order_index = models.IntegerField(default=0) #记录排序,置后为-1 created_at = models.DateTimeField(auto_now_add=True) class Meta(object): db_table = 'mall_red_envelope_rule'