class ComponentInfo(models.Model): """ <xml><AppId><![CDATA[wx984abb2d00cc47b8]]></AppId> <CreateTime>1427710810</CreateTime> <InfoType><![CDATA[component_verify_ticket]]></InfoType> <ComponentVerifyTicket><![CDATA[Z8RBNjttRu3P5eM8rPe9TW3dA09yuAequP1BmbHhITxs8lZ- X-Gxwaegr5lcPkfJ4VAiRLiuLlCrhKmIz-oSpw]]></ComponentVerifyTicket> </xml> <xml><AppId><![CDATA[wx984abb2d00cc47b8]]></AppId> <CreateTime>1427710810</CreateTime> <InfoType><![CDATA[component_verify_ticket]]></InfoType> <ComponentVerifyTicket><![CDATA[Z8RBNjttRu3P5eM8rPe9TW3dA09yuAequP1BmbHhITxs8lZ- X-Gxwaegr5lcPkfJ4VAiRLiuLlCrhKmIz-oSpw]]></ComponentVerifyTicket> </xml> """ app_id = models.CharField(max_length=64) app_secret = models.CharField(max_length=64) component_verify_ticket = models.TextField() token = models.TextField() ase_key = models.TextField() last_update_time = models.DateTimeField(default=datetime.now()) component_access_token = models.TextField() is_active = models.BooleanField(default=True) access_token_update_time = models.DateTimeField(default=datetime.now()) verify_ticket_update_time = models.DateTimeField(default=datetime.now()) def __unicode__(self): return self.app_id class Meta(object): db_table = 'component_info' verbose_name = '第三方帐号信息' verbose_name_plural = '第三方帐号信息'
class ComponentAuthedAppid(models.Model): """ 参数 说明 authorization_info 授权信息 authorizer_appid 授权方appid authorizer_access_token 授权方令牌(在授权的公众号具备API权限时,才有此返回值) expires_in 有效期(在授权的公众号具备API权限时,才有此返回值) authorizer_refresh_token 刷新令牌(在授权的公众号具备API权限时,才有此返回值),刷新令牌主要用于公众号第三方平台获取和刷新已授权用户的access_token,只会在授权时刻提供,请妥善保存。 一旦丢失,只能让用户重新授权,才能再次拿到新的刷新令牌 func_info 公众号授权给开发者的权限集列表(请注意,当出现用户已经将消息与菜单权限集授权给了某个第三方,再授权给另一个第三方时,由于该权限集是互斥的,后一个第三方的授权将去除此权限集,开发者可以在返回的func_info信息中验证这一点,避免信息遗漏), 1到8分别代表: 1消息与菜单权限集 2用户管理权限集 3帐号管理权限集 4网页授权权限集 5微信小店权限集 6多客服权限集 7业务通知权限集 8微信卡券权限集 """ component_info = models.ForeignKey(ComponentInfo) auth_code = models.TextField(default='') user_id = models.IntegerField(default=0) #对应帐号user id last_update_time = models.DateTimeField(default=datetime.now()) authorizer_appid = models.CharField(max_length=255, default='') authorizer_access_token = models.TextField(default='') authorizer_refresh_token = models.TextField(default='') func_info = models.TextField(default='') created_at = models.DateTimeField(auto_now=True) is_active = models.BooleanField(default=False) class Meta(object): db_table = 'component_authed_appid' verbose_name = '委托授权帐号基本信息' verbose_name_plural = '委托授权帐号基本信息'
class Session(models.Model): mpuser = models.ForeignKey(WeixinMpUser, related_name='owned_sessions') weixin_user = models.ForeignKey(WeixinUser, to_field='username', db_column='weixin_user_username') latest_contact_content = models.CharField(max_length=1024) #最后一次交互消息内容 latest_contact_created_at = models.DateTimeField( auto_now_add=True) #最后一次交互时间 is_latest_contact_by_viper = models.BooleanField( default=False) #最后一次交互是否是客户发出的 unread_count = models.IntegerField(default=0) #未读消息数 is_show = models.BooleanField(default=False) #是否显示(是否填充对应的WeixinUser) created_at = models.DateTimeField(auto_now_add=True) weixin_created_at = models.CharField(max_length=50) #微信平台提供的创建时间 retry_count = models.IntegerField(default=0) #重試次數 #add by bert at 20.0 message_id = models.IntegerField(default=0) #add by slzhu member_user_username = models.CharField(default='', max_length=100) member_message_id = models.IntegerField(default=0) member_latest_content = models.CharField(default='', max_length=1024) #粉丝最近一条消息 member_latest_created_at = models.CharField(default='', max_length=50) #粉丝最近一条消息时间 is_replied = models.BooleanField(default=False) #是否回复过 class Meta(object): ordering = ['-latest_contact_created_at'] db_table = 'weixin_message_session'
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 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 ForbiddenCouponProduct(models.Model): owner = models.ForeignKey(User) product = models.ForeignKey(mall_models.Product) status = models.IntegerField(default=FORBIDDEN_STATUS_NOT_START) #促销状态 start_date = models.DateTimeField() #开始日期 end_date = models.DateTimeField() #结束日期 is_permanant_active = models.BooleanField(default=False) #永久有效 created_at = models.DateTimeField(auto_now_add=True) #添加时间 class Meta(object): db_table = 'mall_forbidden_coupon_product'
class TemplateGlobalNavbar(models.Model): ''' 全局导航 ''' owner = models.ForeignKey(User, related_name='owned_template_global_navbar') is_enable = models.BooleanField(default=True, verbose_name='是否启用') content = models.TextField(default='', verbose_name='navbar的json字符串') created_at = models.DateTimeField(auto_now_add=True, verbose_name="创建时间") updated_at = models.DateTimeField(auto_now=True, verbose_name="修改时间") class Meta(object): db_table = 'template_global_navbar'
class Member(models.Model): """ 会员 """ token = models.CharField(max_length=255) webapp_id = models.CharField(max_length=16) username_hexstr = models.CharField(max_length=2048, verbose_name='会员名称的hex str') user_icon = models.CharField(max_length=1024, verbose_name='会员头像', default='') integral = models.IntegerField(default=0, verbose_name='积分') created_at = models.DateTimeField(auto_now_add=True) grade = models.ForeignKey(MemberGrade) experience = models.IntegerField(default=0, verbose_name='经验值') remarks_name = models.CharField(max_length=32, verbose_name='备注名', default='') remarks_extra = models.TextField(verbose_name='备注信息', default='') last_visit_time = models.DateTimeField(auto_now_add=True) last_message_id = models.IntegerField(default=-1, verbose_name="最近一条消息id") session_id = models.IntegerField(default=-1, verbose_name="会话id") is_for_test = models.BooleanField(default=False) is_subscribed = models.BooleanField(default=True) friend_count = models.IntegerField(default=0) #好友数量 factor = models.FloatField(default=0.00) #社会因子 source = models.IntegerField(default=-1) #会员来源 is_for_buy_test = models.BooleanField(default=False) update_time = models.DateTimeField( default=datetime.now()) #会员信息更新时间 2014-11-11 pay_money = models.FloatField(default=0.0) pay_times = models.IntegerField(default=0) last_pay_time = models.DateTimeField(default=None) #会员信息更新时间 2014-11-11 unit_price = models.FloatField(default=0.0) #ke dan jia city = models.CharField(default='', max_length=50) province = models.CharField(default='', max_length=50) country = models.CharField(default='', max_length=50) sex = models.IntegerField(default=0, verbose_name='性别') status = models.IntegerField(default=1) purchase_frequency = models.IntegerField(default=0) # 30天购买次数 cancel_subscribe_time = models.DateTimeField(blank=True, null=True, default=None, verbose_name="取消关注时间") fans_count = models.IntegerField(default=0) #粉丝数量 class Meta(object): db_table = 'member_member' def __unicode__(self): return u'<member: %s %s>' % (self.webapp_id, self.token)
class ExportJob(models.Model): woid = models.IntegerField() type = models.IntegerField(default=0) status = models.BooleanField(default=False) # 其实是表示是否完成的bool processed_count = models.IntegerField() # 已处理数量 count = models.IntegerField() # 总数量 is_download = models.BooleanField(default=False, verbose_name='是否下载') param = models.CharField(max_length=1024) file_path = models.CharField(max_length=256) update_at = models.DateTimeField(verbose_name='更新时间', auto_now=True) created_at = models.DateTimeField(verbose_name='创建时间') class Meta(object): db_table = 'export_job'
class AccessToken(models.Model): """ 【Gaia用】存储access token (Weapp不应访问此库) """ access_token = models.CharField( max_length=50, unique=True) # unique implies the creation of an index corp_id = models.CharField(max_length=50, default='') used_count = models.IntegerField(default=0) # 使用过次数 created_at = models.DateTimeField(auto_now_add=True) expire_time = models.DateTimeField() # 失效时间 app = models.ForeignKey(GaiaApp) is_active = models.BooleanField(default=True) class Meta(object): db_table = "access_token"
class TengyiRebateLog(models.Model): """ 腾易微众星级会员返利记录表 """ member_id = models.IntegerField(default=0) is_self_order = models.BooleanField(default=False) #是否自己的订单返利 supply_member_id = models.IntegerField(default=0) #返利会员id is_exchanged = models.BooleanField(default=False) #是否已返利 exchanged_at = models.DateTimeField(default=datetime.strptime( '2000-01-01', '%Y-%m-%d')) #返利时间 rebate_money = models.FloatField(default=0) #返利金额 created_at = models.DateTimeField(auto_now_add=True) class Meta(object): db_table = 'tengyi_rebate_log'
class ExpressDetail(models.Model): order_id = models.IntegerField(verbose_name="订单id,以后暂不使用", default=-1) express_id = models.IntegerField(verbose_name="快递id", default=-1) context = models.CharField(max_length=1024, verbose_name="内容") status = models.CharField(max_length=50, verbose_name="状态") time = models.DateTimeField(verbose_name="时间,原始格式") ftime = models.CharField(max_length=50, verbose_name="格式化后时间") display_index = models.IntegerField(default=1, db_index=True, verbose_name="显示的排序") created_at = models.DateTimeField(auto_now_add=True, verbose_name="创建时间") class Meta(object): db_table = 'tool_express_detail' verbose_name = '快递明细' verbose_name_plural = '快递明细'
class MemberCardPayOrder(models.Model): """ 会员卡支付订单 duhao """ owner_id = models.IntegerField() #商家id member_id = models.IntegerField() #会员id batch_id = models.CharField(max_length=50, default="") #微众卡批次id order_id = models.CharField(max_length=50) #支付订单id batch_name = models.CharField(max_length=200) #会员卡名称 price = models.FloatField(default=0.0) #支付金额 is_paid = models.BooleanField(default=False) #是否支付成功 created_at = models.DateTimeField(auto_now_add=True) #创建时间 paid_at = models.DateTimeField(null=True) #支付时间 class Meta(object): db_table = 'member_card_pay_order'
class TengyiMemberRebateCycle(models.Model): """ 腾易微众星级会员推荐返利周期 """ member_id = models.IntegerField(default=0) start_time = models.DateTimeField() end_time = models.DateTimeField() is_receive_reward = models.BooleanField(default=False) #是否已获得购物返利 receive_reward_at = models.DateTimeField( default=DEFAULT_DATETIME) #获得推荐返利时间 is_recommend_member_receive_reward = models.BooleanField( default=False) #是否被推荐人已获得推荐返利 recommend_member_rebate_money = models.FloatField(default=0) #推荐人返利金额 created_at = models.DateTimeField(auto_now_add=True) class Meta(object): db_table = 'tengyi_member_rebate_cycle'
class Promotion(models.Model): """ 促销活动 """ owner = models.ForeignKey(User) name = models.CharField(max_length=256) #活动名 promotion_title = models.CharField(max_length=256) #促销标题 status = models.IntegerField(default=PROMOTION_STATUS_NOT_START) #促销状态 start_date = models.DateTimeField() #开始日期 end_date = models.DateTimeField() #结束日期 type = models.IntegerField() #促销类型 detail_id = models.IntegerField(default=0) #促销数据id member_grade_id = models.IntegerField(default=0) #会员等级 created_at = models.DateTimeField(auto_now_add=True) #添加时间 class Meta(object): db_table = 'mallpromotion_promotion'
class ExpressHasOrderPushStatus(models.Model): order_id = models.IntegerField(verbose_name="订单id,以后暂不使用", default=-1) express_company_name = models.CharField(max_length=50, default='', verbose_name="快递公司名称") express_number = models.CharField(max_length=100, verbose_name="快递单号") status = models.IntegerField(default=EXPRESS_PULL_NOT_STATUS, verbose_name="状态") send_count = models.IntegerField(default=0, verbose_name="发送订阅请求次数") receive_count = models.IntegerField(default=0, verbose_name="接收推送请求次数") created_at = models.DateTimeField(auto_now_add=True, verbose_name="创建时间") # 重新订阅的依据信息(当重推后,该两字段的信息,将被清空) # abort_receive_at: 第一次接收 失败信息的时间 # abort_receive_message 第一次接收 "status":"abort"而且message中包含“3天”关键字的数据 abort_receive_at = models.DateTimeField(null=True, blank=True, verbose_name="接收信息时间") abort_receive_message = models.TextField(verbose_name="接收的信息") service_type = models.IntegerField(default=0, verbose_name="快递服务类型") webapp_id = models.CharField(max_length=20, default='', db_index=True, verbose_name='店铺ID') # webapp class Meta(object): db_table = 'tool_express_has_order_push_status' verbose_name = '订单的推送状态' verbose_name_plural = '订单的推送状态' @staticmethod def get(id): express = ExpressHasOrderPushStatus.objects.filter(id=id) if express.count() > 0: return express[0] else: return None @staticmethod def get_by_order(order): express = ExpressHasOrderPushStatus.objects.filter( express_company_name=order.express_company_name, express_number=order.express_number) if express.count() > 0: return express[0] else: return None
class PageVisitLog(models.Model): webapp_id = models.CharField(max_length=16) token = models.CharField(max_length=64, blank=True) url = models.CharField(max_length=1024) is_from_mobile_phone = models.BooleanField() create_date = models.DateField(auto_now_add=True) #访问日期 created_at = models.DateTimeField(auto_now_add=True) #访问时间 class Meta(object): db_table = 'webapp_page_visit_log'
class VirtualProductHasCode(models.Model): """ 福利卡券活动关联的卡券码 """ owner = models.ForeignKey(User) virtual_product = models.ForeignKey(VirtualProduct) code = models.CharField(max_length=128) #卡号 password = models.CharField(max_length=512) #密码 start_time = models.DateTimeField() #有效期起始时间 end_time = models.DateTimeField() #有效期结束时间 status = models.IntegerField(default=CODE_STATUS_NOT_GET) #状态 get_time = models.DateTimeField(null=True) #领取/发放时间 member_id = models.CharField(max_length=20, default='') #会员id oid = models.CharField(max_length=20, default='') #订单id order_id = models.CharField(max_length=35, default='') #订单order_id created_at = models.DateTimeField(auto_now_add=True) #创建时间 class Meta(object): db_table = 'mallpromotion_virtual_product_has_code'
class MemberBrowseRecord(models.Model): member = models.ForeignKey(Member) title = models.CharField(max_length=256, default='') #页面标题 url = models.TextField() created_at = models.DateTimeField(auto_now_add=True) class Meta(object): db_table = 'member_browse_record' verbose_name = '会员浏览记录' verbose_name_plural = '会员浏览记录'
class Coupon(models.Model): """ 优惠券 """ owner = models.ForeignKey(User) coupon_rule = models.ForeignKey(CouponRule) #coupon rule member_id = models.IntegerField(default=0) #优惠券分配的member的id coupon_record_id = models.IntegerField(default=0) #优惠券记录的id status = models.IntegerField(default=COUPON_STATUS_UNUSED) #优惠券状态 coupon_id = models.CharField(max_length=50) #优惠券号 provided_time = models.DateTimeField(default=DEFAULT_DATETIME) #领取时间 start_time = models.DateTimeField() #优惠券有效期开始时间 expired_time = models.DateTimeField() #过期时间 money = models.FloatField() #金额 is_manual_generated = models.BooleanField(default=False) #是否手工生成 created_at = models.DateTimeField(auto_now_add=True) #添加时间 class Meta(object): db_table = 'market_tool_coupon'
class AdClicked(models.Model): """ 广告点击 """ member_id = models.IntegerField() #会员id type = models.IntegerField(default=VIP_PAGE) #页面 created_at = models.DateTimeField(auto_now_add=True) #时间 class Meta(object): db_table = 'ad_clicked'
class TengyiMemberRelation(models.Model): """ 腾易微众星级会员推荐关系表(待成为星级会员) """ member_id = models.IntegerField(default=0) recommend_by_member_id = models.IntegerField(default=0) # 推荐人id created_at = models.DateTimeField(auto_now_add=True) class Meta(object): db_table = 'tengyi_member_relation'
class User(models.Model): """ 从django.contrib.auth.User迁移过来 """ username = models.CharField(max_length=30) first_name = models.CharField(max_length=30, default='') last_name = models.CharField(max_length=30, default='') email = models.EmailField(default='') is_staff = models.BooleanField(default=False) is_active = models.BooleanField(default=True) is_superuser = models.BooleanField(default=False) password = models.CharField(max_length=120) date_joined = models.DateTimeField(default=datetime.datetime.now) last_login = models.DateTimeField(default=datetime.datetime.now) class Meta: db_table = 'auth_user' verbose_name = 'user' verbose_name_plural = 'users'
class UserOrderNotifySettings(models.Model): user = models.ForeignKey(User) emails = models.TextField(default='') # '|'分割 black_member_ids = models.TextField(default='') # '|'分割,会员id status = models.IntegerField(default=0) is_active = models.BooleanField(default=False) created_at = models.DateTimeField(auto_now_add=True) class Meta(object): db_table = 'user_order_notify_setting'
class WantToBuy(models.Model): """ 我想买 """ owner_id = models.IntegerField() #商家id member = models.ForeignKey(Member) source = models.IntegerField(default=SOURCE_JD) #来源 product_id = models.IntegerField(default=0) #上架后的商品id,预留字段 product_name = models.CharField(max_length=128) #商品名称 status = models.IntegerField(default=STATUS_NOT_REACH) #状态 support_num = models.IntegerField(default=0) #支持人数 pics = models.CharField(max_length=1024) #图片 is_accept_other_brand = models.BooleanField(default=True) #是否接受同类其他品牌 reach_num_at = models.DateTimeField(null=True) #人气达标时间 purchase_completed_at = models.DateTimeField(null=True) #采购完成时间 shelves_on_at = models.DateTimeField(null=True) #上架时间 created_at = models.DateTimeField(auto_now_add=True) #创建时间 class Meta(object): db_table = 'member_want_to_buy'
class WantToBuySupport(models.Model): """ 我想买支持记录 """ want_to_buy = models.ForeignKey(WantToBuy) member = models.ForeignKey(Member) content = models.CharField(max_length=512) #支持内容 created_at = models.DateTimeField(auto_now_add=True) #创建时间 class Meta(object): db_table = 'member_want_to_buy_support'
class AccountHasWeizoomCardPermissions(models.Model): """ 账号对应使用微众卡功能权限 """ owner_id = models.IntegerField(default=0, verbose_name='账号id') is_can_use_weizoom_card = models.BooleanField(default=False, verbose_name='是否可以使用微众卡') created_at = models.DateTimeField(auto_now_add=True, verbose_name='添加时间') class Meta(object): db_table = 'market_tool_weizoom_card_account_has_permissions'
class Material(models.Model): owner = models.ForeignKey(User, related_name='owned_materials') type = models.IntegerField(default=SINGLE_NEWS_TYPE, choices=MATERIAL_TYPES) created_at = models.DateTimeField(auto_now_add=True) is_deleted = models.BooleanField(default=False) #是否删除 class Meta(object): db_table = 'material_material' verbose_name = '素材' verbose_name_plural = '素材'
class MemberClickedUrl(models.Model): url = models.CharField(max_length=1024) url_digest = models.CharField(max_length=32) #md5 mid = models.IntegerField() followed_mid = models.IntegerField() created_at = models.DateTimeField(auto_now_add=True) class Meta(object): db_table = 'member_clicked_url' verbose_name = '会员url点击记录' verbose_name_plural = '会员url点击记录'