Esempio n. 1
0
    def _unit_login(self, params: dict):
        err_msg = None
        if params:
            try:
                self._check_login_params(params)
                self.result_key = params.get('用户名')
                # 保存到meta
                self.result_meta['证件号码'] = params.get('证件号码')
                self.result_meta['个人账号'] = params.get('个人账号')

                raise TaskNotImplementedError('查询服务维护中')
            except (AssertionError, InvalidParamsError) as e:
                err_msg = str(e)

        raise AskForParamsError([
            dict(key='证件号码',
                 name='证件号码',
                 cls='input',
                 placeholder='证件号码(以单位申报为准)',
                 value=params.get('证件号码', '')),
            dict(key='个人账号',
                 name='个人账号',
                 cls='input',
                 placeholder='对帐簿或原存折帐号后8位',
                 value=params.get('个人账号', '')),
        ], err_msg)
Esempio n. 2
0
    def _unit_login(self, params=None):
        err_msg = None
        if params:
            # 非开始或者开始就提供了参数
            try:
                self._check_login_params(params)
                id_num = params.get("证件号")
                username=params.get("姓名")
                account_pass = params.get("密码")
                vc = params.get("vc")

                # self._do_login(id_num, username,account_pass, vc)

                self.result_key = id_num
                self.result_meta['证件号'] =id_num
                self.result_meta['姓名'] = username
                self.result_meta['密码']=account_pass

                raise TaskNotImplementedError('查询服务维护中')

            except (AssertionError, InvalidParamsError) as e:
                err_msg = str(e)

        raise AskForParamsError([
            dict(key='证件号', name='证件号', cls='input',value=params.get('证件号', '')),
            dict(key='姓名', name='姓名', cls='input', value=params.get('姓名', '')),
            dict(key='密码', name='密码', cls='input:password',value=params.get('密码', '')),
            dict(key='vc', name='验证码', cls='data:image', query={'t': 'vc'}),
        ], err_msg)
Esempio n. 3
0
    def _unit_login(self, params=None):
        err_msg = None
        if params:
            # 非开始或者开始就提供了参数
            try:
                self._check_login_params(params)
                id_num = params['id_num']
                account_num = params['account_num']
                vc = params['vc']

                resp = self.s.post(LOGIN_URL, data=dict(
                    sfzh=id_num,
                    grbh=account_num,
                    yzcode=vc
                ))
                data = resp.json()
                errormsg = data.get('errormsg')
                if errormsg:
                    raise InvalidParamsError(errormsg)

                self.result['key'] = id_num
                self.result['meta'] = {
                    'id_num': id_num,
                    'account_num': account_num
                }
                return
            except (AssertionError, InvalidParamsError) as e:
                err_msg = str(e)

        raise AskForParamsError([
            dict(key='id_num', name='身份证号', cls='input'),
            dict(key='account_num', name='个人编号', cls='input'),
            dict(key='vc', name='验证码', cls='data:image', query={'t': 'vc'}),
        ], err_msg)
Esempio n. 4
0
    def _unit_login(self, params=None):
        err_msg = None
        if params:
            # 非开始或者开始就提供了参数
            try:
                self._check_login_params(params)
                sfzh = params['sfzh']
                password = base64.b64encode(params['password'].encode(encoding="utf-8"))
                vc = params['vc']

                resp = self.s.post(LOGIN_URL, data=dict(
                    sfzh=sfzh,
                    password=password,
                    validateCode=vc
                ))
                data = resp.json()
                errormsg = data.get('message')
                if data.get('code') == '0':
                    raise InvalidParamsError(errormsg)

                self.result_key = sfzh
                self.result_meta.update({
                    '身份证编号': sfzh,
                    '密码': params['password']
                })
                return
            except (AssertionError, InvalidParamsError) as e:
                err_msg = str(e)

        raise AskForParamsError([
            dict(key='sfzh', name='身份证号', cls='input', value=params.get('sfzh', '')),
            dict(key='password', name='密码', cls='input:password', value=params.get('password', '')),
            dict(key='vc', name='验证码', cls='data:image', query={'t': 'vc'}, value=params.get('vc', '')),
        ], err_msg)
Esempio n. 5
0
    def _unit_login(self, params: dict):
        err_msg = None
        if params:
            try:
                self._check_login_params(params)
                self.result_key = params.get('身份证号')
                # 保存到meta
                self.result_meta['身份证号'] = params.get('身份证号')
                self.result_meta['密码'] = params.get('密码')

                raise TaskNotImplementedError('查询服务维护中')
            except (AssertionError, InvalidParamsError) as e:
                err_msg = str(e)

        raise AskForParamsError([
            dict(key='身份证号',
                 name='身份证号',
                 cls='input',
                 placeholder='身份证号',
                 value=params.get('身份证号', '')),
            dict(key='密码',
                 name='密码',
                 cls='input:password',
                 value=params.get('密码', '')),
        ], err_msg)
Esempio n. 6
0
    def _unit_login(self, params=None):
        err_msg = None
        if params:
            try:
                self._check_login_params(params)

                id_num = params['账号']
                pass_word = params['密码']
                vc = params['vc']

                self._do_login(id_num, pass_word, vc)

                #  登录成功
                # 保存到meta
                self.result_key = id_num
                self.result_meta['账号'] = id_num
                self.result_meta['密码'] = pass_word

                return
            except (AssertionError, InvalidParamsError) as e:
                err_msg = str(e)

        raise AskForParamsError([
            dict(key='账号', name='账号', cls='input', value=params.get('账号', '')),
            dict(key='密码',
                 name='密码',
                 cls='input:password',
                 value=params.get('密码', '')),
            dict(key='vc', name='验证码', cls='data:image', query={'t': 'vc'}),
        ], err_msg)
Esempio n. 7
0
    def _unit_login(self, params=None):
        err_msg = None
        if params:
            # 非开始或者开始就提供了参数
            try:
                self._check_login_params(params)
                username = params['username']
                password = params['password']
                vc = params['vc']
                self.ua.login(username, password, vc)

                self.result['key'] = username
                self.result['meta'] = {
                    'username': username,
                    'password': password
                }
                return
            except (AssertionError, InvalidParamsError) as e:
                err_msg = str(e)

        raise AskForParamsError([
            dict(key='username', name='用户名', cls='input'),
            dict(key='password', name='密码', cls='input:password'),
            dict(key='vc', name='验证码', cls='data', query={'t': 'vc'}),
        ], err_msg)
Esempio n. 8
0
    def _unit_login(self, params=None):
        err_msg = None
        params
        if not self.is_start or params:
            # 非开始或者开始就提供了参数
            try:
                self._check_login_params(params)
                id_num = params['用户名']
                password = params['密码']
                vc = params['vc']
                # self._do_login(id_num, password, vc)

                m = hashlib.md5()
                m.update(password.encode(encoding='utf-8'))
                hashpsw = m.hexdigest()
                data = {
                    'password_md5': hashpsw,
                    'username': id_num,
                    'password': password,
                    'imagecode': vc,
                    'ID': '0',
                    'SUBMIT.x': '35',
                    'SUBMIT.y': '8'
                }
                resp = self.s.post(LOGIN_URL,
                                   data=data,
                                   headers={
                                       'Content-Type':
                                       'application/x-www-form-urlencoded',
                                       'Cache-Control': 'max-age=0',
                                       'Upgrade-Insecure-Requests': '1'
                                   },
                                   timeout=20)
                soup = BeautifulSoup(resp.content.decode('gbk'), 'html.parser')

                errormsg = soup.findAll('font')[0].text
                # if errormsg and errormsg != id_num:
                #     raise InvalidParamsError(errormsg)
                if errormsg == id_num:
                    self.g.soup = soup
                else:
                    raise InvalidParamsError(errormsg)

                self.result_key = id_num
                self.result_meta['用户名'] = id_num
                self.result_meta['密码'] = password
                self.result_identity['task_name'] = '上海'
                self.result_identity['target_id'] = id_num

                return
            except (AssertionError, InvalidParamsError) as e:
                err_msg = str(e)

        vc = self._new_vc()
        raise AskForParamsError([
            dict(key='用户名', name='用户名', cls='input'),
            dict(key='密码', name='密码', cls='input:password'),
            dict(key='vc', name='验证码', cls='data:image', query={'t': 'vc'}),
        ], err_msg)
