class Picture(db.Document): creator = db.StringField(max_length=255, verbose_name='上传者,创建人 id') image = db.ImageField(verbose_name='图片', thumbnail_size=(200, 200, True)) img_type = db.StringField(max_length=64, verbose_name='图片type') family = db.StringField(max_length=64, verbose_name='分类') create_time = db.DateTimeField(default=datetime.datetime.now, verbose_name='创建时间') def __unicode__(self): return str(self.creator)
class TaskOrder(db.Document): openid = db.StringField(max_length=255, verbose_name='微信openid') out_trade_no = db.StringField(max_length=255, verbose_name='商户订单号') body = db.StringField(max_length=255, verbose_name='商品简单描述') total_fee = db.FloatField(verbose_name='订单总金额') pay_type = db.IntField(default=1, verbose_name='付款方式(1:微信 2:支付宝)') ischeck = db.IntField(verbose_name='支付状态(1:已支付 2:未支付)') # 已支付,未支付 1 status = db.IntField(verbose_name='当前订单状态(1:支付成功 2:支付中 4:支付失败') # 支付中,,支付成功,支付失败 create_time = db.DateTimeField(default=datetime.datetime.now, verbose_name='创建时间') betting_type = db.IntField(verbose_name='投注类型:(1:成功 2:失败)') task = db.ReferenceField(Task) def __unicode__(self): return str(self.out_trade_no)
class Task(db.Document): """ Supported fields StringField BinaryField URLField EmailField IntField FloatField DecimalField BooleanField DateTimeField ListField (using wtforms.fields.FieldList ) SortedListField (duplicate ListField) EmbeddedDocument是包含在父Document里的一组数据,没有单独的Collection。 ReferenceDocument有自己独立的Collection,引用它的Docuemnt中只包含一个Id EmbeddedDocumentField (using wtforms.fields.FormField and generating inline Form) ReferenceField (using wtforms.fields.SelectFieldBase with options loaded from QuerySet or Document) DictField """ creator_openid = db.StringField(max_length=255, verbose_name='创建人:用户在小程序中对应的 openid') title = db.StringField(max_length=255, verbose_name='标题') current_weight = db.IntField(verbose_name='当前体重') goal_weight = db.IntField(verbose_name='目标体重') task_image = db.ReferenceField(Picture, verbose_name='封面配图') dead_line = db.DateTimeField(verbose_name='挑战设定的 结束时间,到期时间') status = db.IntField( verbose_name='任务状态:(1:初始化刚、创建)( 2:进行中) (4:成功结束)(8:失败结束)') complete_time = db.DateTimeField(verbose_name='挑战实际的 结束时间,到期时间') create_time = db.DateTimeField(default=datetime.datetime.now, verbose_name='创建时间') challenge_success_betting = db.IntField(verbose_name='胜利投注总金额,单位是分') challenge_fail_betting = db.IntField(verbose_name='失败投注总金额,单位是分') meta = {'allow_inheritance': True} def __unicode__(self): return str(self.name)
class TaskRecord(db.Document): user = db.ReferenceField(User, verbose_name='哪个用户对这个挑战操作') task = db.ReferenceField(Task, verbose_name='对哪个挑战操作') record_type = db.IntField(verbose_name='时间类型:(1:投注 2:评论)') betting_type = db.IntField(verbose_name='投注类型:(1:成功 2:失败)') betting_amount = db.IntField(verbose_name='投注金额') comment = db.StringField(max_length=1024, verbose_name='评论内容') create_time = db.DateTimeField(default=datetime.datetime.now, verbose_name='创建时间') def __unicode__(self): return str(self.out_trade_no)
class User(db.Document): xcc_openid = db.StringField(verbose_name='微信对应的小程序id') tel = db.StringField(verbose_name='手机') name = db.StringField(verbose_name='姓名') sex = db.StringField(verbose_name='性别') id_card = db.StringField(verbose_name='身份证号码') province = db.StringField(verbose_name='省') city = db.StringField(verbose_name='市') area = db.StringField(verbose_name='区') address = db.StringField(verbose_name='地址') avatar = db.ReferenceField(Picture, verbose='头像') create_time = db.DateTimeField(default=datetime.datetime.now, verbose_name='创建时间') update_time = db.DateTimeField(default=datetime.datetime.now, verbose_name='更新时间') def __unicode__(self): return str(self.xcc_openid)
class Product(db.Document): name = db.StringField(max_length=255, verbose_name='商品名称') description = db.StringField(max_length=255, verbose_name='商品描述') price = db.IntField(verbose_name='价格(整数:分),注意单位是分') type = db.StringField(max_length=255, verbose_name='产品分类-一级分类') category = db.StringField(max_length=255, verbose_name='产品分类-二级分类') specification = db.ListField( db.StringField(max_length=255, verbose_name="规格")) list_swipers = db.ListField( db.EmbeddedDocumentField(OnePicture, verbose='轮播图list')) list_desc = db.ListField( db.EmbeddedDocumentField(OnePicture, verbose='详情图list')) state = db.StringField(max_length=16, default="待上架", verbose_name='商品状态:已上架,待上架,已下架') create_time = db.DateTimeField(default=datetime.datetime.now, verbose_name='创建时间') def __unicode__(self): return str(self.name)
class EFLUser(db.Document): xcc_openid = db.StringField(verbose_name='微信对应的小程序id') tel = db.StringField(verbose_name='手机') name = db.StringField(verbose_name='姓名') sex = db.StringField(verbose_name='性别') id_card = db.StringField(verbose_name='身份证号码') province = db.StringField(verbose_name='省') city = db.StringField(verbose_name='市') area = db.StringField(verbose_name='区') address = db.StringField(verbose_name='地址') avatar = db.ReferenceField(Picture, verbose='头像') create_time = db.DateTimeField(default=datetime.datetime.now, verbose_name='创建时间') update_time = db.DateTimeField(default=datetime.datetime.now, verbose_name='更新时间') height = db.StringField(verbose_name='身高') weight = db.StringField(verbose_name='体重多少?(斤/公斤)') age = db.StringField(verbose_name='年龄') big_target = db.StringField(verbose_name='健康管理目标') detail_target = db.StringField(verbose_name='减肥目标') data = db.StringField(verbose_name='体检的报告') more = db.StringField(verbose_name='多了解下您的状况') type = db.StringField(verbose_name='肥胖种类') # { 1.单纯性肥胖/ 2.遗传性肥胖 / 3.继发性肥胖} time = db.StringField(verbose_name='每周有计划的运动时间大概几分钟') activity = db.StringField(verbose_name='喜欢什么种类的运动') taocan = db.StringField(verbose_name='建 议您采用“乐盟基础个性化健康管理”套餐') shop = db.StringField(verbose_name='乐盟商城有很多适合您的健康产品与服务') informed = db.StringField(verbose_name='是否结束收集信息') def __unicode__(self): return str(self.xcc_openid)