예제 #1
0
def lagouPlus(templateId):
    '''
    终止当前套餐
    新增17套餐
    查看套餐是否正常
    :return:
    '''
    login_home_code('00853', 22222222)
    header = get_header("https://home.lagou.com/")
    Request_url = "https://home.lagou.com/crm/contractController/list.json"
    data = {"companyId": 141702}
    object = form_post(url=Request_url,
                       remark="查询当前公司下的合同",
                       data=data,
                       headers=header)
    # childaccount = jsonobject.json()['content']['data']['subAcccountPage']['totalCount']
    number = object['data']['pageData'][0]['number']
    '''
    先终止合同
    '''
    Request_url = "https://home.lagou.com/crm/valueadded/product/close.json"
    data = {"contractNo": number}
    object = form_post(url=Request_url,
                       remark="终止所有合同",
                       data=data,
                       headers=header,
                       rd='杨振宇')
    '''
    增加17版合同,增加的固定合同
    '''
    contractnumurl = "https://home.lagou.com/crm/valueadded/product/open.json"

    data = {
        "templateId": templateId,
        "num": 1,
        "companyId": 14,
        "contractNo": "LG-HD-WANGXIA-2019030401",
        "userId": 84,
        "startTimeStr": "2019-01-07",
        "endTimeStr": "2020-01-10",
        "upgrade": "false"
    }
    object = form_post(url=contractnumurl,
                       remark="新增合同, 其id: " + str(templateId),
                       data=data,
                       headers=header)
예제 #2
0
    def post(self):
        parser = reqparse.RequestParser()
        parser.add_argument('companyId', type=int, help="请输入正确公司id")
        parser.add_argument('userId', type=int, help="请输入正确userid")
        parser.add_argument('startTimeStr',
                            type=str,
                            help="请输入正确日期: yyyy-mm-dd")
        parser.add_argument('endTimeStr', type=str, help="请输入正确日期: yyyy-mm-dd")
        parser.add_argument('can', type=bool, help="请输入布尔值来决定是否终止已有的合同")
        parser.add_argument('templateName', type=str, help="请输入产品套餐名称")
        args = parser.parse_args()
        try:
            templateId = get_product_template_id(args['templateName'])
            print(templateId)
        except:
            return {'state': 400, 'content': "未获取有效的产品模板名称, 请重新选择模板"}

        login_r = login_home_code('00853', 22222222)
        state = 0
        try:
            if not (login_r['state'] == 1):
                return {'state': 400, 'content': "登录失败, 请重试!"}

            contractNo = contractController_list(args['companyId'])
            if args['can'] == False:
                res = open_product(templateId=templateId,
                                   companyId=args['companyId'],
                                   contractNo=contractNo,
                                   userId=args['userId'],
                                   startTimeStr=args['startTimeStr'],
                                   endTimeStr=args['endTimeStr'])
                if res['success'] == True:
                    state = 1
                    content = "开通产品成功!"

            else:
                if close_contract(contractNo) == True:
                    res = open_product(templateId=templateId,
                                       companyId=args['companyId'],
                                       contractNo=contractNo,
                                       userId=args['userId'],
                                       startTimeStr=args['startTimeStr'],
                                       endTimeStr=args['endTimeStr'])
                    if res['success'] == True:
                        state = 1
                        content = "开通产品成功!"

        except:
            return {'state': 400, 'content': "开通产品失败, 请重试!"}

        return {'state': state, 'content': content}
