Пример #1
0
 def AddNumber(self,num,state):
     """添加一个礼品记录
     """
     number = Market_number()
     number.number = num
     number.state = state
     operation_session.add(number)
     try:
         operation_session.commit()
     except:
         operation_session.rollback()
         raise
Пример #2
0
 def AddChannelMarket(self,applyuser,channel,spent_fee):
     market = ChannelMarketlogs()
     market.applyuser = applyuser
     market.channel = channel
     market.spent_fee = spent_fee
     market.date = datetime.now()
     market.type = type
     operation_session.add(market)
     try:
         operation_session.commit()
     except:
         operation_session.rollback()
         raise
Пример #3
0
 def AdddepartmentMarket(self,applyuser,departmentid,spent_fee,type):
     try:
         market = DepartmentMarketlogs()
         market.applyuser = applyuser
         market.departmentid = departmentid
         market.spent_fee = spent_fee
         market.date = datetime.now()
         market.type = type
         operation_session.add(market)
         operation_session.commit()
     except:
         operation_session.rollback()
         raise
Пример #4
0
 def Getconditionsloginlogs(self, **kwargs): 
     conditions = "rolename= '" + str(kwargs['rolename']) + "'"
     
     if kwargs['time'] != '-1':
         ago = operationdate.getdayofday(-int(kwargs['time']))
         conditions += " && date >= '" + str(ago.year) + "-" + str(ago.month) + "-" + str(ago.day) + "'"
     if kwargs['elevelname'] != '-1':
         conditions += " && elevelname = '" + str(kwargs['elevelname']) + "'"
                         
     star = kwargs['rows'] * int(kwargs['pages'])
     try:
         admin_logs = operation_session.query("username", "rolename", "levelname", "description", "date").from_statement("select * from admin_logs "
                                     "where " + str(conditions) + " order by date desc limit " + str(star) + "," + str(kwargs['rows'])).all()
         operation_session.commit()            
         return admin_logs  
     except:
         operation_session.rollback()
         raise                 
Пример #5
0
 def addadminlogs(self, **kwargs):
     """新增系统日志信息"""
     from eisoo.mpsource.interfaces import IUserLocator
     locator = getUtility(IUserLocator)
     
     if locator.IsUser(kwargs['username']):            
         adminlogs = Adminlogs()
         adminlogs.username = kwargs['username']
         adminlogs.rolename = kwargs['rolename']        
         adminlogs.levelname = kwargs['levelname']
         adminlogs.elevelname = kwargs['elevelname']
         adminlogs.description = kwargs['description']            
         adminlogs.date = kwargs['date']
         try:
             operation_session.add(adminlogs)
             operation_session.commit()
         except:
             operation_session.rollback()
             raise               
Пример #6
0
 def GetconditionslogsCount(self, **kwargs):
     """根据指定条件返回日志个数"""
     conditions = "rolename= '" + str(kwargs['rolename']) + "'"
     
     if kwargs['time'] != '-1':
         ago = operationdate.getdayofday(-int(kwargs['time']))
         conditions += " && date >= '" + str(ago.year) + "-" + str(ago.month) + "-" + str(ago.day) + "'"
     if kwargs['elevelname'] != '-1':
         conditions += " && elevelname = '" + str(kwargs['elevelname']) + "'"
                         
     
     try:
         admin_logs = operation_session.query("username", "rolename", "levelname", "description", "date").from_statement("select * from admin_logs "
                                     "where " + str(conditions) + " order by date desc").all()
         operation_session.commit()
         return len(admin_logs)
     except:
         operation_session.rollback()
         return 0