def GetUserType(self, id):
     mysql = Mysql()
     sql = "select useridentity from user where userid = '" + id + "'"
     s = mysql.getOne(sql)
     sql1 = "select * from usertype where useridentity = '" + s[0] + "'"
     result = mysql.getOne(sql1)
     print("最多可同时借阅书籍数目:%s\t最多可一次性推荐书籍数目:%s\t一本书免费借阅期限:%s" %
           (result[1], result[2], result[3]))
     return result
 def GetAdminPermission(self, adminid):
     '''
     :param adminid:
     :return: 管理员权限编号
     '''
     mysql = Mysql()
     sql = "select adminpri from admin where adminid ='" + adminid + "'"
     adminpermission = mysql.getOne(sql)
     return list(adminpermission)
 def matchIsAdmin(self, adminid, passwd):
     '''
     :param adminid:
     :param passwd:
     根据id、passwd字段查询admin表,匹配管理员成功返回adminid
     '''
     mysql = Mysql()
     sql = "select * from admin where adminid = '" + adminid + "' and passwd = '" + passwd + "'"
     if (mysql.getOne(sql) != False):
         print("login success!")
         adminpermission = self.GetAdminPermission(adminid)
         return [adminid, adminpermission]
Пример #4
0
 def GetUserShow(self, id):
     mysql = Mysql()
     sql = "select * from user where userid = '" + id + "'"
     temp = mysql.getOne(sql)
     # print("%s\t\t%s\t\t%s\t\t%s\t\t%s\t\t%s\t\t%s\t\t%s\t\t%s" % (User[0], User[1], User[3], User[4], User[5], User[6], User[7], User[8], User[9]))
     # return User
     user = User()
     user.username = temp[1]
     user.password = temp[2]
     user.faculty = temp[3]
     user.department = temp[4]
     user.age = temp[5]
     user.gendar = temp[6]
     user.useridentity = temp[7]
     user.userconnection = temp[8]
     user.status = temp[9]
     return user
Пример #5
0
 def matchIsUser(self, userid, password):
     mysql = Mysql()
     sql = "select * from user where userid = '" + userid + "' and password = '******'"
     if (mysql.getOne(sql) != False):
         # print("login success!")
         return True