class Domain(db.Model): __tablename__ = "domain" Id = db.Column(db.Integer, primary_key=True) DomainName = db.Column(db.VARCHAR(255)) OwnerUserId = db.Column(db.Integer, db.ForeignKey('user.Id')) ExpireTime = db.Column(db.DateTime) CreateTime = db.Column(db.TIMESTAMP) Alipay = db.Column(db.VARCHAR(50)) Status = db.Column(db.INT) ShowType = db.Column(db.INT) CompanyName = db.Column(db.VARCHAR(255)) CompanyAddr = db.Column(db.VARCHAR(1024)) CompanyLicense = db.Column(db.VARCHAR(50)) CompanyPhone = db.Column(db.VARCHAR(15)) CompanyCelPhone = db.Column(db.VARCHAR(15)) CompanyFax = db.Column(db.VARCHAR(20)) CompanyEmail = db.Column(db.VARCHAR(100)) CompanyLicAttachment = db.Column(db.VARCHAR(255)) IsService = db.Column(db.BOOLEAN) UsedSize = db.Column(db.BIGINT) Intro = db.Column(db.VARCHAR(1024)) StarLevel = db.Column(db.INT) ZoneName = db.Column(db.VARCHAR(255)) Focus = db.Column(db.INT) Level = db.Column(db.INT) Work = db.Column(db.INT) Trade = db.Column(db.INT) Count = db.Column(db.FLOAT) DefaultStorageSize = db.Column(db.BIGINT) ExtendStorageSize = db.Column(db.BIGINT) ESExpireTime = db.Column(db.DATETIME) MembershipTax = db.Column(db.BIGINT) Price = db.Column(db.FLOAT) Portrait = db.Column(db.VARCHAR(255)) Weight = db.Column(db.FLOAT) ZoneBanner = db.Column(db.VARCHAR(255)) Users = db.relationship('User', backref=db.backref('Domain', lazy='joined', uselist=False), lazy='dynamic', foreign_keys='User.DomainId') def __init__(self, DomainName, OwnerUserId): self.DomainName = DomainName + '\'s' # + '\'s family' self.OwnerUserId = OwnerUserId self.IsService = 0 self.Status = DomainStatus.init self.ShowType = 0 self.CompanyName = DomainName self.ExtendStorageSize = 0 self.ExpireTime = datetime.datetime.now() self.ESExpireTime = datetime.datetime.now() self.Intro = 'intro' self.Portrait = '/image/contacts.png' self.Trade = 0 self.Focus = 0 self.Price = 0 self.Weight = 0 self.Count = 0 def __repr__(self): return '<Domain %r>' % {'Id': self.Id, 'DomainName': self.DomainName}
class Object(db.Model): __tablename__ = "object" Id = db.Column(db.Integer, primary_key=True) OwnerUserId = db.Column(db.Integer) FileId = db.Column(db.Integer, db.ForeignKey("file.Id")) CreatorUserId = db.Column(db.Integer) _Left_ = db.Column(db.Integer) _Right_ = db.Column(db.Integer) Name = db.Column(db.String(255)) Extend = db.Column(db.String(255)) Remark = db.Column(db.String(255)) Type = db.Column(db.String(255)) Status = db.Column(db.Integer) ParentId = db.Column(db.Integer, db.ForeignKey("object.Id")) Size = db.Column(db.Integer) ModifyTime = db.Column(db.TIMESTAMP) CreateTime = db.Column(db.TIMESTAMP) Description = db.Column(db.String(1000)) Camera = db.Column(db.String(255)) Script = db.Column(db.String(255)) Category_1 = db.Column(db.INT) Category_2 = db.Column(db.INT) Tag = db.Column(db.VARCHAR(255)) BShare = db.Column(db.BOOLEAN) ReferPrice = db.Column(db.FLOAT) BasePrice = db.Column(db.FLOAT) SchemePrice = db.Column(db.FLOAT) ShotPrice = db.Column(db.FLOAT) MusicPrice = db.Column(db.FLOAT) ActorPrice = db.Column(db.FLOAT) AEPrice = db.Column(db.FLOAT) Price = db.Column(db.FLOAT) #竞价金额 File = db.relationship('File', backref=db.backref('Objects', lazy='dynamic'), lazy='joined') Parent = db.relationship('Object', backref=db.backref('Children', lazy='dynamic'), remote_side=[Id], uselist=False) def __init__(self, Name, _Left_, _Right_, ParentId, OwnerUserId, CreatorUserId, Size): self.Name = Name self._Left_ = _Left_ self._Right_ = _Right_ self.ParentId = ParentId self.CreatorUserId = CreatorUserId self.OwnerUserId = OwnerUserId self.Size = Size self.ReferPrice = 0 self.BShare = 0 self.BasePrice = 0 self.SchemePrice = 0 self.ShotPrice = 0 self.MusicPrice = 0 self.ActorPrice = 0 self.AEPrice = 0 self.Price = 0 # self.CreateTime='current_timestamp()' def __repr__(self): return '<Object %r>' % {'Name': self.Name}