예제 #3
0
    def post(self):
        """
        @@@
        ### Auther = Xiawang

        ### B端注册加入公司-招聘者认证提交及审核流程


        ### Request Header
        | 字段 | 值 |
        | ---- | ---- |
        | method | POST |
        | content-type | application/json |


        ### 参数

        | 字段 | 必填 | 类型 | 描述|
        | ---- | ---- | ---- | ---- |
        | countryCode | True | string | B端注册用户手机号的地区编号 |
        | phone | True | string | B端注册用户的手机号 |
        | userName | True | string | B端注册用户的姓名 |
        | companyFullName | True | string | 已有的B端公司的全称 |
        | resumeReceiveEmail | True | string | B端注册用户接收简历的邮箱 |

        ### 请求示例
        ```json
        {
            "countryCode": "00852",
            "phone": "20030902",
            "userName": "******",
            "companyFullName": "烽火啊啊啊",
            "resumeReceiveEmail": "*****@*****.**"
        }
        ```


        ### 返回

        | 字段 | 类型 | 描述|
        | ---- | ---- | ---- | ---- |
        | state | int | 1表示成功, 400表示错误 |
        | content | string | 构造数据的结果 |
        | data | dict | 构造成功数据的具体信息 |
        | HRInfo | dict | 招聘者信息 |
        | CompanyInfo | dict | 公司信息 |
        | Application | dict | 招聘者和公司的认证的申请结果 |
        | ApproveInfo | string | 招聘者和公司的认证的审核结果 |

        ### 响应示例
        ```json
        {
            "state": 1,
            "content": "B端注册加入公司-招聘者认证提交及审核流程通过!",
            "data": {
                "HRInfo": {
                    "phone": "20021215",
                    "countryCode": "00852",
                    "userId": 100016374
                },
                "CompanyInfo": {
                    "companyFullName": "拉勾测试自动化default公司",
                    "companyId": 142136
                },
                "ApproveInfo": {
                    "passPersonApprove": "招聘者认证提交及审核通过"
                }
            }
        }
        ```

        @@@
        """
        parser = reqparse.RequestParser()
        parser.add_argument('countryCode',
                            type=str,
                            help="请输入B端注册用户手机号的归属区号",
                            required=True)
        parser.add_argument('phone',
                            type=str,
                            help="请输入B端注册用户的手机号",
                            required=True)
        parser.add_argument('userName',
                            type=str,
                            help="请输入B端注册用户的姓名",
                            default=fake.name())
        parser.add_argument('userPosition', type=str, help="请输入B端注册用户的职位")
        parser.add_argument('resumeReceiveEmail',
                            type=str,
                            help="请输入接收简历的邮箱地址",
                            default=fake.email())
        parser.add_argument('companyFullName',
                            type=str,
                            help="请输入已注册公司的全称",
                            required=True)
        args = parser.parse_args()
        HRInfo = {}
        CompanyInfo = {}
        ApproveInfo = {}
        r1, r2, r3, r4 = add_people_into_company(
            args['phone'], args['countryCode'], args['companyFullName'],
            args['userName'], args['resumeReceiveEmail'], args['userPosition'])
        state = 0
        try:
            if r1['state'] != 1:
                state = 400
                info = "该手机号已被注册, 该用户的手机号: " + args['phone']

            if r2['state'] != 1:
                state = 400
                info = "上传B端用户信息失败,该用户的手机号: " + args['userName']

            if r3['state'] != 1:
                state = 400
                info = "B端加入公司失败,该公司全称:" + args['companyFullName']

            if r4['state'] != 1:
                state = 400
                info = "B端提交招聘者审核失败,该公司简称: " + args['companyFullName']
        except TypeError:
            info = info

        if not (state == 400):
            if r1['state'] == r2['state'] == r3['state'] == r4['state'] == 1:
                state = 3
                HRInfo['phone'] = args['phone']
                HRInfo['countryCode'] = args['countryCode']
                CompanyInfo['companyFullName'] = args['companyFullName']

            login_res = login_home_code('00853', 22222222)
            if not (login_res['state'] == 1):
                info = "home后台登录失败,无法继续审核操作"
            else:
                r51, r52, r53 = passPersonApprove()
                try:
                    if r51['success'] != True:
                        state = 400
                        info = "home后台-审核中心-个人认证-审核招聘者失败, 该公司的简称: " + args[
                            'companyFullName']
                    else:
                        CompanyInfo['companyId'] = r52
                        HRInfo['userId'] = r53
                        ApproveInfo['passPersonApprove'] = "招聘者认证提交及审核通过"
                        state = 1
                except TypeError:
                    info = info

        if state == 1:
            return {
                "state": 1,
                "content": "B端注册加入公司-招聘者认证提交及审核流程通过!",
                "data": {
                    "HRInfo": HRInfo,
                    "CompanyInfo": CompanyInfo,
                    "ApproveInfo": ApproveInfo
                }
            }
        return {"state": 400, "content": "执行失败", "faiinfo": info}
