Exemplo n.º 1
0
 def changeemail(self, uid, email):
     # change email
     dt = Time.gettime()
     data = {
         'email': '\'' + email + ' \'',
         'update_time': '\'' + dt + '\''
     }
     return self.db.update('Users', data, 'id = {0}'.format(uid))
Exemplo n.º 2
0
 def changepass(self, uid, password):
     # change password
     dt = Time.gettime()
     data = {
         'password': '******'' + password + ' \'',
         'update_time': '\'' + dt + '\''
     }
     return self.db.update('Users', data, 'id = {0}'.format(uid))
Exemplo n.º 3
0
 def editwriteup(self, title, content):
     dt = Time.gettime()
     if self.checkexit(title) != 0:
         data = {
             'title': '\'' + title + ' \'',
             'content': '\'' + content + ' \'',
             'update_time': '\'' + dt + '\''
         }
         try:
             result = self.db.update('WriteUp', data, 'title = {0}'.format(title))
         except Exception as e:
             print(e)
             return False
         return result
Exemplo n.º 4
0
 def addrecord(self, uid, pid, state):
     dt = Time.gettime()
     data = {
         'uid': '\'' + uid + ' \'',
         'pid': '\'' + pid + ' \'',
         'state': '\'' + state + ' \'',
         'create_time': '\'' + dt + '\'',
         'update_time': '\'' + dt + '\''
     }
     try:
         result = self.db.insert('Record', data)
     except Exception as e:
         print(e)
         return False
     return result
Exemplo n.º 5
0
    def adduser(self, username, password, email, gender):
        # gender M男F女
        if self.checkuser(username) == 0:
            dt = Time.gettime()
            data = {
                'username': '******'' + username + ' \'',
                'password': '******'' + password + ' \'',
                'email': '\'' + email + ' \'',
                'gender': '\'' + gender + ' \'',
                'points': 0,
                'create_time': '\'' + dt + '\'',
                'update_time': '\'' + dt + '\''

            }
            return self.db.insert('Users', data)
        return False
Exemplo n.º 6
0
 def addwriteup(self, uid, pid, title, content):
     dt = Time.gettime()
     data = {
         'uid': '\'' + uid + ' \'',
         'pid': '\'' + pid + ' \'',
         'title': '\'' + title + ' \'',
         'content': '\'' + content + ' \'',
         'create_time': '\'' + dt + '\'',
         'update_time': '\'' + dt + '\''
     }
     try:
         result = self.db.insert('WriteUp', data)
     except Exception as e:
         print(e)
         return False
     return result
Exemplo n.º 7
0
    def editproblem(self, pid, name="", tag="", content="", flag="", points=""):
        data = {}
        dt = Time.gettime()
        data['update_time'] = '\'' + dt + '\''
        if name != "":
            data['name'] = '\'' + name + '\''
        if tag != "":
            data['tag'] = '\'' + tag + '\''
        if content != "":
            data['content'] = '\'' + content + '\''
        if flag != "":
            data['flag'] = '\'' + flag + '\''
        if points != "":
            data['points'] = '\'' + points + '\''

        return self.db.update('Problems', data, 'id = {0}'.format(pid))
Exemplo n.º 8
0
    def changesettings(self, uid, username="", password="", email="", gender=""):
        # gender M男F女

        dt = Time.gettime()
        data = {
            'update_time': '\'' + dt + '\'',
        }
        if username != "":
            data["username"] = '******'' + username + ' \''
        if password != "":
            data["password"] = '******'' + password + ' \''
        if email != "":
            data["email"] = '\'' + email + ' \''
        if gender != "":
            data["gender"] = '\'' + gender + ' \''

        return self.db.update('Users', data, 'id = {0}'.format(uid))
Exemplo n.º 9
0
 def addproblem(self, name, tag, content, flag, points):
     dt = Time.gettime()
     data = {
         'name': '\'' + name + ' \'',
         'tag': '\'' + tag + '\'',
         'content': '\'' + content + '\'',
         'flag': '\'' + flag + '\'',
         'points': '\'' + points + '\'',
         'create_time': '\'' + dt + '\'',
         'update_time': '\'' + dt + '\''
     }
     try:
         result = self.db.insert('Problems', data)
     except Exception as e:
         print(e)
         return False
     return result