Esempio n. 9
0
    def _unit_login(self, params: dict):
        err_msg = None
        if params:
            try:
                self._check_login_params(params)
                id_num = params['身份证号']
                password = params['密码']
                m = hashlib.md5()
                m.update(str(password).encode(encoding="utf-8"))
                pw = m.hexdigest()
                vc = params['vc']
                respvc = self.s.post(
                    'http://218.28.166.74:8080/zzsbonline/companyAction!getRandCode',
                    data=dict(code=vc))
                vctext = BeautifulSoup(respvc.content, 'html.parser')
                if vctext.text == '0':
                    resp = self.s.post(LOGIN_URL,
                                       data=dict(cardid=id_num,
                                                 password=pw,
                                                 vcode=vc))
                    soup = BeautifulSoup(resp.content, 'html.parser')
                    msg = json.loads(soup.text)
                    err_msg = msg['msgbox']
                    if err_msg == '用户成功登录':
                        err_msg = ''
                else:
                    err_msg = '验证码错误!'
                if err_msg:
                    raise InvalidParamsError(err_msg)
                else:
                    print("登录成功!")

                self.result_key = params.get('身份证号')
                # 保存到meta
                self.result_meta['身份证号'] = params.get('身份证号')
                self.result_meta['密码'] = params.get('密码')

                self.result_identity['task_name'] = '郑州'
                self.result_identity['target_id'] = id_num
                return
            except (AssertionError, InvalidParamsError) as e:
                err_msg = str(e)
        vc = self._new_vc()
        raise AskForParamsError([
            dict(key='身份证号',
                 name='身份证号',
                 cls='input',
                 placeholder='身份证号',
                 value=params.get('身份证号', '')),
            dict(key='密码',
                 name='密码',
                 cls='input:password',
                 value=params.get('密码', '')),
            dict(key='vc',
                 name='验证码',
                 cls='data:image',
                 query={'t': 'vc'},
                 value=params.get('vc', '')),
        ], err_msg)
Esempio n. 10
0
    def _unit_login(self, params=None):
        err_msg = None
        params
        if not self.is_start or params:
            # 非开始或者开始就提供了参数
            try:
                self._check_login_params(params)
                id_num = params['身份证号']
                #account_num = params['account_num']
                password=params['密码']
                vc = params['vc']
                resp=self.s.post(LOGINONE_URL,data=dict(
                     aac147=id_num
                 ))
                soup = BeautifulSoup(resp.content, 'html.parser')
                if len(soup.text)>0:
                    raise InvalidParamsError(soup.text)
                else:
                    m = hashlib.md5()
                    m.update(password.encode(encoding='utf-8'))
                    hashpsw=m.hexdigest()
                    resp = self.s.post(LOGIN_URL,data = dict(
                        method='login',
                        domainId='1',
                        groupid='-95',
                        checkCode=vc,
                        loginName18=id_num,
                        loginName=id_num,
                        password=hashpsw,
                        kc02flag=''
                    ))
                    if resp.url==PASS_URl:
                        raise InvalidParamsError('请登录官网修改密码 !说明:1、为保证信息安全,密码不能为个人编号。2、密码长度需大于6位小于18位。')
                    elif resp.url==MB_URL:
                        raise InvalidParamsError('请登录官网修改密保 !说明:注:1、请设置密保问题,密保问题不要随意泄露。2、密保问题作为找回密码的依据,请妥善保存。')
                    else:
                        soup = BeautifulSoup(resp.content, 'html.parser')
                        if soup.select('.text3'):
                            return_message=soup.select('.text3')[0].text
                            raise InvalidParamsError(return_message)
                        else:
                            print("登录成功!")

                self.result_key = id_num
                self.result_meta['身份证号'] = id_num
                self.result_meta['密码'] = password
                self.result_identity['task_name'] = '青岛'
                self.result_identity['target_id'] = id_num
                return
            except (AssertionError, InvalidParamsError) as e:
                err_msg = str(e)

        vc = self._new_vc()
        raise AskForParamsError([
            dict(key='身份证号', name='身份证号', cls='input', value=params.get('身份证号', '')),
            dict(key='密码', name='密码', cls='input:password', value=params.get('密码', '')),
            dict(key='vc', name='验证码', cls='data:image', query={'t': 'vc'}, value=params.get('vc', '')),
        ], err_msg)
Esempio n. 11
0
    def _unit_login(self, params: dict):
        err_msg = None
        if params:
            try:
                self._check_login_params(params)
                self.result_key = params.get('用户名')

                id_num = params.get("用户名")
                account_pass = params.get("密码")
                CaptchaId = self.state['CaptchaIds']
                vc = params.get("vc")
                # self.ua.get_vc().replace('*','')
                # self.ua.login(id_num, account_pass, vc)

                # self.result_data['x']=self.ua.x()

                data = {
                    'username': id_num,
                    'password': account_pass,
                    'captchaId': CaptchaId,
                    'captchaWord': vc
                }
                resp = self.s.post(
                    "http://public.hrss.tj.gov.cn/uaa/api/person/idandmobile/login",
                    data=data)
                # if resp.text == "":
                #     raise InvalidParamsError("登录失败")
                # if resp.url.startswith(LOGIN_PAGE_URL + '?error'):
                #     soup = BeautifulSoup(resp.content, 'html.parser')
                #     divs = soup.select('body > div.alert.alert-danger')
                #     err_msg = "登录失败"
                #     if divs and len(divs) > 0:
                #         err_msg = divs[0].text
                #     raise InvalidParamsError(err_msg)
                if 'http://public.hrss.tj.gov.cn/ehrss/si/person/ui/' not in resp.url:
                    raise InvalidParamsError("登录失败,用户名或密码错误!")
                else:
                    # 保存到meta
                    self.result_meta['用户名'] = params.get('用户名')
                    self.result_meta['密码'] = params.get('密码')
                    return
            except (AssertionError, InvalidParamsError) as e:
                err_msg = str(e)

        raise AskForParamsError([
            dict(key='用户名',
                 name='用户名',
                 cls='input',
                 placeholder='手机,社保卡或身份证号',
                 value=params.get('用户名', '')),
            dict(key='密码',
                 name='密码',
                 cls='input:password',
                 value=params.get('密码', '')),
            dict(key='vc', name='验证码', cls='data:image', query={'t': 'vc'}),
        ], err_msg)
