Ejemplo n.º 1
0
    def refresh_db(self):

        time_now = time_to_str(int(time.time())).split()[1]
        if time_now == refresh_time:
            for table in self.data_all:
                Data.delete(table, [])
                Data.insert(table, self.data_all[table])
            # time.sleep(60)
        # else:
        #     pass
        return
Ejemplo n.º 2
0
    def delete(self, table, conditions):
        if table in self.data_all:
            table_content = self.data_all[table]

            del_line = []

            for line in table_content:
                if judge(line, conditions) == True:
                    del_line.append(line)

            for i in del_line:
                table_content.remove(i)

            Data.delete(table, conditions)

        else:
            Data.delete(table, conditions)
            self.data_all[table] = Data.select(table, [])

        return
Ejemplo n.º 3
0
    def post(self):
        player_base = self.get_player_base()
        if player_base is None:
            return self.send_faild(error.ERROR_NO_USER)

        try:
            data = self.get_post_data()
            group_id = data['group_id']
        except Exception as e:
            print(e)
            return self.send_faild(error.ERROR_PARAM)

        group = Data.select('player_group', [('id', '=', group_id)])
        if group == None:
            return self.send_faild(error.ERROR_DATA_NOT_FOUND)

        Data.delete('player_group', [('id', '=', group_id)])

        reply = {'commit': 1}
        self.send_ok(reply)
        return