Esempio n. 1
0
    def run(self):
        try:
            while True:
                apps = db.query("SELECT * FROM app;")
                for app in apps:
                    db.update("UPDATE app SET token=%d WHERE id=%d" % (random.randint(1, 99999), app.id))

                time.sleep(300)
        except Exception, e:
            print Exception, ':', e
Esempio n. 2
0
    def get(self):
        app_id = int(self.get_argument('app_id',  int(self.get_cookie('app_id', 1))))
        apps = db.query("SELECT * FROM app")

        if len(apps) == 0:
            self.write(u'你还未创建任何 APP')
            return

        finded = False
        for app in apps:
            if app.id == app_id:
                finded = True
                break

        if finded is False:
            app_id = apps[0].id

        self.set_cookie('app_id', str(app_id))
        rows = db.query("SELECT * FROM answer WHERE app_id=%d" % app_id)
        self.render('admin/answers.html', app_id=app_id, apps=apps, rows=rows)
Esempio n. 3
0
    def get(self):
        rows = db.query("SELECT * FROM app")

        self.render('admin/apps.html', rows=rows)