def get(self): args = request.args page = int(args.get("page")) limit = int(args.get("limit")) option = args.get("option") drop_state = int(args.get("drop_state")) job_list = [] if option == 'all': # if not job_class and job_class == '0': data = {} if drop_state: data = { 'drop_state': drop_state, } box_rn = Box.objects(**data).all() obj = Job.pagination(page=page, limit=limit, rn=box_rn) for box in obj.get("data"): job = Job.get(id=box.jobs.id) resume = Resume.get(id=box.resumes.id) if not job: continue create_time = box.created_at.strftime("%Y-%m-%d") job_list.append( { "drop_state": box.drop_state, "name": job.name, 'time': create_time, 'department': job.department, 'classes': JOB_CLASS.get(job.classes), 'resume_name': resume.name, 'tel': resume.tel, 'resume_id': resume.id, 'drop_state': box.drop_state, 'box_id': box.id, # 'location': job.location, # 'salary': "{0}-{1}k".format(job.salary_start, job.salary_end), # 'experience': EXPERIENCE.get(job.experience), # 'education': LEVEL.get(job.education), # 'temptation': job.temptation, 'id': job.id } ) else: data = { 'state': 100, 'accounts': session.get("user_id") } if drop_state: data['drop_state'] = int(drop_state) box_rn = Box.objects(**data).all() obj = Job.pagination(page=page, limit=limit, rn=box_rn) for box in obj.get("data"): job = Job.get(id=box.jobs.id) if not job: continue create_time = job.created_at.strftime("%Y-%m-%d") job_list.append( { "drop_state": box.drop_state, "name": job.name, 'time': create_time, 'department': job.department, 'classes': JOB_CLASS.get(job.classes), 'location': job.location, 'salary': "{0}-{1}k".format(job.salary_start, job.salary_end), 'experience': EXPERIENCE.get(job.experience), 'education': LEVEL.get(job.education), 'temptation': job.temptation, 'id': job.id } ) obj['data'] = job_list return success(res={'data': job_list})
def get(self): args = request.args job_class = args.get("job_class") page = int(args.get("page")) limit = int(args.get("limit")) option = args.get("option") job_list = [] if option == 'all': if not job_class or job_class == '0': rn = Job.objects().all() else: rn = Job.objects(classes=int(job_class)).all() obj = Job.pagination(page=page, limit=limit, rn=rn) for job in obj.get("data"): create_time = job.created_at.strftime("%Y-%m-%d %H:%M:%S") job_list.append({ "name": job.name, 'department': job.department, 'time': create_time, 'classes': JOB_CLASS.get(job.classes), 'location': job.location, 'id': job.id }) else: experience = args.get("experience") category = args.get("category") data = {'state': 100} if job_class and job_class != '0': data['classes'] = int(job_class) if experience and experience != '0': data['experience'] = int(experience) if category and category != '0': data['category'] = int(category) rn = Job.objects(**data).all() obj = Job.pagination(page=page, limit=limit, rn=rn) for job in obj.get("data"): create_time = job.created_at.strftime("%Y-%m-%d") job_list.append({ "name": job.name, 'time': create_time, 'department': job.department, 'classes': JOB_CLASS.get(job.classes), 'location': job.location, 'salary': "{0}-{1}k".format(job.salary_start, job.salary_end), 'experience': EXPERIENCE.get(job.experience), 'education': LEVEL.get(job.education), 'temptation': job.temptation, 'id': job.id }) obj['data'] = job_list return success(res={'data': job_list})