class Contract(db.Model): __tablename__ = "contract" Id = db.Column(db.BIGINT, primary_key=True) RequirementId = db.Column(db.BIGINT, db.ForeignKey('requirement.Id')) Version = db.Column(db.BIGINT) Title = db.Column(db.VARCHAR(255)) Detail = db.Column(db.TEXT) ServiceUserId = db.Column(db.BIGINT, db.ForeignKey('user.Id')) CustomerUserId = db.Column(db.BIGINT, db.ForeignKey('user.Id')) Status = db.Column(db.BIGINT) Amount = db.Column(db.FLOAT) CreateTime = db.Column(db.TIMESTAMP) PayState = db.Column(db.INTEGER) Scheme = db.Column(db.TEXT) Script = db.Column(db.TEXT) DepositPercent = db.Column(db.FLOAT) Procedure = db.Column(db.VARCHAR(20)) # active, applyAbort, abort Requirement = db.relation('Requirement', backref=db.backref('Contract', lazy='joined'), foreign_keys='Contract.RequirementId', lazy='joined') ServiceUser = db.relation('User', backref=db.backref('AsServiceContract', lazy='dynamic'), foreign_keys='Contract.ServiceUserId', lazy='joined') CustomerUser = db.relation('User', backref=db.backref('AsCustomerContract', lazy='dynamic'), foreign_keys='Contract.CustomerUserId', lazy='joined') # ContractSegmentDynamic = db.relation('ContractSegment', lazy='dynamic') def __init__(self): self.DepositPercent = 50.0 self.Procedure = 'active'
class ZoneItem(db.Model): __tablename__ = "zone_item" Id = db.Column(db.BIGINT, primary_key=True) DomainId = db.Column(db.BIGINT, db.ForeignKey('domain.Id')) ObjectId = db.Column(db.BIGINT, db.ForeignKey('object.Id')) Intro = db.Column(db.VARCHAR(255)) Price = db.Column(db.FLOAT) Weight = db.Column(db.FLOAT) Type = db.Column(db.INT) Classical = db.Column(db.INT) Favorite = db.Column(db.INT) Portrait = db.Column(db.VARCHAR(255)) 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) ClassicalWeight = db.Column(db.FLOAT) ViewCount = db.Column(db.INT) Boutique = db.Column(db.BOOLEAN) Object = db.relation('Object', lazy="joined", foreign_keys='ZoneItem.ObjectId') Domain = db.relation('Domain', lazy="joined", foreign_keys='ZoneItem.DomainId') def __init__(self, domain_id, object_id, intro): self.DomainId = domain_id self.ObjectId = object_id self.Intro = intro self.Favorite = 0 self.ClassicalWeight = 0 self.ViewCount = 0 self.Boutique = 0
class ContractAbortRecord(db.Model): __tablename__ = 'contract_abort_record' ContractId = db.Column(db.BIGINT, db.ForeignKey('contract.Id'), primary_key=True) ApplyRemark = db.Column(db.VARCHAR(255)) ConfirmRemark = db.Column(db.VARCHAR(255)) ApplyUserId = db.Column(db.BIGINT, db.ForeignKey('user.Id')) ApplyTime = db.Column(db.DATETIME) ConfirmTime = db.Column(db.DATETIME) ApplyDomainId = db.Column(db.BIGINT) Status = db.Column(db.VARCHAR(20)) ApplyUser = db.relation('User', lazy='joined', foreign_keys='ContractAbortRecord.ApplyUserId') Contract = db.relation('Contract', lazy='joined', foreign_keys='ContractAbortRecord.ContractId') def __init__(self, cid, apply_remark, apply_userid, apply_domainid, apply_time): self.ContractId = cid self.ApplyRemark = apply_remark self.ApplyUserId = apply_userid self.ApplyDomainId = apply_domainid self.ApplyTime = apply_time self.Status = 'apply'
class Order(db.Model): __tablename__ = "order" Id = db.Column(db.BIGINT, primary_key=True) SerialNumber = db.Column(db.VARCHAR(255)) Subject = db.Column(db.VARCHAR(100)) Description = db.Column(db.VARCHAR(255)) Amount = db.Column(db.FLOAT) UseAccount = db.Column(db.FLOAT) State = db.Column(db.INT) PayUserId = db.Column(db.BIGINT, db.ForeignKey('user.Id')) ReceiverId = db.Column(db.BIGINT, db.ForeignKey('user.Id')) CreateTime = db.Column(db.TIMESTAMP) PayUser = db.relation('User', foreign_keys='Order.PayUserId', lazy="joined") Receiver = db.relation('User', foreign_keys='Order.ReceiverId', lazy="joined") def __init__(self, SerialNumber, Subject, Description, Amount, PayUserId, ReceiverId): self.SerialNumber = SerialNumber self.Subject = Subject self.Description = Description self.Amount = Amount self.UseAccount = 0 self.PayUserId = PayUserId self.ReceiverId = ReceiverId self.State = OrderState.UnPay
class ProjectSegment(db.Model): __tablename__ = "projectsegment" Id = db.Column(db.BIGINT, primary_key=True) ProjectId = db.Column(db.BIGINT, db.ForeignKey('project.Id')) ContractSegmentId = db.Column(db.BIGINT, db.ForeignKey('contractsegment.Id')) PrincipalUserId = db.Column(db.BIGINT, db.ForeignKey('user.Id')) Segment = db.Column(db.BIGINT) Deadline = db.Column(db.DATETIME) Remark = db.Column(db.VARCHAR(2000)) ApplyUserId = db.Column(db.BIGINT, db.ForeignKey('user.Id')) ApplyTime = db.Column(db.DATETIME) ApplyRemark = db.Column(db.VARCHAR(2000)) ConfirmUserId = db.Column(db.BIGINT, db.ForeignKey('user.Id')) ConfirmTime = db.Column(db.DATETIME) ConfirmRemark = db.Column(db.VARCHAR(2000)) Status = db.Column(db.BIGINT) CreateTime = db.Column(db.TIMESTAMP) ContractSegment = db.relation('ContractSegment', backref=db.backref('ProjectSegment', lazy='dynamic')) Project = db.relation('Project', backref=db.backref('ProjectSegment', lazy='joined')) ApplyUser = db.relation('User', foreign_keys='ProjectSegment.ApplyUserId', lazy='joined') ConfirmUser = db.relation('User', foreign_keys='ProjectSegment.ConfirmUserId', lazy='joined')
class StorageShare(db.Model): __tablename__ = 'storage_share' Id = db.Column(db.BIGINT, primary_key=True) ObjectId = db.Column(db.BIGINT, db.ForeignKey('object.Id')) DomainId = db.Column(db.BIGINT, db.ForeignKey('domain.Id')) DownloadPermission = db.Column(db.BOOLEAN) WritePermission = db.Column(db.BOOLEAN) ObjectOwnerDomainId = db.Column(db.BIGINT, db.ForeignKey('domain.Id')) CreateTime = db.Column(db.DATETIME) Domain = db.relation('Domain', lazy='joined', foreign_keys='StorageShare.DomainId') OwnerDomain = db.relation('Domain', lazy='joined', foreign_keys='StorageShare.ObjectOwnerDomainId') Object = db.relation('Object', lazy='joined', foreign_keys='StorageShare.ObjectId') def __init__(self, object_id, domain_id, downloadPermission, writePermission, owner_domain_id): self.ObjectId = object_id self.DomainId = domain_id self.DownloadPermission = downloadPermission self.WritePermission = writePermission self.ObjectOwnerDomainId = owner_domain_id
class RequirementReply(db.Model): __tablename__ = "requirementreply" Id = db.Column(db.BIGINT, primary_key=True) RequirementId = db.Column(db.BIGINT, db.ForeignKey('requirement.Id')) PublisherId = db.Column(db.BIGINT, db.ForeignKey('user.Id')) Reply = db.Column(db.Text) Status = db.Column(db.BIGINT) CreateTime = db.Column(db.TIMESTAMP) ReplyGroup = db.Column(db.BIGINT) Requirement = db.relation('Requirement', backref=db.backref('RequirementReply', lazy='dynamic')) Publisher = db.relation('User', backref=db.backref('RequirementReply', lazy='dynamic'))
class ContractReply(db.Model): __tablename__ = "contractreply" Id = db.Column(db.BIGINT, primary_key=True) ContractId = db.Column(db.BIGINT, db.ForeignKey('contract.Id')) PublisherId = db.Column(db.BIGINT, db.ForeignKey('user.Id')) Reply = db.Column(db.Text) Status = db.Column(db.BIGINT) CreateTime = db.Column(db.TIMESTAMP) DestUserId = db.Column(db.BIGINT) Contract = db.relation('Contract') Publisher = db.relation('User')
class RequirementFollower(db.Model): __tablename__ = 'requirement_follower' Id = db.Column(db.BIGINT, primary_key=True) RequirementId = db.Column(db.BIGINT, db.ForeignKey('requirement.Id')) FollowerProducerId = db.Column(db.BIGINT, db.ForeignKey('user.Id')) Scheme = db.Column(db.TEXT) Script = db.Column(db.TEXT) CreateTime = db.Column(db.TIMESTAMP) FollowerDomainId = db.Column(db.BIGINT) IsDeny = db.Column(db.BOOLEAN) Long = db.Column(db.VARCHAR(100)) Format = db.Column(db.VARCHAR(100)) Subtitle = db.Column(db.VARCHAR(2048)) Voice = db.Column(db.VARCHAR(2048)) Gbm = db.Column(db.VARCHAR(2048)) Amount = db.Column(db.FLOAT) DepositPercent = db.Column(db.FLOAT) Remark = db.Column(db.TEXT) Status = db.Column(db.INT) # 是否申请方案确认,0为未申请,1为申请中 BasePrice = db.Column(db.FLOAT) SchemePrice = db.Column(db.FLOAT) ShotPrice = db.Column(db.FLOAT) ActorPrice = db.Column(db.FLOAT) MusicPrice = db.Column(db.FLOAT) AEPrice = db.Column(db.FLOAT) Follower = db.relation( 'User', foreign_keys='RequirementFollower.FollowerProducerId', lazy='joined') Requirement = db.relation('Requirement', backref=db.backref('RequirementFollower', lazy='joined')) def __init__(self, req_id, followerproducer_id, domain_id): self.RequirementId = req_id self.FollowerProducerId = followerproducer_id self.FollowerDomainId = domain_id self.IsDeny = 0 self.Long = '' self.Format = '' self.Subtitle = '' self.Voice = '' self.Gbm = '' self.Amount = 0 self.Script = '' self.Remark = '' self.DepositPercent = 50 self.Status = 0 self.BasePrice = 0 self.SchemePrice = 0 self.ShotPrice = 0 self.ActorPrice = 0 self.MusicPrice = 0 self.AEPrice = 0
class CollectionVideo(db.Model): __tablename__ = "collection_video" Id = db.Column(db.BIGINT, primary_key=True) ZoneItemId = db.Column(db.BIGINT, db.ForeignKey("zone_item.Id")) UserId = db.Column(db.BIGINT, db.ForeignKey("user.Id")) ZoneItem = db.relation('ZoneItem', lazy="joined") User = db.relation('User', lazy="joined") def __init__(self, item_id, user_id): self.ZoneItemId = item_id self.UserId = user_id
class RequirementAttachment(db.Model): __tablename__ = "requirementattachment" Id = db.Column(db.BIGINT, primary_key=True) RequirementId = db.Column(db.BIGINT, db.ForeignKey('requirement.Id')) OperateUserId = db.Column(db.BIGINT, db.ForeignKey('user.Id')) ObjectId = db.Column(db.BIGINT, db.ForeignKey('object.Id')) CreateTime = db.Column(db.TIMESTAMP) Description = db.Column(db.VARCHAR(255)) Requirement = db.relation('Requirement', backref=db.backref('RequirementAttachment', lazy='dynamic')) Object = db.relation('Object', lazy='joined') OperateUser = db.relation('User', lazy='joined')
class RequirementSegment(db.Model): __tablename__ = 'requirement_segment' Id = db.Column(db.BIGINT, primary_key=True) RequirementId = db.Column(db.BIGINT, db.ForeignKey('requirement.Id')) SegmentId = db.Column(db.INT, db.ForeignKey('segment.Id')) Segment = db.relation('Segment', lazy='joined') Requirement = db.relation('Requirement', backref=db.backref('Segments', lazy='joined'), lazy='joined') def __init__(self, req_id, seg_id): self.RequirementId = req_id self.SegmentId = seg_id
class ProjectEventLog(db.Model): __tablename__ = "projecteventlog" Id = db.Column(db.BIGINT, primary_key=True) ProjectId = db.Column(db.BIGINT, db.ForeignKey('project.Id')) UserId = db.Column(db.BIGINT, db.ForeignKey('user.Id')) Action = db.Column(db.BIGINT) Segment = db.Column(db.BIGINT) Detail = db.Column(db.TEXT) CreateTime = db.Column(db.TIMESTAMP) Project = db.relation('Project', backref=db.backref('ProjectEventLog', lazy='dynamic')) ApplyUser = db.relation('User', backref=db.backref('ProjectEventLog', lazy='dynamic'))
class ContractAttachment(db.Model): __tablename__ = "contractattachment" Id = db.Column(db.BIGINT, primary_key=True) ContractId = db.Column(db.BIGINT, db.ForeignKey('contract.Id')) ProviderUserId = db.Column(db.BIGINT, db.ForeignKey('user.Id')) ObjectId = db.Column(db.BIGINT, db.ForeignKey('object.Id')) CreateTime = db.Column(db.TIMESTAMP) Type = db.Column(db.INT) Status = db.Column(db.INT) Contract = db.relation('Contract', backref=db.backref('ContractAttachment', lazy='dynamic')) ProviderUser = db.relation('User', backref=db.backref('ContractAttachment', lazy='dynamic')) Object = db.relation('Object', lazy='joined')
class FollowerAttachment(db.Model): __tablename__ = 'followerattachment' Id = db.Column(db.BIGINT, primary_key=True) FollowerId = db.Column(db.BIGINT, db.ForeignKey('requirement_follower.Id')) ObjectId = db.Column(db.BIGINT, db.ForeignKey('object.Id')) CreateTime = db.Column(db.TIMESTAMP) Follower = db.relation('RequirementFollower', backref=db.backref('FollowerAttachment', lazy='joined')) Object = db.relation('Object', lazy='joined') def __init__(self, follower_id, object_id): self.FollowerId = follower_id self.ObjectId = object_id self.CreateTime = datetime.datetime.now()
class ContractOrder(db.Model): __tablename__ = "contract_order" Id = db.Column(db.BIGINT, primary_key=True) ContractId = db.Column(db.BIGINT, db.ForeignKey("contract.Id")) OrderId = db.Column(db.BIGINT, db.ForeignKey("order.Id")) OrderType = db.Column(db.INT) Contract = db.relation('Contract', lazy="joined", backref=db.backref('ContractOrder', lazy='dynamic')) Order = db.relation('Order', lazy="joined") def __init__(self, ContractId, OrderId, OrderType): self.ContractId = ContractId self.OrderId = OrderId self.OrderType = OrderType
class ContractEventLog(db.Model): __tablename__ = "contracteventlog" Id = db.Column(db.BIGINT, primary_key=True) ContractId = db.Column(db.BIGINT, db.ForeignKey('contract.Id')) UserId = db.Column(db.BIGINT, db.ForeignKey('user.Id')) Action = db.Column(db.BIGINT) Segment = db.Column(db.BIGINT) Detail = db.Column(db.TEXT) CreateTime = db.Column(db.TIMESTAMP) Contract = db.relation('Contract', backref=db.backref('ContractEventLog', lazy='dynamic')) User = db.relation('User', backref=db.backref('ContractEventLog', lazy='dynamic')) def __init__(self, con_id, user_id, action, segment, detail): self.ContractId = con_id self.UserId = user_id self.Action = action self.Segment = segment self.Detail = detail
class Requirement(db.Model): __tablename__ = "requirement" Id = db.Column(db.BIGINT, primary_key=True) PublisherId = db.Column(db.BIGINT, db.ForeignKey('user.Id')) ServiceUserId = db.Column(db.BIGINT, db.ForeignKey('user.Id')) Title = db.Column(db.VARCHAR(255)) Detail = db.Column(db.TEXT) Amount = db.Column(db.FLOAT) Status = db.Column(db.INT, db.ForeignKey('segment.Id')) CreateTime = db.Column(db.TIMESTAMP) Publisher = db.relation('User', backref=db.backref('Requirements', lazy='dynamic'), foreign_keys='Requirement.PublisherId', lazy='joined') Deadline = db.Column(db.VARCHAR(20)) Type = db.Column(db.VARCHAR(20)) Long = db.Column(db.VARCHAR(100)) Format = db.Column(db.VARCHAR(100)) Voice = db.Column(db.VARCHAR(2048)) Gbm = db.Column(db.VARCHAR(2048)) Place = db.Column(db.VARCHAR(20)) Refer = db.Column(db.VARCHAR(100)) ReferName = db.Column(db.VARCHAR(100)) Symbol = db.Column(db.VARCHAR(20)) Subtitle = db.Column(db.VARCHAR(2048)) Category_1 = db.Column(db.INT) Category_2 = db.Column(db.INT) Scheme = db.Column(db.TEXT) ContractId = db.Column(db.INT) DepositPercent = db.Column(db.FLOAT) Star = db.Column(db.INT) Comment = db.Column(db.VARCHAR(255)) Remark = db.Column(db.TEXT) ApplyStatus = db.Column(db.INT) IsFinalPay = db.Column(db.INT) IsAdvancePay = db.Column(db.INT) ServiceUser = db.relation('User', foreign_keys='Requirement.ServiceUserId', lazy='joined') CurSegment = db.relation('Segment', lazy='joined') def __init__(self): self.DepositPercent = 50.0 self.ApplyStatus = 0 self.IsFinalPay = 0 self.IsAdvancePay = 0
class CollectionProducer(db.Model): __tablename__ = "collection_producer" Id = db.Column(db.BIGINT, primary_key=True) DomainId = db.Column(db.BIGINT, db.ForeignKey("domain.Id")) UserId = db.Column(db.BIGINT) Domain = db.relation('Domain', lazy="joined") def __init__(self, domain_id, user_id): self.DomainId = domain_id self.UserId = user_id
class RechargeAccountOrder(db.Model): __tablename__ = "rechargeAccount_order" Id = db.Column(db.BIGINT, primary_key=True) Amount = db.Column(db.BIGINT) OrderId = db.Column(db.BIGINT, db.ForeignKey("order.Id")) CreateTime = db.Column(db.TIMESTAMP) Order = db.relation('Order', lazy="joined") def __init__(self, amount, orderId): self.Amount = amount self.OrderId = orderId
class ContractClips(db.Model): __tablename__ = "contractclips" Id = db.Column(db.BIGINT, primary_key=True) ContractId = db.Column(db.BIGINT, db.ForeignKey('contract.Id')) Version = db.Column(db.BIGINT) Detail = db.Column(db.TEXT) ContractClipsHistory = db.relation('ContractClipsHistory') def __init__(self, version, contractId): self.Version = version self.ContractId = contractId
class ContractSegment(db.Model): __tablename__ = "contractsegment" Id = db.Column(db.BIGINT, primary_key=True) ContractId = db.Column(db.BIGINT, db.ForeignKey('contract.Id')) Segment = db.Column(db.BIGINT) Deadline = db.Column(db.DATETIME) Remark = db.Column(db.VARCHAR(2000)) ApplyUserId = db.Column(db.BIGINT, db.ForeignKey('user.Id')) ApplyTime = db.Column(db.DATETIME) ApplyRemark = db.Column(db.VARCHAR(2000)) ConfirmUserId = db.Column(db.BIGINT, db.ForeignKey('user.Id')) ConfirmTime = db.Column(db.DATETIME) ConfirmRemark = db.Column(db.VARCHAR(2000)) Status = db.Column(db.BIGINT) CreateTime = db.Column(db.TIMESTAMP) ServiceResponser = db.Column(db.BIGINT) CustomerResponser = db.Column(db.BIGINT) # Contract = db.relation('Contract', backref=db.backref('ContractSegment',order_by='ContractSegment.Segment,ContractSegment.Id', lazy='joined')) ApplyUser = db.relation('User', foreign_keys='ContractSegment.ApplyUserId', lazy='joined') ConfirmUser = db.relation('User', foreign_keys='ContractSegment.ConfirmUserId', lazy='joined')
class ProducerSetting(db.Model): __tablename__ = "setting_producer" DomainId = db.Column(db.BIGINT, db.ForeignKey('domain.Id'), primary_key=True) Position = db.Column(db.INT) Domain = db.relation('Domain', foreign_keys='ProducerSetting.DomainId') def __init__(self, did, position): self.DomainId = did self.Position = position
class FinalVideo(db.Model): __tablename__ = "finalvideo" Id = db.Column(db.BIGINT, primary_key=True) ContractId = db.Column(db.BIGINT, db.ForeignKey('contract.Id')) Version = db.Column(db.BIGINT) Detail = db.Column(db.TEXT) FinalVideoHistory = db.relation('FinalVideoHistory') def __init__(self, version, contractId): self.Version = version self.ContractId = contractId
class ClassicalSetting(db.Model): __tablename__ = "setting_classical" ZoneItemId = db.Column(db.BIGINT, db.ForeignKey('zone_item.Id'), primary_key=True) Position = db.Column(db.INT) ZoneItem = db.relation('ZoneItem', foreign_keys='ClassicalSetting.ZoneItemId') def __init__(self, zid, position): self.ZoneItemId = zid self.Position = position
class ResourceShare(db.Model): __tablename__ = "resourceshare" Id = db.Column(db.BIGINT, primary_key=True) ResourceId = db.Column(db.BIGINT) ResourceType = db.Column(db.VARCHAR(10)) ShareDomainId = db.Column(db.BIGINT, db.ForeignKey('domain.Id')) ShareDomain = db.relation('Domain', lazy='joined') def __init__(self, resource_id, resource_type, share_domain_id): self.ResourceId = resource_id self.ResourceType = resource_type self.ShareDomainId = share_domain_id
class MemberShipTaxOrder(db.Model): __tablename__ = "membershiptax_order" Id = db.Column(db.BIGINT, primary_key=True) OrgExpireTime = db.Column(db.DATETIME) ExpireTime = db.Column(db.DATETIME) OrderId = db.Column(db.BIGINT, db.ForeignKey("order.Id")) CreateTime = db.Column(db.TIMESTAMP) Order = db.relation('Order', lazy="joined") def __init__(self, orgExpireTime, expireTime, orderId): self.OrgExpireTime = orgExpireTime self.ExpireTime = expireTime self.OrderId = orderId
class ContractUserGroup(db.Model): __tablename__ = "contractusergroup" Id = db.Column(db.BIGINT, primary_key=True) ContractId = db.Column(db.BIGINT, db.ForeignKey('contract.Id')) UserId = db.Column(db.BIGINT, db.ForeignKey('user.Id')) DomainId = db.Column(db.BIGINT) CreateTime = db.Column(db.TIMESTAMP) Description = db.Column(db.VARCHAR(255)) User = db.relation('User', lazy='joined') def __init__(self, con_id, user_id, domain_id, description): self.ContractId = con_id self.UserId = user_id self.DomainId = domain_id self.Description = description
class ExtendStorageOrder(db.Model): __tablename__ = "extendStorage_order" Id = db.Column(db.BIGINT, primary_key=True) ExtendTime = db.Column(db.INT) UseAccount = db.Column(db.BIGINT) ExtendStorageSize = db.Column(db.BIGINT) OrderId = db.Column(db.BIGINT, db.ForeignKey("order.Id")) CreateTime = db.Column(db.TIMESTAMP) Order = db.relation('Order', lazy="joined") def __init__(self, extendTime, useAccount, extendStorageSize, orderId): self.ExtendTime = extendTime self.UseAccount = useAccount self.ExtendStorageSize = extendStorageSize self.OrderId = orderId
class ApplyMoney(db.Model): __tablename__ = "apply_money" Id = db.Column(db.INT, primary_key=True) DomainId = db.Column(db.INT, db.ForeignKey("domain.Id")) Money = db.Column(db.FLOAT) CreateTime = db.Column(db.TIMESTAMP) Status = db.Column(db.INT) UserId = db.Column(db.BIGINT) Domain = db.relation('Domain', lazy='joined') def __init__(self, domainId, userId, money): self.DomainId = domainId self.Money = money self.Status = 0 self.UserId = userId self.CreateTime = datetime.datetime.now()