Example #1
0
 def add(self, cls_, data:dict)->int:
     """
     添加
     @param object cls_ 数据库模型实体类
     @param dict data 数据
     @return bool
     """
     users = cls_(**data)
     dBSession.add(users)
     dBSession.flush()
     return users.id
 def add(self, data, type=1, level=1):
     """ 
     添加
     @param: string  data
     @param: integer type
     @param: integer level
     @retrun integer boolean
     """
     data = {
         'data': data,
         'type': type,
         'level': level,
         'create_time': int(time.time())
     }
     try:
         log = HtLog(**data)
         dBSession.add(log)
         dBSession.flush()
         id = log.id
         dBSession.commit()
         return id
     except Exception as e:
         dBSession.rollback()
         return 0
Example #3
0
 def addByClass(self, data):
     room = Config(**data)
     dBSession.add(room)
     dBSession.flush()
     return room.id
Example #4
0
 def add(self, data):
     users = Users(**data)
     dBSession.add(users)
     dBSession.flush()
     return users.id
Example #5
0
 def add(self, data):
     admin = Admin(**data)
     dBSession.add(admin)
     dBSession.flush()
     return admin.id
Example #6
0
 def add(self, data):
     msg = Msg(**data)
     dBSession.add(msg)
     dBSession.flush()
     return msg.id
Example #7
0
 def add(self, data):
     userRoomRelation = UserRoomRelation(**data)
     dBSession.add(userRoomRelation)
     dBSession.flush()
     return userRoomRelation.id