예제 #4
0

def open_product(templateId, companyId, contractNo, userId, startTimeStr,
                 endTimeStr):
    url = 'https://home.lagou.com/crm/valueadded/product/open.json'
    header = get_header('https://home.lagou.com/')
    data = {
        'templateId': templateId,
        'num': 100,
        'companyId': companyId,
        'contractNo': contractNo,
        'userId': userId,
        'startTimeStr': startTimeStr,
        'endTimeStr': endTimeStr,
        'upgrade': False
    }
    return form_post(url=url,
                     data=data,
                     headers=header,
                     remark='开启合同',
                     rd='杨振宇')


def parase_product_info():
    pass


if __name__ == '__main__':
    login_home_code('00853', 22222222)
    # print(product_info())
예제 #5
0
    def post(self):
        """
        @@@
        ### Auther = Xiawang

        ### B端注册-公司成立-招聘者认证提交及审核-公司认证及审核流程


        ### Request Header
        | 字段 | 值 |
        | ---- | ---- |
        | method | POST |
        | content-type | application/json |


        ### 参数

        | 字段 | 必填 | 类型 | 描述|
        | ---- | ---- | ---- | ---- |
        | countryCode | True | string | B端注册用户手机号的地区编号 |
        | phone | True | string | B端注册用户的手机号 |
        | userName | True | string | B端注册用户的姓名 |
        | companyShortName | True | string | B端注册公司的简称 |
        | companyFullName | True | string | B端注册公司的全称 |
        | updateCompanyShortName | True | string | B端注册公司的别称 |
        | resumeReceiveEmail | True | string | B端注册用户接收简历的邮箱 |

        ### 请求示例
        ```json
        {
            "countryCode": "00852",
            "phone": "20030902",
            "userName": "******",
            "companyShortName": "烽火啊啊啊",
            "companyFullName": "烽火啊啊啊",
            "updateCompanyShortName": "烽火啊啊啊",
            "resumeReceiveEmail": "*****@*****.**"
        }
        ```


        ### 返回

        | 字段 | 类型 | 描述|
        | ---- | ---- | ---- | ---- |
        | state | int | 1表示成功, 400表示错误 |
        | content | string | 构造数据的结果 |
        | data | dict | 构造成功数据的具体信息 |
        | HRInfo | dict | 招聘者信息 |
        | CompanyInfo | dict | 公司信息 |
        | Application | dict | 招聘者和公司的认证的申请结果 |
        | ApproveInfo | string | 招聘者和公司的认证的审核结果 |

        ### 响应示例
        ```json
        {
            "state": 1,
            "content": "B端注册-公司成立-招聘者认证提交及审核-公司认证及审核流程通过!",
            "data": {
                "HRInfo": {
                    "phone": "20010011",
                    "countryCode": "00852",
                    "userId": 100016375
                },
                "CompanyInfo": {
                    "companyShortName": "jjjjjj1",
                    "companyFullName": "jjjjjj1",
                    "companyId": 142419
                },
                "Application": {
                    "person": "招聘者申请认证成功",
                    "company": "公司申请认证成功"
                },
                "ApproveInfo": {
                    "passPersonApprove": "招聘者认证提交及审核通过",
                    "passCompanyApprove": "公司认证提交及审核通过"
                }
            }
}
        ```

        @@@
        """
        company_name = fake.company()
        parser = reqparse.RequestParser()
        parser.add_argument('countryCode',
                            type=str,
                            help="请输入B端注册用户手机号的归属区号",
                            required=True)
        parser.add_argument('phone',
                            type=str,
                            help="请输入B端注册用户的手机号",
                            required=True)
        parser.add_argument('userName',
                            type=str,
                            default=fake.name(),
                            help="请输入B端注册用户的姓名")
        parser.add_argument('userPosition',
                            type=str,
                            default='ceo',
                            help="请输入B端注册用户的职位")
        parser.add_argument('resumeReceiveEmail',
                            type=str,
                            default=fake.email(),
                            help="请输入接收简历的邮箱地址")
        parser.add_argument('companyShortName',
                            type=str,
                            default=company_name,
                            help="请输入注册公司的简称,要唯一")
        parser.add_argument('companyFullName',
                            type=str,
                            default=company_name,
                            help="请输入注册公司的全称,要唯一")
        parser.add_argument('checkedindustryField', help="请输入注册公司的行业标签")
        parser.add_argument('financeStage', help="请输入发展阶段")
        # 为构造校招职位增加的字段,之后补充至平台上
        parser.add_argument('detailAddress', help="请输入详细地址")
        parser.add_argument('provinceId', type=int, help="请输入省、直辖市id")
        parser.add_argument('cityId', type=int, help="请输入城市id")
        parser.add_argument('districtId', type=int, help="请输入区域id")
        parser.add_argument('businessArea', help="请输入商圈")
        parser.add_argument('companyLng', help="请输入经度")
        parser.add_argument('companyLat', help="请输入维度")

        args = parser.parse_args()
        HRInfo = {}
        CompanyInfo = {}
        ApproveInfo = {}
        Application = {}
        info = None
        if bool(args['checkedindustryField']) == True:
            industryField = ",".join(json.loads(args['checkedindustryField']))
            # industryField = args['checkedindustryField']
        else:
            industryField = '电商'
        r1, r2, r3, r4 = creatCompany_process(
            args['phone'], args['countryCode'], args['companyShortName'],
            args['companyFullName'], args['userName'],
            args['resumeReceiveEmail'], args['userPosition'], industryField,
            args['financeStage'])
        state = 0
        try:
            if r1['state'] != 1:
                state = 400
                info = "该手机号登录失败, 该用户的手机号: " + args['phone']

            if r2['state'] != 1:
                state = 400
                info = "上传B端用户信息失败,该用户的手机号: " + args['userName']

            if r3['state'] != 1:
                state = 400
                info = "B端成立公司失败,该公司简称:" + args['companyShortName']

            if r4['state'] != 1:
                state = 400
                info = "B端提交招聘者审核失败,该公司简称: " + args['companyShortName']
        except TypeError:
            info = info

        if not (state == 400):
            if r1['state'] == r2['state'] == r3['state'] == r4['state'] == 1:
                state = 1
                HRInfo['phone'] = args['phone']
                HRInfo['countryCode'] = args['countryCode']
                CompanyInfo['companyShortName'] = args['companyShortName']
                CompanyInfo['companyFullName'] = args['companyFullName']

            try:
                login_home_code('00853', 22222222)
                r51, r52, r53 = passPersonApprove()
                if r51['success'] != True:
                    state = 400
                    info = "home后台-审核中心-个人认证-审核招聘者失败, 该公司的简称: " + args[
                        'companyShortName']
            except TypeError:
                state = 400
                info = info

            login_r = login(args['countryCode'], args['phone'])
            try:
                if login_r['state'] == 1:
                    # if not args['detailAddress'] is None:
                    #     [r6, r7] = completeInfo_process(detailAddress=args['detailAddress'], provinceId=args['provinceId'],
                    #                                     cityId=args['cityId'], districtId=args['districtId'],
                    #                                     businessArea=args['businessArea'], companyLng=args['companyLng'],
                    # #                                     companyLat=args['companyLat'])
                    # else:
                    r6, r7 = completeInfo_process()
                if r6['state'] != 1:
                    state = 400
                    info = "上传营业执照失败, 该公司的简称: " + args['companyShortName'] + ","
                elif r7['state'] != 1:
                    state = 400
                    info = "简称为 " + args['companyShortName'] + " 申请认证公司失败"
            except TypeError:
                state = 400
                info = info

            if not (state == 400):
                if r4['state'] == r7['state'] == 1:
                    Application['person'] = "招聘者申请认证成功"
                    Application['company'] = "公司申请认证成功"
                    state = 2

                login_res = login_home_code('00853', 22222222)
                if not (login_res['state'] is 1):
                    info = "home后台登录失败,无法继续审核操作"
                else:
                    r8 = passCompanyApprove()
                if r8['success'] != True:
                    state = 400
                    info = "home后台-公司认证-审核公司成功!该公司的简称: " + args[
                        'companyShortName']

                if r51['success'] == True and r6['state'] == 1 and r8[
                        'success'] == True:
                    ApproveInfo['passPersonApprove'] = "招聘者认证提交及审核通过"
                    ApproveInfo['passCompanyApprove'] = "公司认证提交及审核通过"
                    CompanyInfo['companyId'] = r52
                    HRInfo['userId'] = r53
                    state = 1

        if state == 1:
            return {
                "state": 1,
                "content": "B端注册-公司成立-招聘者认证提交及审核-公司认证及审核流程通过!",
                "data": {
                    "HRInfo": HRInfo,
                    "CompanyInfo": CompanyInfo,
                    "Application": Application,
                    "ApproveInfo": ApproveInfo
                }
            }
        return {"state": 400, "content": "执行失败", "faiinfo": info}