Esempio n. 12
0
    def _unit_login(self, params=None):
        err_msg = None
        if not self.is_start or params:
            # 非开始或者开始就提供了参数
            try:
                self._check_login_params(params)
                id_num = params['身份证号']
                account_num = params['个人账号']
                password = params['密码']
                vc = params['vc']

                resp = self.s.post(LOGIN_URL,
                                   data=dict(dispatch='fund_search',
                                             return_message='',
                                             id_card=id_num,
                                             id_account=account_num,
                                             searchpwd=password,
                                             validcode=vc),
                                   verify=False,
                                   timeout=30)
                soup = BeautifulSoup(resp.content, 'html.parser')
                return_message = soup.find('input', {'name': 'return_message'})
                if return_message:
                    return_message = soup.find(
                        'input', {'name': 'return_message'})["value"]
                    if return_message:
                        raise InvalidParamsError(return_message)
                    else:
                        print("登录成功!")
                        self.html = str(resp.content, 'gbk')
                else:
                    return_message = '您输入的信息不符合要求,请到公积金管理中心确认'
                    raise InvalidParamsError(return_message)

                self.result_key = id_num
                self.result_meta['身份证号'] = id_num
                self.result_meta['个人账号'] = account_num
                self.result_meta['密码'] = password

                self.result_identity['task_name'] = '哈尔滨'
                self.result_identity['target_id'] = id_num

                return
            except (AssertionError, InvalidParamsError) as e:
                err_msg = str(e)

        vc = self._new_vc()
        raise AskForParamsError([
            dict(key='身份证号', name='身份证号', cls='input'),
            dict(key='个人账号', name='个人账号', cls='input'),
            dict(key='密码', name='密码', cls='input:password'),
            dict(key='vc', name='验证码', cls='data:image', query={'t': 'vc'}),
        ], err_msg)
Esempio n. 13
0
    def _unit_login(self, params: dict):
        err_msg = None
        if params:
            try:
                self._check_login_params(params)
                id_num = params['身份证号']
                password = params['密码']
                vc = params['vc']
                data = {
                    'ywType': 'login',
                    'SFZHM': id_num,
                    'PASSWORD': password,
                    'imagecheck': vc
                }
                resp = self.s.post(LOGIN_URL,
                                   verify=False,
                                   data=data,
                                   timeout=20)
                soup = BeautifulSoup(resp.content, 'html.parser')
                successinfo = soup.findAll('td')
                if len(successinfo) > 0:
                    successinfo = successinfo[4].text
                else:
                    successinfo = ''
                if successinfo:
                    return_message = successinfo
                    raise InvalidParamsError(return_message)
                else:
                    print("登录成功!")

                self.result_key = id_num
                # 保存到meta
                self.result_meta['身份证号'] = id_num
                self.result_meta['密码'] = params.get('密码')
                self.result_identity['task_name'] = '东莞'
                self.result_identity['target_id'] = id_num
                return
            except (AssertionError, InvalidParamsError) as e:
                err_msg = str(e)

        raise AskForParamsError([
            dict(key='身份证号',
                 name='身份证号',
                 cls='input',
                 placeholder='身份证号',
                 value=params.get('身份证号', '')),
            dict(key='密码',
                 name='密码',
                 cls='input:password',
                 value=params.get('密码', '')),
            dict(key='vc', name='验证码', cls='data:image', query={'t': 'vc'}),
        ], err_msg)
Esempio n. 14
0
    def _unit_login(self, params: dict):
        err_msg = None
        if params:
            try:
                self._check_login_params(params)
                id_num = params['身份证']
                password = params['密码']
                vc = params['vc']
                data = {
                    'sbUser.username': id_num,
                    'sbUser.password': password,
                    'sbUser.yzm': vc
                }
                resp = self.s.post(LOGIN_URL, data=data, timeout=20)
                soup = BeautifulSoup(resp.content, 'html.parser')
                successinfo = soup.text.split(';')
                if successinfo[0].find('alert') == 0:
                    successinfo = successinfo[0].replace('alert(',
                                                         '').replace(')', '')
                elif len(soup.findAll('font')) == 1:
                    successinfo = soup.findAll('font')[0].text
                else:
                    successinfo = ''
                if successinfo:
                    return_message = successinfo
                    raise InvalidParamsError(return_message)
                else:
                    print("登录成功!")

                self.result_key = id_num
                # 保存到meta
                self.result_meta['身份证号'] = id_num
                self.result_meta['密码'] = params.get('密码')
                self.result_identity['task_name'] = '福州'
                self.result_identity['target_id'] = id_num
                return
            except (AssertionError, InvalidParamsError) as e:
                err_msg = str(e)

        raise AskForParamsError([
            dict(key='身份证',
                 name='身份证',
                 cls='input',
                 placeholder='身份证',
                 value=params.get('身份证', '')),
            dict(key='密码',
                 name='密码',
                 cls='input:password',
                 value=params.get('密码', '')),
            dict(key='vc', name='验证码', cls='data:image', query={'t': 'vc'}),
        ], err_msg)
Esempio n. 15
0
    def _unit_login(self, params: dict):
        err_msg = None
        if params:
            try:
                self._check_login_params(params)

                id_num = params.get("社保号")
                account_pass = params.get("密码")
                vc = params.get("vc")

                data = {
                    'id0000': id_num,
                    'userpwd': account_pass,
                    'validateCode': vc,
                    'date': str(time.time() * 1000)[0:13]
                }

                if (account_pass == "123456"):
                    raise TaskNotImplementedError("请先到官网修改密码后再来查询!")

                resp = self.s.post(
                    "https://app.xmhrss.gov.cn/login_dowith.xhtml",
                    data=data,
                    verify=False)
                res = json.loads(resp.text)

                if res['result'] == False:
                    raise InvalidParamsError(res['msg'])
                elif res['result'] == True:

                    # 保存到meta
                    self.result_key = id_num
                    self.result_meta['社保号'] = id_num
                    self.result_meta['密码'] = account_pass

                    return
            except (AssertionError, InvalidParamsError) as e:
                err_msg = str(e)

        raise AskForParamsError([
            dict(key='社保号',
                 name='社保号',
                 cls='input',
                 placeholder='请输入社保号',
                 value=params.get('社保号', '')),
            dict(key='密码',
                 name='密码',
                 cls='input:password',
                 value=params.get('密码', '')),
            dict(key='vc', name='验证码', cls='data:image', query={'t': 'vc'}),
        ], err_msg)
Esempio n. 16
0
    def _unit_login(self, params: dict):
        err_msg = None
        if params:
            try:
                self._check_login_params(params)

                id_num = params.get("用户名")
                account_pass = params.get("密码")
                vc = params.get("vc")

                self._do_login(id_num, account_pass, vc)

                # data = {
                #     'userid': id_num,
                #     'userpw': account_pass,
                #     'userjym': vc.encode('gbk'),
                # }
                # resp = self.s.post("http://www.12333sh.gov.cn/sbsjb/wzb/dologin.jsp", data=data)
                # # 检查是否登录成功
                # if resp.status_code != 200:
                #     raise InvalidParamsError("登录失败")
                #
                # if resp.url != LOGIN_SUCCESS_URL:
                #     soup = BeautifulSoup(resp.content, 'html.parser')
                #     spans = soup.select('tr > td > span')
                #     err_msg = "登录失败"
                #     if spans and len(spans) > 0:
                #         err_msg = spans[0].text
                #     raise InvalidParamsError(err_msg)

                # 设置key
                self.result_key = params.get('用户名')
                # 保存到meta
                self.result_meta['用户名'] = params.get('用户名')
                self.result_meta['密码'] = params.get('密码')
                return
            except (AssertionError, InvalidParamsError) as e:
                err_msg = str(e)

        raise AskForParamsError([
            dict(key='用户名',
                 name='用户名',
                 cls='input',
                 placeholder='请输入身份证号',
                 value=params.get('用户名', '')),
            dict(key='密码',
                 name='密码',
                 cls='input:password',
                 value=params.get('密码', '')),
            dict(key='vc', name='验证码', cls='data:image', query={'t': 'vc'}),
        ], err_msg)
