Exemplo n.º 1
0
 def createNewService(self,service_idf,max_devices,max_traffic,expire_timestamp,service_type):
     try:
         add_str = "INSERT INTO service_info (service_idf,max_devices,max_traffic,expire_time,service_type) VALUES (%s,%s,%s,%s,%s)"
         c = self.cursor
         expire_str = timeUtil.getReadableTime(int(expire_timestamp),0)
         c.execute(add_str,[service_idf,int(max_devices),float(max_traffic),expire_str,service_type])
         self.connection.commit()
         return self.rtn.success(200)
     except Exception as e:
         traceback.print_exc()
Exemplo n.º 2
0
    def updateExpireTimestamp(self,service_idf,expire_timestamp):
        try:
            c = self.cursor
            expire_time = timeUtil.getReadableTime(expire_timestamp,0)
            update_str = "UPDATE service_info SET expire_time = %s WHERE service_idf = %s"
            c.execute(update_str,[expire_time,service_idf])
            self.connection.commit()

            return self.rtn.success(200)
        except Exception as e:
            traceback.print_exc()