def get_all_jobs_by_time(): jobs = JobController.get_all_jobs_by_time() ret = list() max_count = 20 max_count = max_count if max_count < len(jobs) else len(jobs) for i in range(max_count): job = jobs[i] print job.PublishTime userindex = UserController.get_userindex_byuserid(job.UserID) if userindex is not None: ret.append({"AgencyName": userindex.AgencyName, "Score": userindex.CurrentCreditScore, "JobInfo": job.dump_to_dict()}) return return_data(data=ret)
def user_agency(): data = get_data_from_ajax() jobid = data.get("JobID", None) if jobid is None: abort(400, "缺少 JobID") jobinfo = JobController.get_job_by_jobid(jobid) if jobinfo is None: abort(403, "查询的 JobID: %s 不存在" % jobid) userindex = UserController.get_userindex_byuserid(jobinfo.UserID) d = userindex.dump_to_dict() d["Score"] = userindex.CurrentCreditScore d["JobsCount"] = len(userindex.JobTxMap) return return_data(None, data=d)