Esempio n. 17
0
    def _unit_login(self, params: dict):
        err_msg = None
        if params:
            try:
                self._check_login_params(params)
                id_num = params['身份证号']
                password = params['密码']
                vc = params['vc']
                data = {
                    'name': id_num,
                    'password': password,
                    'yzm': vc,
                    'logintype': '0',
                    'usertype': '10',
                    'dn': '',
                    'signdata': '',
                    '1': 'y'
                }
                resp = self.s.post(LOGIN_URL, data=data, timeout=20)
                soup = BeautifulSoup(resp.content, 'html.parser')
                successinfo = json.loads(soup.text)
                if successinfo['success']:
                    print("登录成功!")
                else:
                    return_message = successinfo['msg']
                    raise InvalidParamsError(return_message)

                self.result_key = params.get('身份证号')
                # 保存到meta
                self.result_meta['身份证号'] = params.get('身份证号')
                self.result_meta['密码'] = params.get('密码')
                self.result_identity['task_name'] = '青岛'

                return
            except (AssertionError, InvalidParamsError) as e:
                err_msg = str(e)

        raise AskForParamsError([
            dict(key='身份证号',
                 name='身份证号',
                 cls='input',
                 placeholder='身份证号',
                 value=params.get('身份证号', '')),
            dict(key='密码',
                 name='密码',
                 cls='input:password',
                 value=params.get('密码', '')),
            dict(key='vc', name='验证码', cls='data:image', query={'t': 'vc'}),
        ], err_msg)
Esempio n. 18
0
    def _unit_login(self, params: dict):
        err_msg = None
        if params:
            try:
                self._check_login_params(params)
                id_num = params['用户名']
                password = params['密码']
                vc = params['vc']
                data = {
                    'username': id_num,
                    'password': password,
                    'captchaWord': vc,
                    'captchaId': self.state['captchaId']
                }
                resp = self.s.post(LOGIN_URL, data=data, timeout=20)
                if resp.url == 'http://221.207.175.178:7989/uaa/personlogin?error':
                    resp = self.s.get(
                        'http://221.207.175.178:7989/uaa/personlogin?error')
                    soup = BeautifulSoup(resp.content, 'html.parser')
                    return_message = soup.findAll('div')[0].text.replace(
                        '\n', '').replace('\t', '')
                    raise InvalidParamsError(return_message)
                else:
                    soup = BeautifulSoup(resp.content, 'html.parser')
                    self.g.code = self.s.get(soup.text.split('"')[1]).url
                    print("登录成功!")
                self.result_key = id_num
                # 保存到meta
                self.result_meta['用户名'] = id_num
                self.result_meta['密码'] = password
                self.result_identity['task_name'] = '哈尔滨'
                self.result_identity['target_id'] = id_num
                return
            except (AssertionError, InvalidParamsError) as e:
                err_msg = str(e)

        raise AskForParamsError([
            dict(key='用户名',
                 name='用户名',
                 cls='input',
                 placeholder='社保卡或身份证',
                 value=params.get('用户名', '')),
            dict(key='密码',
                 name='密码',
                 cls='input:password',
                 value=params.get('密码', '')),
            dict(key='vc', name='验证码', cls='data:image', query={'t': 'vc'}),
        ], err_msg)
Esempio n. 19
0
    def _unit_login(self, params=None):
        err_msg = None
        if not self.is_start or params:
            # 非开始或者开始就提供了参数
            try:
                self._check_login_params(params)

                # id_num = params.get("身份证号")
                # account_pass = params.get("密码")
                # #vc = params.get("vc")
                #
                # data={
                #     'username': id_num,
                #     'password': account_pass,
                #     'loginType': 4,
                #     'vertcode':'',
                #     'bsr':'chrome / 61.0.3163.79',
                #     'vertype': 1
                # }
                # resp=self.s.post(LOGIN_URL,data)
                # if 'html' not in resp.text:
                #     raise InvalidParamsError("登录失败,用户名或密码错误!")
                # else:
                #     # 保存到meta
                #     self.result_key = id_num
                #     self.result_meta['身份证号'] = id_num
                #     self.result_meta['密码'] = account_pass
                #     return

                raise TaskNotImplementedError('查询服务维护中')

            except (AssertionError, InvalidParamsError) as e:
                err_msg = str(e)

        raise AskForParamsError(
            [
                dict(key='身份证号',
                     name='身份证号',
                     cls='input',
                     placeholder='身份证号/手机号码/个人账号',
                     value=params.get('身份证号', '')),
                dict(key='密码',
                     name='密码',
                     cls='input:password',
                     value=params.get('密码', '')),
                #dict(key='vc', name='验证码', cls='data:image', query={'t': 'vc'}),
            ],
            err_msg)
Esempio n. 20
0
    def _unit_login(self, params=None):
        err_msg = None
        if params:
            # 非开始或者开始就提供了参数
            try:
                self._check_login_params(params)
                id_num = params.get("社保号")
                account_pass = params.get("密码")
                vc = params.get("vc")

                data = {
                    'Method': 'P',
                    'pid': '1373174326875',  #  str(time.time()*1000)[0:13]
                    'j_username': id_num,
                    'j_password': account_pass,
                    'jcaptcha_response': vc
                }
                resp = self.s.post(
                    "http://grsbcx.sjz12333.gov.cn/j_unieap_security_check.do",
                    data=data)

                if (resp.url !=
                        'http://grsbcx.sjz12333.gov.cn/enterapp.do?method=begin&name=/si&welcome=/si/pages/index.jsp'
                    ):
                    raise InvalidParamsError("登录失败,请重新登录!")
                else:
                    self.result_key = id_num
                    self.result_meta['社保号'] = id_num
                    self.result_meta['密码'] = account_pass
                    return
                #raise TaskNotImplementedError('查询服务维护中')

            except (AssertionError, InvalidParamsError) as e:
                err_msg = str(e)

        raise AskForParamsError([
            dict(key='社保号',
                 name='社保号',
                 cls='input',
                 value=params.get('社保号', '')),
            dict(key='密码',
                 name='密码',
                 cls='input:password',
                 value=params.get('密码', '')),
            dict(key='vc', name='验证码', cls='data:image', query={'t': 'vc'}),
        ], err_msg)
Esempio n. 21
0
    def _unit_login(self, params=None):
        err_msg = None
        if params:
            # 非开始或者开始就提供了参数
            try:
                self._check_login_params(params)
                id_num = params['身份证号']
                account_num = params['个人编号']
                vc = params['vc']

                if account_num.__len__() != 10:
                    raise InvalidParamsError("请录入10位个人编号")

                resp = self.s.post(LOGIN_URL,
                                   data=dict(sfzh=id_num,
                                             grbh=account_num,
                                             yzcode=vc))
                data = resp.json()
                errormsg = data.get('errormsg')
                if errormsg:
                    raise InvalidParamsError(errormsg)

                self.result_key = id_num
                # 保存到meta
                self.result_meta['身份证号'] = id_num
                self.result_meta['个人编号'] = account_num

                self.result_identity['task_name'] = '苏州'
                self.result_identity['target_id'] = id_num

                return
            except (AssertionError, InvalidParamsError) as e:
                err_msg = str(e)

        raise AskForParamsError([
            dict(key='身份证号',
                 name='身份证号',
                 cls='input',
                 value=params.get('身份证号', '')),
            dict(key='个人编号',
                 name='个人编号',
                 cls='input',
                 value=params.get('个人编号', '')),
            dict(key='vc', name='验证码', cls='data:image', query={'t': 'vc'})
        ], err_msg)
