示例#1
0
    def post(self):

        try:
            args = parser.parse_args()
            keyword = args['keyword']
            result = DB_user.Search_Like(keyword)
            if(result != []):
                users = []
                for db_userinfo in result:
                    db_lwnum = db_userinfo[3]
                    db_name = common_decode(db_userinfo[1])
                    db_photo = db_userinfo[4]
                    
                    if(db_lwnum != 0):
                        db_leader = DB_user.Search(db_userinfo[3])[1]
                    else:
                        db_leader = '无'
                    
                    userInfo = {}
                    userInfo['Wnumber'] = db_userinfo[2]
                    userInfo['name'] = db_name
                    userInfo['photo'] = db_photo
                    userInfo['pleader'] = db_leader
                    users.append(userInfo)
                data = {}
                data['users'] = users
                return data, 200
            else:
                return False, 500
        except:
            return 500,False
示例#2
0
 def post(self):
     args = parser.parse_args()
     name = args['name']
     password = args['password']
     lwnumber = int(args['lwnumber'])
     try:
         if (DB_user.Search(lwnumber)) != None:
             if (DB_user.insert(lwnumber, password, name)):
                 return True, 201
             else:
                 return False, 501
         else:
             return False, 202
     except:
         return False, 500
示例#3
0
 def post(self):
     try:
         args = parser.parse_args()
         wnumber = int(args['wnumber'])
         lwnumber = int(args['lwnumber'])
         print(wnumber)
         userid = int(args['userid'])
         if (DB_user.Search(wnumber) == None):
             if (DB_user.SignUpAgree(userid, wnumber, lwnumber)):
                 return True, 201
             else:
                 return False, 500
         else:
             return False, 200
     except:
         return False, 500
示例#4
0
 def post(self):
     args = parser.parse_args()
     name = args['name']
     password = args['password']
     lwnumber = int(args['lwnumber'])
     if(DB_user.insert(lwnumber,password,name)):
         return True, 201
     else:
         return False,200
示例#5
0
 def post(self):
     try:
         args = parser.parse_args()
         userid = int(args['userid'])
         if(DB_user.SignUpDeny(userid)):
             return True,201
         else:
             return False,500
     except:
         return False,500
示例#6
0
    def post(self):
        args = parser.parse_args()
        wnumber = int(args['wnumber'])
        password = args['password']
        print(password)
        # 查询数据库
        db_userinfo = DB_user.Search(wnumber)
        if (db_userinfo != None):
            db_passwd = db_userinfo[0]
            db_lwnum = db_userinfo[3]
            db_name = db_userinfo[1]
            db_photo = db_userinfo[4]
            if (db_lwnum != 0):
                db_leader = DB_user.Search(db_userinfo[3])[1]
            else:
                db_leader = '无'
            db_email = db_userinfo[2]
            #print(db_passwd,db_name,wnumber,db_lwnum,db_photo)
            print(db_passwd)

            if (db_passwd == password
                ):  #(users[userid] == password):(db_passwd == password):
                userInfo = {}
                userInfo['Wnumber'] = wnumber
                if (DB_user.CheckSub(wnumber) != []):
                    userInfo['hasSub'] = True
                else:
                    userInfo['hasSub'] = False
                userInfo['name'] = db_name
                userInfo['photo'] = db_photo
                userInfo['pleader'] = db_leader
                userInfo['email'] = db_email
                return userInfo, 200
            else:
                return None, 200
        else:
            return "User Not Found", 200
示例#7
0
 def post(self):
     try:
         args = parser.parse_args()
         lwnumber = int(args['lwnumber'])
         result = DB_user.SubSearch(lwnumber)
         if(result != None):
             users = []
             for db_user in result:
                 user = {}
                 user['name'] = common_decode(db_user[0])
                 user['Wnumber'] = db_user[1]
                 users.append(user)
             return users, 200
         else:
             return False, 500
     except:
         return 500,False
示例#8
0
 def post(self):
     userlist = []
     args = parser.parse_args()
     wnumber = int(args['wnumber'])
     try:
         db_userlist = DB_user.SignUpSearch(wnumber)
         for user in db_userlist:
             userinfo = {}
             #userinfo['email'] = user[0]
             userinfo['password'] = user[0]
             userinfo['name'] = common_decode(user[1])
             print(userinfo['name'])
             userinfo['userid'] = user[5]
             if(user[2] == -1):
                 userinfo['status'] = '待审核'
             else:
                 userinfo['status'] = '已通过'
             userlist.append(userinfo)
             print(userlist)
         return userlist, 200
     except:
         return userlist, 500
示例#9
0
 def post(self):
     args = parser.parse_args()
     Wnumber = int(args['Wnumber'])
     asking_list = []
     part_dict = {1: '上午', 2: '下午', 3: '全天'}
     # 搜索请假情况
     try:
         results = DB_asking.subAskingSearch(Wnumber)
         for result in results:
             print(result)
             asking = {}
             asking['askingid'] = result[0]
             asking['reason'] = result[1]
             asking['date'] = result[2]
             asking['agree'] = result[3]
             asking['wnumber'] = result[4]
             asking['name'] = DB_user.Search(result[4])[1]
             asking['partOfDayNum'] = result[5]
             asking['time'] = result[2] + ' ' + part_dict[result[5]]
             asking_list.append(asking)
         return asking_list, 200
     except:
         return False, 500