class LitemallCouponUser(BaseModel): __tablename__ = 'litemall_coupon_user' id = orm.Integer(primary_key=True) user_id = orm.Integer() coupon_id = orm.Integer() status = orm.Integer() used_time = orm.Datetime() start_time = orm.Datetime() end_time = orm.Datetime() order_id = orm.Integer()
class LitemallUser(BaseModel): __tablename__ = 'litemall_user' username = orm.String(length=63) password = orm.String(length=63) gender = orm.TinyInteger(length=3) birthday = orm.Datetime() last_login_time = orm.Datetime() last_login_ip = orm.String(length=63) nickname = orm.String(length=63) mobile = orm.String(length=20) avatar = orm.String(length=255) status = orm.TinyInteger(length=3)
class LitemallAdmin(BaseModel): __tablename__ = 'litemall_admin' username = orm.String(length=63) password = orm.String(length=63) last_login_ip = orm.String(length=63) last_login_time = orm.Datetime() avatar = orm.String(length=255)
class LitemallCoupon(BaseModel): __tablename__ = 'litemall_coupon' name = orm.String(length=63) description = orm.String(length=127) tag = orm.String(length=63) total = orm.Integer() discount = orm.Float() min = orm.Float() limitation = orm.Integer() type = orm.Integer() status = orm.Integer() goods_type = orm.Integer() goods_value = orm.String(length=1023) code = orm.String(length=63) time_type = orm.Integer() days = orm.Integer() start_time = orm.Datetime() end_time = orm.Datetime()
class LitemallOrder(BaseModel): __tablename__ = 'litemall_order' user_id = orm.Integer() order_sn = orm.String(length=63) order_status = orm.Integer() consignee = orm.String(length=63) mobile = orm.String(length=63) address = orm.String(length=127) message = orm.String(length=512) goods_price = orm.Float() freight_price = orm.Float() coupon_price = orm.Float() order_price = orm.Float() ship_sn = orm.String(length=63) ship_channel = orm.String(length=63) ship_time = orm.Datetime() confirm_time = orm.Datetime() end_time = orm.Datetime()
class BaseModel(orm.Model): def __init__(self, **kwargs): super(BaseModel, self).__init__(**kwargs) orm.event_bus.add_table_event(self, 'CREATED', self.on_base_model_created) orm.event_bus.add_table_event(self, 'UPDATED', self.on_base_model_update) id = orm.Integer(primary_key=True) add_time = orm.Datetime() updated_at = orm.Datetime() deleted_at = orm.Datetime() def on_base_model_created(self, event, *args, **kwargs): args[0].add_time = datetime.datetime.now() def on_base_model_update(self, event, *args, **kwargs): args[0].updated_at = datetime.datetime.now()