Esempio n. 22
0
    def _unit_login(self, params=None):
        err_msg = None
        if not self.is_start or params:
            # 非开始或者开始就提供了参数
            try:
                self._check_login_params(params)
                id_num = params.get("身份证号")
                account_pass = params.get("密码")
                vc = params.get("vc")

                data = {
                    'aaxmlrequest': 'true',
                    'logintype': 'person',
                    'spcode': '',
                    'fromtype': 'null',
                    'IsCheckVerifyCode': 'on',
                    'IdCard': id_num,
                    'PassWord': account_pass,
                    'Ed_Confirmation': vc
                }
                resp = self.s.post(LOGIN_URL, data=data)
                respInfo = BeautifulSoup(resp.content, 'html.parser').findAll(
                    'script')[0].text.split('alert')[1].split(';')[0]
                if ('0' not in respInfo):
                    raise InvalidParamsError(respInfo)
                else:
                    self.result_key = id_num
                    self.result_meta['身份证号'] = id_num
                    self.result_meta['密码'] = account_pass

                    return
            except (AssertionError, InvalidParamsError) as e:
                err_msg = str(e)

        raise AskForParamsError([
            dict(key='身份证号',
                 name='身份证号',
                 cls='input',
                 value=params.get('身份证号', '')),
            dict(key='密码',
                 name='密码',
                 cls='input:password',
                 value=params.get('密码', '')),
            dict(key='vc', name='验证码', cls='data:image', query={'t': 'vc'}),
        ], err_msg)
Esempio n. 23
0
    def _unit_login(self, params=None):
        err_msg = None
        if params:
            try:
                self._check_login_params(params)

                id_num = params.get("用户名")
                account_pass = params.get("密码")
                vc = params.get("vc")

                self._do_login(id_num, account_pass, vc)

                # data = {
                #     'username':id_num,
                #     'password':account_pass,
                #     'checkCode':vc,
                #     'type':'undefined',
                #     'tm':str(time.time()*1000)[0:13],
                # }
                # resp = self.s.post(LOGIN_URL, data=data)
                # res=json.loads(resp.text)
                # if(len(res)>1):
                #     raise InvalidParamsError(res['msg'])
                # else:

                # 保存到meta
                self.result_key = id_num
                self.result_meta['用户名'] = id_num
                self.result_meta['密码'] = account_pass
                return
            except (AssertionError, InvalidParamsError) as e:
                err_msg = str(e)

        raise AskForParamsError([
            dict(key='用户名',
                 name='用户名',
                 cls='input',
                 placeholder='请输入登录号|社会保障号|社保卡号',
                 value=params.get('用户名', '')),
            dict(key='密码',
                 name='密码',
                 cls='input:password',
                 value=params.get('密码', '')),
            dict(key='vc', name='验证码', cls='data:image', query={'t': 'vc'}),
        ], err_msg)
Esempio n. 24
0
    def _unit_login(self, params=None):
        err_msg = None
        if not self.is_start or params:
            # 非开始或者开始就提供了参数
            try:
                self._check_login_params(params)
                id_num = params.get("证件号码")
                account_pass = params.get("密码")
                vc = params.get("vc")

                data = {
                    'certinum': id_num,
                    'perpwd': account_pass,
                    'vericode': vc
                }

                resp = self.s.post(Post_URL, data=data)
                respInfo = BeautifulSoup(resp.content, 'html.parser')
                infos = respInfo.find('li', {'class': 'text'})
                if (infos != None):
                    raise InvalidParamsError(infos.text)
                else:
                    self.result_key = id_num
                    self.result_meta['证件号码'] = id_num
                    self.result_meta['密码'] = account_pass

                    return
            except (AssertionError, InvalidParamsError) as e:
                err_msg = str(e)

        raise AskForParamsError([
            dict(key='证件号码',
                 name='证件号码',
                 cls='input',
                 value=params.get('证件号码', '')),
            dict(key='密码',
                 name='密码',
                 cls='input:password',
                 value=params.get('密码', '')),
            dict(key='vc', name='验证码', cls='data:image', query={'t': 'vc'}),
        ], err_msg)
Esempio n. 25
0
    def _unit_login(self, params=None):
        err_msg = None
        if params:
            # 非开始或者开始就提供了参数
            try:
                self._check_login_params(params)
                id_num = params.get("身份证")
                account_pass = params.get("密码")
                vc = params.get("vc")

                data = {
                    'account': id_num,
                    'password': account_pass,
                    'type': '1',
                    'captcha': vc
                }
                resp = self.s.post(Post_LoginURL, data=data)

                if ('success' not in resp.text):
                    raise InvalidParamsError("登录失败,请重新登录!")
                else:
                    self.result_key = id_num
                    self.result_meta['身份证'] = id_num
                    self.result_meta['密码'] = account_pass
                    return

            except (AssertionError, InvalidParamsError) as e:
                err_msg = str(e)

        raise AskForParamsError([
            dict(key='身份证',
                 name='身份证',
                 cls='input',
                 value=params.get('身份证', '')),
            dict(key='密码',
                 name='密码',
                 cls='input:password',
                 value=params.get('密码', '')),
            dict(key='vc', name='验证码', cls='data:image', query={'t': 'vc'}),
        ], err_msg)
Esempio n. 26
0
    def _unit_login(self, params=None):
        err_msg = None
        if params:
            # 非开始或者开始就提供了参数
            try:
                self._check_login_params(params)
                txtSocial = params['社保编号']
                txtIdCard = params['身份证号']
                self.s = requests.Session()

                data = {
                    '__VIEWSTATE': '/wEPDwUKMTE5OTkyNjE3N2QYAQUeX19Db250cm9sc1JlcXVpcmVQb3N0QmFja0tleV9fFgEFDEltYWdlQnV0dG9uMawyoMUnhYzdZ/CYEuU6Zub34jdm',
                    '__EVENTVALIDATION': '/wEWBQKio5e8AQK4hdLODgLSwpnTCAKHvOeyCgKSoqqWD7P5DqrQCdEsyF4CuQgkhTVStKAL',
                    'txtSocial': txtSocial,
                    'txtIdCard': txtIdCard,
                    'btn': '登 录'
                }
                resp = self.s.post(LOGIN_URL, data=data)
                if resp.url != MAIN_URL:
                    raise InvalidParamsError("登录失败!请重新登录")

                self.result_key = txtIdCard
                # 保存到meta
                self.result_meta['身份证号'] = txtIdCard
                self.result_meta['社保编号'] = txtSocial

                # self.result_identity['task_name'] = '昆山'
                # self.result_identity['target_id'] = txtIdCard

                return
            except (AssertionError, InvalidParamsError) as e:
                err_msg = str(e)

        raise AskForParamsError([
            dict(key='身份证号', name='身份证号', cls='input', value=params.get('身份证号', '')),
            dict(key='社保编号', name='社保编号', cls='input', value=params.get('社保编号', ''))
            # dict(key='vc', name='验证码', cls='data:image', query={'t': 'vc'})
        ], err_msg)