예제 #6
0
    def post(self):
        '''
                @@@
                ### home后台-拉勾加-合同导入

                ### Author = Xiawang

                ### Request Header
                | 字段 | 值 |
                | ---- | ---- |
                | method | POST |
                | content-type | application/json |


                ### 参数

                | 字段 | 必填 | 类型 | 描述|
                | ---- | ---- | ---- | ---- |
                | companyId | True | string | 公司id |
                | contractNo | True | string | 合同编号, 注意唯一性 |



                ### 请求示例
                ```json
                 {
                    "companyId":"1",
                    "contractNo":"fkdshjfd1"
                }
                ```


                ### 返回

                | 字段 | 类型 | 描述|
                | ---- | ---- | ---- | ---- |
                | state | int | 1表示成功, 400表示错误 |
                | content | string | 合同导入的结果 |



                ### 响应示例
                ```json
                {
                    "state": 1,
                    "content": "导入公司联系人信息 导入成功! 导入合同信息 导入成功! "
                }
                ```

                @@@
                '''
        parser = reqparse.RequestParser()
        parser.add_argument('companyId',
                            type=str,
                            help="请输入公司id",
                            required=True)
        parser.add_argument('contractNo',
                            type=str,
                            help="请输入合同编号, 注意唯一性",
                            required=True)
        args = parser.parse_args()
        state = 0
        info1 = ''
        info2 = ''
        login_res = login_home_code('00853', 22222222)
        if login_res['state'] == 1:
            import1_res = import_linkManInfo(args['companyId'],
                                             args['contractNo'])
            if import1_res['success'] == True:
                state = 1
                info1 = "导入公司联系人信息 导入成功! "
            else:
                state = 400
                info1 = "导入公司联系人信息 导入失败! "

            import2_res = import_contacts(args['companyId'],
                                          args['contractNo'])
            if import2_res['success'] == True:
                state = 1
                info2 = "导入合同信息 导入成功! "
            else:
                state = 400
                info2 = "导入合同信息 导入失败! "
        else:
            state = 400
            info1 = "登录home后台失败, 无法继续数据导入流程, 请重试! "
        return {'state': state, 'content': info1 + info2}
