Esempio n. 1
0
 def get(self):
     """搜索工作"""
     parser = reqparse.RequestParser()
     parser.add_argument('key', type=str, location='values')
     parser.add_argument('type', type=int, location='values')
     args = parser.parse_args()
     if args['key'] is None:
         args['key'] = ""
     jobs = Job.query.filter(
         and_(Job.isDel == 0,
              Job.tittle.like('%' + args['key'] + '%'))).all()
     if jobs is None:
         jobs = Job.query.filter(
             and_(Job.isDel == 0, Job.recruitNum > Job.signNum)).all()
     if args.type == 1:
         newjobs = queryToDict(jobs)
         res = [[], [], [], []]
         for job in newjobs:
             job['creatTime'] = get_from_timestamp(job['creatTime'])
             res[0] = newjobs
             for i in range(3):
                 if job['status'] == i + 1:
                     res[i + 1].append(job)
         return res, 200
     return make_result(jobs), 200
Esempio n. 2
0
 def get(self):
     """管理员获取所有工作"""
     jobs = Job.query.filter(Job.isDel == 0).order_by(Job.id.desc()).all()
     newRes = queryToDict(jobs)
     res1 = [[], [], []]
     for res in newRes:
         res['creatTime'] = get_from_timestamp(res['creatTime'])
         res1[0] = newRes
         if res['status'] == 1:
             res1[1].append(res)
         if res['status'] != 1:
             res1[2].append(res)
     return res1, 200
Esempio n. 3
0
def make_result(data=None, code=Success_Code().Success):
    success_dict = {
        "code": code if data else Success_Code().noData_Success,
        "msg": Success_Code.msg[code] if data else Success_Code.msg[20001]
    }
    # 分页情况的结果返回格式
    if isinstance(data, Pagination):
        new_data = dict()
        new_data['currentPage'] = data.page
        new_data['totalPages'] = data.pages
        new_data['pageSize'] = data.per_page
        new_data['totalItems'] = data.total
        new_data['pageList'] = list(data.iter_pages())
        # new_data['has_prev'] = data.has_prev
        # new_data['has_next '] = data.has_next
        new_data['prev_num '] = data.prev_num
        new_data['next_num '] = data.next_num
        new_data['currentItems'] = queryToDict(data.items)
        success_dict['data'] = new_data
    elif isinstance(data, str):
        success_dict['msg'] = data
    else:
        success_dict['data'] = queryToDict(data) if data else ""
    return success_dict
Esempio n. 4
0
    def get(self):
        """获取简历其他项"""
        parser = reqparse.RequestParser()
        parser.add_argument('id', type=int, location='values')
        args = parser.parse_args()
        otherInfoList = []
        edus = EduResume.query.filter(
            and_(EduResume.isDel == 0, EduResume.userId == args['id'])).all()
        otherInfoList = make_item(otherInfoList, '教育经历', queryToDict(edus))
        works = WorkResume.query.filter(
            and_(WorkResume.isDel == 0,
                 WorkResume.userId == args['id'])).all()
        otherInfoList = make_item(otherInfoList, '工作经历', queryToDict(works))
        others = OtherResume.query.filter(
            and_(OtherResume.isDel == 0,
                 OtherResume.userId == args['id'])).all()
        otherInfoList = make_item(otherInfoList, '工作期望', queryToDict(others))
        if others and others[0].selfIntroduction:
            otherInfoList = make_item(otherInfoList, '自我评价',
                                      others[0].selfIntroduction)
        else:
            otherInfoList = make_item(otherInfoList, '自我评价', [])

        return otherInfoList, 200
Esempio n. 5
0
 def get(self):
     """商家查看我发布的所有工作"""
     parser = reqparse.RequestParser()
     parser.add_argument('uid', type=int, location='values')
     args = parser.parse_args()
     com = Company.query.filter(
         and_(Company.isDel == 0,
              Company.uId == args['uid'])).first_or_404()
     jobs = Job.query.filter(and_(Job.isDel == 0, Job.cId == com.id)). \
         with_entities(Job.id, Job.tittle, Job.place, Job.creatTime, Job.status).all()
     newjobs = queryToDict(jobs)
     res = [[], [], [], []]
     for job in newjobs:
         job['creatTime'] = get_from_timestamp(job['creatTime'])
         res[0] = newjobs
         for i in range(3):
             if job['status'] == i + 1:
                 res[i + 1].append(job)
     return res, 200
Esempio n. 6
0
 def get(self):
     """管理员查看待审核的企业"""
     parser = reqparse.RequestParser()
     parser.add_argument('useId', type=int, location='values')
     args = parser.parse_args()
     forms = db.session.query(ComSign.id, ComSign.creatTime, ComSign.uId, ComSign.cId, ComSign.isVerify,
                              Company.cname). \
         filter(ComSign.isDel == 0). \
         filter(ComSign.cId == Company.id). \
         all()
     newRes = queryToDict(forms)
     print(newRes)
     res1 = [[], [], []]
     for res in newRes:
         res['creatTime'] = get_from_timestamp(res['creatTime'])
         res1[0] = newRes
         if res['isVerify'] == 1:
             res1[1].append(res)
         if res['isVerify'] != 1:
             res1[2].append(res)
     return res1, 200
Esempio n. 7
0
 def get(self):
     """查看申请我工作的学生"""
     parser = reqparse.RequestParser()
     parser.add_argument('useId', type=int, location='values')
     args = parser.parse_args()
     com = Company.query.filter(
         and_(Company.isDel == 0,
              Company.uId == args['useId'])).first_or_404()
     resForm = db.session.query(Job_Signup.creatTime, Job_Signup.status, Job.startTime, Job.endTime, Job.tittle,
                                Job.id.label("jid"), Student.sname, Student.uId.label("uid")). \
         join(Job, Job_Signup.jobId == Job.id). \
         join(Student, Job_Signup.stuId == Student.id). \
         filter(Job.cId == com.id).order_by(Job_Signup.id.desc()).all()
     newRes = queryToDict(resForm)
     res1 = [[], [], []]
     for res in newRes:
         res['creatTime'] = get_from_timestamp(res['creatTime'])
         res1[0] = newRes
         if res['status'] == 1:
             res1[1].append(res)
         if res['status'] != 1:
             res1[2].append(res)
     return res1, 200
Esempio n. 8
0
def getPercentage(data, percentage):
    for key in queryToDict(data):
        if queryToDict(data)[key]:
            percentage += 3.5
    return percentage