Esempio n. 27
0
    def _unit_login(self, params: dict):
        err_msg = None
        params
        if params:
            try:
                self._check_login_params(params)
                if params["other"] == "3":
                    code = "3"
                elif params["other"] == "1":
                    code = "1"
                else:
                    code = "4"
                id_num = params['bh' + code]
                password = params['mm' + code]
                vc = params['vc']
                data = {
                    'cust_no': id_num,
                    'password': password,
                    'validate_code': vc,
                    'cust_type': '2',
                    'user_type': code
                }
                resp = self.s.post(LOGIN_URL, data=data, timeout=20)
                soup = BeautifulSoup(resp.content, 'html.parser')
                datas = {
                    'cust_no': id_num,
                    'flag': soup.text,
                    'password': password,
                    'validate_code': vc,
                    'cust_type': '2',
                    'user_type': code
                }
                resp = self.s.post(LOGIN_URL, data=datas, timeout=20)
                soup = BeautifulSoup(resp.content, 'html.parser')

                if soup.text == '2':
                    err_msg = '验证码不正确!'
                elif soup.text == '-1':
                    err_msg = '用户名或密码不正确!'
                if err_msg:
                    raise InvalidParamsError(err_msg)

                self.result_key = id_num
                self.result_meta['用户名'] = id_num
                self.result_meta['密码'] = password
                self.result_meta['类型Code'] = params["other"]
                self.result_identity['task_name'] = '杭州'

                return
            except (AssertionError, InvalidParamsError) as e:
                err_msg = str(e)

        raise AskForParamsError([
            dict(
                key='other',
                name=
                '[{"tabName":"客户号","tabCode":"1","isEnable":"1"},{"tabName":"用户名","tabCode":"3","isEnable":"1"},{"tabName":"市民邮箱","tabCode":"4","isEnable":"1"}]',
                cls='tab',
                value=params.get('类型Code', '')),
            dict(key='bh1',
                 name='客户号',
                 cls='input',
                 tabCode="1",
                 value=params.get('用户名', '')),
            dict(key='mm1',
                 name='密码',
                 cls='input:password',
                 tabCode="1",
                 value=params.get('密码', '')),
            dict(key='bh3',
                 name='用户名',
                 cls='input',
                 tabCode="3",
                 value=params.get('用户名', '')),
            dict(key='mm3',
                 name='密码',
                 cls='input:password',
                 tabCode="3",
                 value=params.get('密码', '')),
            dict(key='bh4',
                 name='市民邮箱',
                 cls='input',
                 tabCode="4",
                 value=params.get('用户名', '')),
            dict(key='mm4',
                 name='密码',
                 cls='input:password',
                 tabCode="4",
                 value=params.get('密码', '')),
            dict(key='vc',
                 name='验证码',
                 cls='data:image',
                 query={'t': 'vc'},
                 tabCode="[1,3,4]",
                 value=''),
        ], err_msg)