예제 #7
0
        "auditStatusType": "wait"
    }
    queryPerson_header = get_header(referer_queryPerson_home_url)
    remark = "验证home后台-审核中心-倒序获取招聘者的id是否成功"
    queryPerson_res = form_post(url=queryPerson_url,
                                data=queryPerson_data,
                                headers=queryPerson_header,
                                remark=remark)

    try:
        personCheckId = queryPerson_res['data']['pageData'][0]['personCheck'][
            'id']
        companyId = queryPerson_res['data']['pageData'][0]['companyCheckVo'][
            'companyId']
        userId = queryPerson_res['data']['pageData'][0]['personCheckVo'][
            'userId']
    except KeyError:
        personCheckId, companyId, userId = None, None, None

    passPersonApprove_url = "https://home.lagou.com/audit/personApprove/passPersonApprove.json"
    passPersonApprove_data = {"personCheckId": personCheckId}
    remark = "验证home后台-审核中心-个人认证-审核招聘者是否成功"
    return form_post(url=passPersonApprove_url,
                     data=passPersonApprove_data,
                     headers=queryPerson_header,
                     remark=remark), companyId, userId


if __name__ == '__main__':
    login_home_code('00853', '22222222')
    passPersonApprove()
예제 #8
0
def login_home_k8s_default():
    login_home_code('00853', 22222222)