Esempio n. 28
0
    def _unit_login(self, params: dict):
        err_msg = None
        if params:
            try:
                self._check_login_params(params)
                self.result_data['baseInfo'] = {}
                id_num = params.get("身份证号")
                account_pass = params.get("密码")
                m = hashlib.md5()
                m.update(str(account_pass).encode(encoding="utf-8"))
                pw = m.hexdigest()
                vc = params.get("验证码")

                self.s.get(LOGIN_URL)

                appversion=''
                if len(id_num)==18:
                    appversion='810' + id_num[4:6] + '19853' + id_num[0:4] + '66723' + id_num[11:15] + '3398' + id_num[11:18] + '5729'
                elif len(id_num)==15:
                    appversion='985339810757291166723'

                _xmlString = "<?xml version='1.0' encoding='UTF-8'?><p><s userid='" + id_num + "'/><s usermm='" + pw + "'/><s authcode='" + vc + "'/><s yxzjlx='A'/><s appversion='"+appversion+"'/><s dlfs='1'/></p>"

                resp = self.s.post("http://60.216.99.138/hsp/logon.do?method=doLogon&_xmlString=" + _xmlString)
                if('usersession_uuid' not in resp.text):
                    raise InvalidParamsError(resp.text)
                else:
                    uuid = resp.text.split(',')[2].split(':')[1].replace('"', '')
                    res = self.s.get("http://60.216.99.138/hsp/hspUser.do?method=fwdQueryPerInfo&__usersession_uuid=" + uuid)
                    soup = BeautifulSoup(res.content, 'html.parser').findAll("tr")

                    # 保存到meta
                    self.result_key = id_num
                    self.result_meta['身份证号'] = id_num
                    self.result_meta['密码'] = account_pass


                    # 养老保险缴费明细
                    self.result['data']["old_age"] = {"data": {}}
                    basedataE = self.result['data']["old_age"]["data"]
                    modelE = {}
                    oldresp=self.s.get("http://60.216.99.138/hsp/siAd.do?method=queryAgedPayHis&__usersession_uuid=" + uuid )
                    oldData=BeautifulSoup(oldresp.text,'html.parser')
                    oldCount=oldData.findAll('font',{'class':'font'})[0].text   # 养老累积缴费月数
                    oldTotal=oldData.findAll('font',{'class':'font'})[1].text   # 养老累积缴费金额
                    oldStart=oldData.findAll('p')[2].text.split(':')[1].replace('\n','')[0:4]   # 养老开始日期
                    oldEnd=oldData.findAll('p')[3].text.split(':')[1].replace('\n','')[0:4]   # 养老结束日期

                    if (float(oldCount)>0.0):
                        for yr in range(int(oldStart),int(oldEnd)+1):
                            detailEI=self.s.get("http://60.216.99.138/hsp/siAd.do?method=queryAgedPayHis&__usersession_uuid=" + uuid + "&year=" + str(yr) + "")
                            sEI = BeautifulSoup(detailEI.content, 'html.parser').findAll('table',{'class': 'defaultTableClass'})
                            for tb in range(len((sEI))):
                                tbinfo=sEI[tb].findAll("tr")
                                for a in range(1,len(tbinfo)):
                                    td = tbinfo[a].findAll("td")
                                    years=td[0].find(type="text")["value"][0:4]
                                    months=td[0].find(type="text")["value"][5:7]
                                    basedataE.setdefault(years, {})
                                    basedataE[years].setdefault(months, [])

                                    modelE = {
                                        '缴费时间': td[0].find(type="text")["value"].replace('.',''),
                                        '缴费类型':'',
                                        '缴费基数': str(td[1].find(type="text")["value"]).replace(',', ''),
                                        '公司缴费':'',
                                        '个人缴费': td[2].find(type="text")["value"],
                                        '缴费单位': soup[9].findAll("td")[1].find(type="text")["value"],
                                    }
                                    basedataE[years][months].append(modelE)


                    # 医疗保险缴费明细
                    self.result['data']["medical_care"] = {"data": {}}
                    basedataH = self.result['data']["medical_care"]["data"]
                    modelH = {}
                    permedicalTotal = 0.0
                    medresp = self.s.get("http://60.216.99.138/hsp/siMedi.do?method=queryMediPayHis&__usersession_uuid=" + uuid)
                    medData = BeautifulSoup(medresp.text, 'html.parser')
                    medCount = medData.findAll('font', {'class': 'font'})[0].text  # 医疗累积缴费月数
                    medStart = medData.findAll('p')[2].text.split(':')[1].replace('\n', '')[0:4]  # 医疗开始日期
                    medEnd = medData.findAll('p')[3].text.split(':')[1].replace('\n', '')[0:4]  # 医疗结束日期

                    if (float(medCount) > 0.0):
                        for yr2 in range(int(medStart),int(medEnd)+1):
                            detailHI=self.s.get("http://60.216.99.138/hsp/siMedi.do?method=queryMediPayHis&__usersession_uuid=" + uuid + "&year=" + str(yr2) + "")
                            sHI = BeautifulSoup(detailHI.content, 'html.parser').findAll('table',{'class': 'defaultTableClass'})
                            for tb2 in range(len((sHI))):
                                tbinfo2=sHI[tb2].findAll("tr")
                                for b in range(1,len(tbinfo2)):
                                    td2 = tbinfo2[b].findAll("td")
                                    yearH=td2[0].find(type="text")["value"][0:4]
                                    monthH=td2[0].find(type="text")["value"][5:7]
                                    basedataH.setdefault(yearH, {})
                                    basedataH[yearH].setdefault(monthH, [])

                                    modelH = {
                                        '缴费时间': td2[0].find(type="text")["value"].replace('.',''),
                                        '缴费类型':'',
                                        '缴费基数': str(td2[1].find(type="text")["value"]).replace(',', ''),
                                        '公司缴费':'',
                                        '个人缴费': float(td2[2].find(type="text")["value"].replace(',',''))-float(td2[3].find(type="text")["value"].replace(',',''))-float(td2[4].find(type="text")["value"].replace(',','')),
                                        '缴费单位': soup[9].findAll("td")[1].find(type="text")["value"],
                                    }
                                    permedicalTotal +=float(float(td2[2].find(type="text")["value"].replace(',',''))-float(td2[3].find(type="text")["value"].replace(',',''))-float(td2[4].find(type="text")["value"].replace(',','')))
                                    basedataH[yearH][monthH].append(modelH)


                    # 失业保险缴费明细
                    self.result['data']["unemployment"] = {"data": {}}
                    basedataI = self.result['data']["unemployment"]["data"]
                    modelI = {}
                    uplresp = self.s.get("http://60.216.99.138/hsp/siLost.do?method=queryLostPayHis&__usersession_uuid=" + uuid)
                    uplData = BeautifulSoup(uplresp.text, 'html.parser')
                    uplCount = uplData.findAll('font', {'class': 'font'})[0].text  # 失业累积缴费月数
                    uplStart = uplData.findAll('p')[1].text.split(':')[1].replace('\n', '')[0:4]  # 失业开始日期
                    uplEnd = uplData.findAll('p')[2].text.split(':')[1].replace('\n', '')[0:4]  # 失业结束日期

                    if (float(uplCount) > 0.0):
                        for yr3 in range(int(uplStart), int(uplEnd) + 1):
                            detailII = self.s.get("http://60.216.99.138/hsp/siLost.do?method=queryLostPayHis&__usersession_uuid=" + uuid + "&year=" + str(yr3) + "")
                            sII = BeautifulSoup(detailII.content, 'html.parser').findAll('table', {'class': 'defaultTableClass'})
                            for tb3 in range(len((sII))):
                                tbinfo3=sII[tb3].findAll("tr")
                                for c in range(1, len(tbinfo3)):
                                    td3 = tbinfo3[c].findAll("td")
                                    yearI = td3[0].find(type="text")["value"][0:4]
                                    monthI = td3[0].find(type="text")["value"][5:7]
                                    basedataI.setdefault(yearI, {})
                                    basedataI[yearI].setdefault(monthI, [])

                                    modelI = {
                                        '缴费时间': td3[0].find(type="text")["value"].replace('.',''),
                                        '缴费类型': td3[4].find(type="text")["value"],
                                        '缴费基数': str(td3[1].find(type="text")["value"]).replace(',', ''),
                                        '公司缴费': '',
                                        '个人缴费': td3[2].find(type="text")["value"],
                                        '缴费单位': soup[9].findAll("td")[1].find(type="text")["value"],
                                    }
                                    basedataI[yearI][monthI].append(modelI)


                    # 工伤保险缴费明细
                    self.result['data']["injuries"] = {"data": {}}
                    basedataC = self.result['data']["injuries"]["data"]
                    modelC = {}
                    injresp = self.s.get("http://60.216.99.138/hsp/siHarm.do?method=queryHarmPayHis&__usersession_uuid=" + uuid)
                    injData = BeautifulSoup(injresp.text, 'html.parser')
                    injCount = injData.findAll('font', {'class': 'font'})[0].text  # 累积缴费月数
                    injStart = injData.findAll('p')[1].text.split(':')[1].replace('\n', '')[0:4]  # 开始日期
                    injEnd = injData.findAll('p')[2].text.split(':')[1].replace('\n', '')[0:4]  # 结束日期

                    if (float(injCount) > 0.0):
                        for yr4 in range(int(injStart), int(injEnd) + 1):
                            detailCI = self.s.get("http://60.216.99.138/hsp/siHarm.do?method=queryHarmPayHis&__usersession_uuid=" + uuid + "&year=" + str(yr4) + "")
                            sCI = BeautifulSoup(detailCI.content, 'html.parser').findAll('table', {'class': 'defaultTableClass'})
                            for tb4 in range(len((sCI))):
                                tbinfo4=sCI[tb4].findAll("tr")
                                for d in range(1, len(tbinfo4)):
                                    td4 = tbinfo4[d].findAll("td")
                                    yearC = td4[0].find(type="text")["value"][0:4]
                                    monthC = td4[0].find(type="text")["value"][5:7]
                                    basedataC.setdefault(yearC, {})
                                    basedataC[yearC].setdefault(monthC, [])

                                    modelC = {
                                        '缴费时间': td4[0].find(type="text")["value"].replace('.',''),
                                        '缴费类型': td4[2].find(type="text")["value"],
                                        '缴费基数': '',
                                        '公司缴费': '',
                                        '个人缴费': '',
                                        '缴费单位': soup[9].findAll("td")[1].find(type="text")["value"],
                                    }
                                    basedataC[yearC][monthC].append(modelC)


                    # 生育保险缴费明细
                    self.result['data']["maternity"] = {"data": {}}
                    basedataB = self.result['data']["maternity"]["data"]
                    modelB = {}
                    matnresp = self.s.get("http://60.216.99.138/hsp/siBirth.do?method=queryBirthPayHis&__usersession_uuid=" + uuid)
                    matnData = BeautifulSoup(matnresp.text, 'html.parser')
                    matnCount = matnData.findAll('font', {'class': 'font'})[0].text  # 累积缴费月数
                    matnStart = matnData.findAll('p')[1].text.split(':')[1].replace('\n', '')[0:4]  # 开始日期
                    matnEnd = matnData.findAll('p')[2].text.split(':')[1].replace('\n', '')[0:4]  # 结束日期

                    if (float(matnCount) > 0.0):
                        for yr5 in range(int(matnStart), int(matnEnd) + 1):
                            detailBI = self.s.get("http://60.216.99.138/hsp/siBirth.do?method=queryBirthPayHis&__usersession_uuid=" + uuid + "&year=" + str(yr5) + "")
                            sBI = BeautifulSoup(detailBI.content, 'html.parser').findAll('table', {'class': 'defaultTableClass'})
                            for tb5 in range(len((sBI))):
                                tbinfo5=sBI[tb5].findAll("tr")
                                for f in range(1, len(tbinfo5)):
                                    td5 = tbinfo5[f].findAll("td")
                                    yearB = td5[0].find(type="text")["value"][0:4]
                                    monthB = td5[0].find(type="text")["value"][5:7]
                                    basedataB.setdefault(yearB, {})
                                    basedataB[yearB].setdefault(monthB, [])

                                    modelB = {
                                        '缴费时间': td5[0].find(type="text")["value"].replace('.',''),
                                        '缴费类型': td5[2].find(type="text")["value"],
                                        '缴费基数': '',
                                        '公司缴费': '',
                                        '个人缴费': '',
                                        '缴费单位': soup[9].findAll("td")[1].find(type="text")["value"],
                                    }
                                    basedataB[yearB][monthB].append(modelB)


                    # 大病保险
                    self.result['data']['serious_illness']={"data":{}}


                    # 状态
                    status=""
                    datatype={
                        'method':'returnMain',
                        '__usersession_uuid':uuid,
                    }
                    restype=self.s.post("http://60.216.99.138/hsp/systemOSP.do",datatype)
                    resstatus=BeautifulSoup(restype.content,'html.parser').findAll("input",{'id':'rylb'})[0]['value']
                    if '在职' in resstatus:
                        status="正常"
                    else:
                        status="停缴"

                    # 个人基本信息
                    self.result_data['baseInfo'] = {
                        '姓名': soup[0].findAll("td")[1].find(type="text")["value"],
                        '身份证号': self.result_meta['身份证号'],
                        '更新时间': time.strftime("%Y-%m-%d", time.localtime()),
                        '城市名称': '济南',
                        '城市编号': '370100',
                        '缴费时长': max(oldCount,medCount),
                        '最近缴费时间': oldData.findAll('p')[3].text.split(':')[1].replace('\n',''),
                        '开始缴费时间': oldData.findAll('p')[2].text.split(':')[1].replace('\n',''),
                        '个人养老累计缴费': float(oldTotal.replace(',','')),
                        '个人医疗累计缴费': permedicalTotal,
                        '账户状态': status,
                        '出生日期': soup[1].findAll("td")[3].find(type="text")["value"]
                    }

                    self.result_identity.update({
                        "task_name": "济南市",
                        "target_name": soup[0].findAll("td")[1].find(type="text")["value"],
                        "target_id": self.result_meta['身份证号'],
                        "status": status
                    })

                return
            except (AssertionError, InvalidParamsError) as e:
                err_msg = str(e)

        raise AskForParamsError([
            dict(key='身份证号', name='身份证号', cls='input', placeholder='身份证号', value=params.get('身份证号', '')),
            dict(key='密码', name='密码', cls='input:password', value=params.get('密码', '')),
            dict(key='验证码', name='验证码', cls='data:image', query={'t': 'vc'}),
        ], err_msg)
Esempio n. 29
0
    def _unit_login(self, params=None):
        Frist_Time = False  #self.g.fristtime
        err_msg = None
        if not self.is_start or params:
            try:
                self._check_login_params(params)
                id_num = params['账号']
                self.s.idnum = id_num
                password = params['密码']
                vc = ''
                if 'vc' in params:
                    vc = params['vc']

                data = dict(securityCode2=vc,
                            securityCode=vc,
                            username=id_num,
                            password=password)
                resp = self.s.post(LOGIN_URL,
                                   data=data,
                                   headers={
                                       'Content-Type':
                                       'application/x-www-form-urlencoded'
                                   },
                                   timeout=10)

                soup = BeautifulSoup(resp.content, 'html.parser')
                if soup.select('#err_area'):
                    return_message = soup.select('#err_area')[0].find(
                        'font').text
                else:
                    return_message = None
                if return_message:
                    Frist_Time = True
                    raise InvalidParamsError(return_message)
                else:
                    print("登录成功!")

                self.result_key = id_num
                # 保存到meta
                self.result_meta['账号'] = id_num
                self.result_meta['密码'] = password
                self.result_identity['task_name'] = '厦门'
                self.result_identity['target_id'] = id_num

                return
            except (AssertionError, InvalidParamsError) as e:
                err_msg = str(e)
        if Frist_Time:
            vc = self._new_vc()
            raise AskForParamsError([
                dict(key='账号',
                     name='账号',
                     cls='input',
                     placeholder='证件号码',
                     value=params.get('账号', '')),
                dict(key='密码',
                     name='密码',
                     cls='input:password',
                     value=params.get('密码', '')),
                dict(key='vc', name='验证码', cls='data:image', query={'t': 'vc'
                                                                    }),
            ], err_msg)
        else:
            #self.g.fristtime = False
            raise AskForParamsError([
                dict(key='账号', name='账号', cls='input', placeholder='证件号码'),
                dict(key='密码', name='密码', cls='input:password'),
            ], err_msg)
Esempio n. 30
0
    def _unit_login(self, params=None):
        err_msg = None
        if not self.is_start or params:
            # 非开始或者开始就提供了参数
            try:
                self.result_data['baseInfo'] = {}
                self.result_data["companyList"] = []
                self._check_login_params(params)
                id_num = params.get("账号")
                account_pass = params.get("密码")
                vc = params.get("vc")

                if (len(id_num) == 15 or len(id_num) == 18):
                    data = {
                        'tranCode': '142501',
                        'task': '',
                        'accnum': '',
                        'certinum': id_num,
                        'pwd': account_pass,
                        'verify': vc,
                    }
                    ltype = "身份证号"
                elif (len(id_num) <= 12):
                    data = {
                        'tranCode': '142501',
                        'task': '',
                        'accnum': id_num,
                        'certinum': '',
                        'pwd': account_pass,
                        'verify': vc,
                    }
                    ltype = "公积金账号"

                resp = self.s.post("http://www.nbgjj.com/GJJQuery", data=data)
                if 'msg' in resp.text:  # 判断是否登录成功
                    raise InvalidParamsError(json.loads(resp.text)['msg'])

                # 个人基本信息
                accnum = resp.cookies['gjjaccnum']
                res = self.s.get(MAIN_URL + "tranCode=142503&task=&accnum=" +
                                 accnum)
                resdata = json.loads(res.text)

                # 公司信息
                self.result_data['companyList'].append({
                    "单位名称":
                    resdata['unitaccname'],
                    "单位登记号":
                    "",
                    "所属管理部编号":
                    "",
                    "所属管理部名称":
                    "",
                    "当前余额":
                    resdata['amt'],
                    "帐户状态":
                    resdata['freeuse1'],
                    "当年缴存金额":
                    "",
                    "当年提取金额":
                    "",
                    "上年结转余额":
                    "",
                    "最后业务日期":
                    resdata['lpaym'],
                    "转出金额":
                    ""
                })

                # identity 信息
                status = ""
                if (resdata['freeuse1'] == "中止"
                        or resdata['freeuse1'] == "停缴"):
                    status = '封存'
                else:
                    status = '缴存'

                self.result['identity'] = {
                    "task_name": "宁波",
                    "target_name": resdata['accname'],
                    "target_id": id_num,
                    "status": status
                }

                # 缴费明细
                lastTime = ""  # 最后一次汇补缴时间
                lastMoney = ""  # 最后一次汇补缴金额
                continueCount = 0  # 汇补缴累积次数

                starttime = str(datetime.datetime.now() -
                                datetime.timedelta(days=365 * 3))[0:10]  # 开始时间
                endtime = str(datetime.datetime.now())[0:10]  # 结束时间
                detailurl = self.s.get(
                    MAIN_URL +
                    "tranCode=142504&task=ftp&indiacctype=1&accnum=" + accnum +
                    "&begdate=" + starttime + "&enddate=" + endtime)
                detailData = json.loads(detailurl.text)
                self.result_data['detail'] = {"data": {}}
                baseDetail = self.result_data["detail"]["data"]
                model = {}
                for aa in range(len(detailData)):
                    years = detailData[aa]["trandate"][0:4]
                    months = detailData[aa]["trandate"][5:7]
                    model = {
                        '时间': detailData[aa]["trandate"],
                        '类型': detailData[aa]["ywtype"].strip(),
                        '汇缴年月': '',
                        '收入': detailData[aa]["amt"],
                        '支出': "",
                        '余额': detailData[aa]["bal"],
                        '单位名称': detailData[aa]["unitaccname"].strip()
                    }

                    if '汇缴' in detailData[aa]["ywtype"].strip(
                    ) or '补缴' in detailData[aa]["ywtype"].strip():
                        lastTime = detailData[aa]["trandate"]
                        lastMoney = detailData[aa]["amt"]
                        continueCount = continueCount + 1

                    baseDetail.setdefault(years, {})
                    baseDetail[years].setdefault(months, [])
                    baseDetail[years][months].append(model)

                self.result_data['baseInfo'] = {
                    '姓名': resdata['accname'],
                    '证件号': resdata['certinum'],
                    '证件类型': '身份证',
                    '公积金账号': resdata['accnum'],
                    '缴存基数': resdata['basenum'],
                    '开户日期': resdata['begdate'],
                    '更新时间': time.strftime("%Y-%m-%d", time.localtime()),
                    '城市名称': '宁波市',
                    '城市编号': '330200',
                    '最近汇款日期': lastTime,
                    '最近汇款金额': lastMoney,
                    '累计汇款次数': continueCount
                }

                self.result_key = id_num
                self.result_meta['账号'] = id_num
                self.result_meta['密码'] = account_pass

                return
            except (AssertionError, InvalidParamsError) as e:
                err_msg = str(e)

        raise AskForParamsError([
            dict(key='账号', name='账号', cls='input', value=params.get('账号', '')),
            dict(key='密码',
                 name='密码',
                 cls='input:password',
                 value=params.get('密码', '')),
            dict(key='vc', name='验证码', cls='data:image', query={'t': 'vc'}),
        ], err_msg)