Exemplo n.º 1
0
def fillCompanyInfo(args, browser):  #types in [1,2,3,4]
    # WebDriverWait(browser,10,0.5,SCENSEE).until(EC.presence_of_element_located((By.XPATH,'//*[@id="id1"]/div[2]/div/input')))
    browser = waitTo(browser, (SCENSEE, SCEENVE, SCESERE),
                     way='xpath',
                     name='//*[@id="id1"]/div[2]/div/input',
                     operate='click')
    if args.overfill:
        browser.find_element_by_xpath(
            '//*[@id="id1"]/div[2]/div/input').send_keys(args.companyName *
                                                         256)
    else:
        browser.find_element_by_xpath(
            '//*[@id="id1"]/div[2]/div/input').send_keys(
                args.companyName)  #企业名称
    print(f'企业名称:{args.companyName}')
    if args.robot: saveFileRobot(f'企业名称:{args.companyName}')
    browser.find_elements_by_class_name('cube-form-field')[2].click()  #区域
    time.sleep(0.5)
    browser.find_element_by_xpath(
        '/html/body/div[5]/div[2]/div/div/div[1]/span[2]').click()  #点击确定
    time.sleep(0.5)
    if args.overfill:
        browser.find_element_by_xpath(
            '//*[@id="id3"]/div[2]/div/input').send_keys(
                fake.address().split()[0] * 256)
    else:
        browser.find_element_by_xpath(
            '//*[@id="id3"]/div[2]/div/input').send_keys(
                fake.address().split()[0])  #办公地址
    browser.find_elements_by_class_name('cube-input-field')[2].send_keys(
        args.precreditID)  #营业执照注册号或统一信用代码
    browser.find_elements_by_class_name('validity')[0].click()  #起始日期
    time.sleep(0.5)
    for year in range(28, randint(20, 25), -1):
        browser.find_element_by_xpath(
            f'/html/body/div[6]/div[2]/div/div/div[2]/div/div[1]/ul/li[{year}]'
        ).click()
        time.sleep(0.5)
    browser.find_element_by_xpath(
        '/html/body/div[6]/div[2]/div/div/div[1]/span[2]').click()  #点击确定
    time.sleep(0.5)
    browser.find_element_by_class_name('cube-checkbox').click()  #勾选长期有效
    browser.find_elements_by_class_name('cube-form-field')[1].click()  #所属行业
    time.sleep(0.5)
    browser.find_element_by_xpath(
        '/html/body/div[3]/div[2]/div/div/div[1]/span[2]').click()  #点击确定
    time.sleep(0.5)
    if args.type == '1':
        if saveToMysql:
            mysqlOpt(
                f"UPDATE registerinfo SET RegistNum='{args.precreditID}' WHERE LoginID='{args.loginID}'"
            )
        else:
            save_file(f'营业执照注册号: {args.precreditID}')
        print(f'营业执照注册号: {args.precreditID}')
        if args.robot: saveFileRobot(f'营业执照注册号: {args.precreditID}')
        browser.find_element_by_xpath(
            '//*[@id="id6"]/div[2]/div/input').send_keys(str(
                uuid1())[:10])  #组织机构代码
        browser.find_elements_by_class_name('validity')[1].click()  #起始日期
        time.sleep(0.5)
        browser.find_element_by_xpath(
            '/html/body/div[6]/div[2]/div/div/div[1]/span[2]').click()  #点击确定
        time.sleep(0.5)
        browser.find_element_by_xpath(
            '//*[@id="id7"]/div[2]/div').click()  #勾选长期有效
        browser.find_element_by_xpath(
            '//*[@id="id8"]/div[2]/div/input').send_keys(
                str(uuid4()).replace('-', '')[:15])  #税务登记号
        browser.find_element_by_xpath(
            '//*[@id="id9"]/div[2]/div/input').send_keys(
                str(uuid1()).replace('-', '')[:14])  #开户许可证核准号
    elif args.type == '2':
        if saveToMysql:
            mysqlOpt(
                f"UPDATE registerinfo SET USCNUM='{args.precreditID}' WHERE LoginID='{args.loginID}'"
            )
        else:
            save_file(f'统一社会信用代码: {args.precreditID}')
        print(f'统一社会信用代码: {args.precreditID}')
        if args.robot: saveFileRobot(f'统一社会信用代码: {args.precreditID}')
        browser.find_element_by_xpath(
            '//*[@id="id6"]/div[2]/div/input').send_keys(
                str(uuid1()).replace('-', '')[:14])  #开户许可证核准号
    elif args.type == '3':
        if saveToMysql:
            mysqlOpt(
                f"UPDATE registerinfo SET RegistNum='{args.precreditID}' WHERE LoginID='{args.loginID}'"
            )
        else:
            save_file(f'营业执照注册号: {args.precreditID}')
        print(f'营业执照注册号: {args.precreditID}')
        if args.robot: saveFileRobot(f'营业执照注册号: {args.precreditID}')
    elif args.type == '4':
        if saveToMysql:
            mysqlOpt(
                f"UPDATE registerinfo SET USCNUM='{args.precreditID}' WHERE LoginID='{args.loginID}'"
            )
        else:
            save_file(f'统一社会信用代码: {args.precreditID}')
        print(f'统一社会信用代码: {args.precreditID}')
        if args.robot: saveFileRobot(f'统一社会信用代码: {args.precreditID}')
    browser.find_element_by_xpath('//*[@id="id11"]/div[2]').click()  #点击工商登记类型
    time.sleep(0.5)
    browser.find_element_by_xpath(
        '/html/body/div[4]/div[2]/div/div/div[1]/span[2]').click()  #点击确定
    time.sleep(0.5)
    if args.overfill:
        browser.find_element_by_xpath(
            '//*[@id="id12"]/div[2]/div/input').send_keys(
                fake.address().split()[0] * 256)
    else:
        browser.find_element_by_xpath(
            '//*[@id="id12"]/div[2]/div/input').send_keys(
                fake.address().split()[0])  #登记注册地址
    if args.overfill:
        browser.find_element_by_xpath(
            '//*[@id="id13"]/div[2]/div/input').send_keys(
                str(randint(100, 1000)) * 256)
    else:
        browser.find_element_by_xpath(
            '//*[@id="id13"]/div[2]/div/input').send_keys(randint(100,
                                                                  1000))  #年收入
    if args.overfill:
        browser.find_element_by_xpath(
            '//*[@id="id14"]/div[2]/div/input').send_keys(fake.name() * 256)
    else:
        browser.find_element_by_xpath(
            '//*[@id="id14"]/div[2]/div/input').send_keys(
                fake.name())  #电信返佣银行账户名(选填)
    if args.overfill:
        browser.find_element_by_xpath(
            '//*[@id="id15"]/div[2]/div/input').send_keys('招商银行' * 256)
    else:
        browser.find_element_by_xpath(
            '//*[@id="id15"]/div[2]/div/input').send_keys(
                '招商银行')  #电信返佣银行账户开户行(选填)
    if args.overfill:
        browser.find_element_by_xpath(
            '//*[@id="id16"]/div[2]/div/input').send_keys(bankCode * 512)
    else:
        browser.find_element_by_xpath(
            '//*[@id="id16"]/div[2]/div/input').send_keys(
                bankCode)  #电信返佣银行账户账号(选填)
    if args.robot: saveFileRobot('开始预授信')
    if args.doPrecredit:
        if args.manual == 'y':
            creditHead = 0
            creditTypeDic = {
                '1': '佣金',
                '2': '采购',
                '3': '小CEO',
            }
            for creditType in args.creditType:
                out(f'正在导入预授信,类型 {creditTypeDic[creditType]}...')
                save_excel(args.precreditID, args.companyName, creditType,
                           args.daddy)
                creditResult, creditHead = uploadExcel(idlist=[company.BLRN],
                                                       env=args.env,
                                                       head=creditHead,
                                                       menhuPath=args.path)
                addWhiteList(args.env, creditHead, company, args.daddy,
                             args.robot)
                if not creditResult:  #预授信
                    if args.robot:
                        print(f'导入预授信失败,类型 {creditTypeDic[creditType]}')
                        sys.exit()
                    else:
                        s = input(
                            f'导入预授信失败,类型 {creditTypeDic[creditType]} ,请手动完成后按回车,退出请按"q":'
                        )
                        if s == 'q':
                            browser.quit()
                            sys.exit(0)
        else:
            if args.robot:
                sendInput('请手动导入预授信后发送 已完成预授信')
                getInput('已完成预授信')
            else:
                s = input('请手动完成预授信后按回车,退出请按"q":')
                if s == 'q':
                    browser.quit()
                    sys.exit(0)
        print('已完成预授信\t\t')
    if args.robot: saveFileRobot('已完成预授信,下一步填写进件信息')
    if saveToMysql:
        mysqlOpt(
            f"UPDATE registerinfo SET IsPreCredit=1 WHERE LoginID='{args.loginID}'"
        )
    else:
        save_file('已完成预授信')
    browser.find_element_by_class_name('nextbtn').click()  #下一步
    return browser
Exemplo n.º 2
0
def main(args, **bro):
    # try:
    global newpassword, paypassword
    browser = uploadPic(
        args,
        fillLegalInfo(
            args,
            fillCompanyInfo(args, step3(args, step2(args, step1(args,
                                                                **bro))))))
    if saveToMysql:
        mysqlOpt(
            f"UPDATE registerinfo SET IsReview=0,IsPreCredit=0,IsApplicate=0 WHERE LoginID='{args.loginID}'"
        )
    if args.robot: saveFileRobot('已提交开户申请,下一步大总管审核')
    out('大总管审核中……\t\t\t')
    auditSta = 3 if args.auditSta else 2
    bbCheckData = bbossCheck(args.loginID,
                             env=args.env,
                             op='',
                             auditSta=auditSta,
                             path=args.path)
    if bbCheckData['auditSta'] == '审核通过':
        out('大总管审核通过……\t\t\t')
    else:
        print('大总管', bbCheckData['auditSta'], bbCheckData['respCode'],
              bbCheckData['respMsg'])
        sys.exit()
    if args.robot: saveFileRobot('大总管审核完成,下一步预授信')
    if saveToMysql:
        mysqlOpt(
            f"UPDATE registerinfo SET IsReview=1 WHERE LoginID='{args.loginID}'"
        )
    if args.doPrecredit:
        if args.manual == 'y':
            creditHead = 0
            creditTypeDic = {
                '1': '*',
                '2': '*',
                '3': '*',
            }
            for creditType in args.creditType:
                out(f'正在导入预授信,类型 {creditTypeDic[creditType]}...')
                save_excel(args.precreditID, args.companyName, creditType,
                           args.daddy)
                creditResult, creditHead = uploadExcel(idlist=[company.BLRN],
                                                       env=args.env,
                                                       head=creditHead,
                                                       menhuPath=args.path)
                addWhiteList(args.env, creditHead, company, args.daddy,
                             args.robot)
                if not creditResult:  #预授信
                    if args.robot:
                        print(f'导入预授信失败,类型 {creditTypeDic[creditType]}')
                        sys.exit()
                    else:
                        s = input(
                            f'导入预授信失败,类型 {creditTypeDic[creditType]} ,请手动完成后按回车,退出请按"q":'
                        )
                        if s == 'q':
                            browser.quit()
                            sys.exit(0)
        else:
            if args.robot:
                sendInput('请手动导入预授信后发送 已完成预授信')
                getInput('已完成预授信')
            else:
                s = input('请手动完成预授信后按回车,退出请按"q":')
                if s == 'q':
                    browser.quit()
                    sys.exit(0)
        print('已完成预授信\t\t')
    if saveToMysql:
        mysqlOpt(
            f"UPDATE registerinfo SET IsPreCredit=1 WHERE LoginID='{args.loginID}'"
        )
    else:
        save_file('已完成预授信')
    if saveToMysql:
        mysqlOpt(
            f"UPDATE registerinfo SET Password='******',Payword='111111' WHERE LoginID='{args.loginID}'"
        )
    else:
        save_file(f'登陆密码: {newpassword}\t支付密码: 111111')
    print(f'登陆密码: {newpassword}\t支付密码: 111111\t\t')
    if args.robot: saveFileRobot(f'登陆密码: {newpassword}\t支付密码: 111111\t\t')
    if args.all in ['y', None, 'Y']:
        browser.get(
            f'{H5domainDic[args.env]}/subapps/bpep-credit-h5/index.html#/login'
        )
        time.sleep(2)
        JBC = True if args.daddy == '2' else False
        browser, result = AutoFillH5(loginId=args.loginID,
                                     password=newpassword,
                                     bankCode=args.legal_bank,
                                     env=args.env,
                                     change=change,
                                     pLegalID=args.pLegalID,
                                     oFill=args.overfill,
                                     JBC=JBC,
                                     robot=args.robot,
                                     bro=browser)
        if saveToMysql:
            mysqlOpt(
                f"UPDATE registerinfo SET IsApplicate=1 WHERE LoginID='{args.loginID}'"
            )
    return browser, result
Exemplo n.º 3
0
def main(**bro):
	try:
		global newpassword,paypassword,manHead,liaHead,browserFund
		if args.getRegUrl:
			longUrl=f"{domain}/bestpay/register?{encryptRegData(company.loginID,time.strftime('%Y%m%d%H%M%S',time.localtime()),platCode)}"
			shortUrl=getShortUrl(longUrl)
			if shortUrl:
				print(shortUrl)
			else:
				print(longUrl)
			print()
			sys.exit()
		if bro:
			browser=bro['bro']
			browser.get(f"{domain}/bestpay/register?{encryptRegData(company.loginID,time.strftime('%Y%m%d%H%M%S',time.localtime()),platCode,company.email)}")
		else:
			browser=openurl(f"{domain}/bestpay/register?{encryptRegData(company.loginID,time.strftime('%Y%m%d%H%M%S',time.localtime()),platCode,company.email)}")
		if args.mode=='b':
			print('-'*50,'注册:',gradeDic[args.grade],'-'*50)
			if args.robot:saveFileRobot(f"{'-'*50} 注册:{gradeDic[args.grade]} {'-'*50}")
		print(f"PC {envDict[args.env]} {time.strftime('%Y-%m-%d %X',time.localtime())}")
		if args.robot:saveFileRobot(f"PC {envDict[args.env]} {time.strftime('%Y-%m-%d %X',time.localtime())}")
		if saveToMysql:mysqlOpt(f"""INSERT INTO registerinfo (CreateDate,Environmental,Grade,loginID,RegistTypes) VALUES ("{time.strftime('%Y-%m-%d %X',time.localtime())}","PC {envDict[args.env]}","{gradeDic[args.grade]}","{company.loginID}","{regTypeDic[args.type]}")""")
		else:save_file(f'登录号: {company.loginID}\n{regTypeDic[args.type]}')
		print(f'登录号: {company.loginID}\n{regTypeDic[args.type]}')	
		if args.robot:saveFileRobot(f'登录号: {company.loginID}\n{regTypeDic[args.type]}')	
		# if saveToMysql:mysqlOpt(f"UPDATE registerinfo SET RegistTypes='{regTypeDic[args.type]}' WHERE LoginID='{company.loginID}'")
		# else:save_file(regTypeDic[args.type])
		# print(regTypeDic[args.type])
		if args.type=='1':browser=fillbankinfor(postpic0(beneficiaryInfo(legalinformation(Putong(browser)))),0)
		elif args.type=='2':browser=fillbankinfor(postpic1(beneficiaryInfo(legalinformation(Sanzhengheyi(browser)))),1)
		elif args.type=='3':browser=fillbankinfor(postpic2(beneficiaryInfo(legalinformation(Getigongshanghu(browser)))),2)
		elif args.type=='4':browser=fillbankinfor(postpic3(Geti(browser)),3)
		if saveToMysql:mysqlOpt(f"UPDATE registerinfo SET IsReview=0,IsPreCredit=0,IsApplicate=0 WHERE LoginID='{company.loginID}'")
		if args.noCheck:#小CEO批量模式
			# browser.quit()
			return '提交完成',browser
		if args.robot:saveFileRobot('已提交开户申请,下一步大总管审核……')
		# browser=bbossCheck(company.loginID,env=args.env,bro=browser)
		out('大总管审核中……\t\t\t')
		auditSta=3 if args.auditSta else 2
		bbCheckData=bbossCheck(company.loginID,env=args.env,op='1',auditSta=auditSta,path=args.path)
		if bbCheckData['auditSta']=='审核通过':
			out('大总管审核通过……\t\t\t')
		else:
			print('大总管',bbCheckData['auditSta'],bbCheckData['respCode'],bbCheckData['respMsg'])
			sys.exit()
		if saveToMysql:mysqlOpt(f"UPDATE registerinfo SET IsReview=1 WHERE LoginID='{company.loginID}'")
		if args.robot:saveFileRobot('大总管已审核,下一步获取初始密码……')
		if args.env in ['k','c']:
			# browser,om_cookie=loginOM(env=args.env,bro=browser)
			out('正在获取初始密码...')
			password=getOMpassword(company.loginID,company.legalTel,env=args.env,path=args.path)#获取初始密码
			out('正在获取商户号...')
			merchantNum=getMerchantNum(company.loginID,env=args.env,path=args.path)#获取商户号
			if saveToMysql:mysqlOpt(f"UPDATE registerinfo SET MerchantNum='{merchantNum}' WHERE LoginID='{company.loginID}'")
		elif args.env in ['p','s']:
			if args.robot:
				sendInput('请发送初始密码,格式:初始密码 xxxx')
				password=getInput('初始密码')
			else:
				password=input('输入初始密码后按回车,退出请按"q":')
				if password=='q':
					browser.quit()
					sys.exit(0)
		if saveToMysql:mysqlOpt(f"UPDATE registerinfo SET InitialPWD='{password}' WHERE LoginID='{company.loginID}'")
		else:save_file(f'初始密码: {password}')
		print(f'初始密码: {password}\t\t\t\t')
		if args.robot:saveFileRobot(f'初始密码: {password}')
		if noPic or args.env=='k':#H5没有开发环境
		# if 1==1:
			browser=changePassword(company.loginID,password,newpassword,paypassword,env=args.env,bro=browser)
		else:#不禁止加载图片则可以去H5页面修改密码
			browser1=loginH5(username=company.loginID,passwd=password,env=args.env,menhuPath=args.path)#初始密码登陆
			browser1,newpassword=changePasswordH5(loginId=company.loginID,password=password,newpassword=newpassword,paypassword=paypassword,env=args.env,menhuPath=args.path,bro=browser1)
			browser1.quit()
		if saveToMysql:mysqlOpt(f"UPDATE registerinfo SET Password='******',Payword='{paypassword}' WHERE LoginID='{company.loginID}'")
		else:save_file(f'登陆密码: {newpassword}\t支付密码: {paypassword}')
		print(f'登陆密码: {newpassword}\t支付密码: {paypassword}')
		if args.robot:saveFileRobot(f'登陆密码: {newpassword}\t支付密码: {paypassword}')
		result='密码修改完成!'
		creditTypeDic={'1':'佣金','2':'采购','3':'小CEO',}
		if args.mode=='a':
			if args.precredit=='y':
				creditHead=0
				for creditType in args.creditType:
					out(f'正在导入预授信,类型 {creditTypeDic[creditType]}...')
					save_excel(company.BLRN,company.companyName,creditType,args.daddy)
					creditResult,creditHead=uploadExcel(idlist=[company.BLRN],env=args.env,head=creditHead,menhuPath=args.path)
					addWhiteList(args.env,creditHead,company,args.daddy,args.robot)
					if not creditResult:#预授信
						if args.robot:
							print(f'导入预授信失败,类型 {creditTypeDic[creditType]}')
							sys.exit()
						else:
							s=input(f'导入预授信失败,类型 {creditTypeDic[creditType]} ,请手动完成后按回车,退出请按"q":')
							if s=='q':
								browser.quit()
								sys.exit(0)
			else:
				if args.robot:
					sendInput('请手动导入预授信后发送 已完成预授信')
					getInput('已完成预授信')
				else:
					s=input('请手动完成预授信后按回车,退出请按"q":')
					if s=='q':
						browser.quit()
						sys.exit(0)
			if saveToMysql:mysqlOpt(f"UPDATE registerinfo SET IsPreCredit=1 WHERE LoginID='{company.loginID}'")
			else:save_file('已完成预授信')
			print('已完成预授信\t\t')
			if args.robot:saveFileRobot('已完成预授信\t\t')
			if args.all=='y':
				JBC=True if args.daddy=='2' else False
				browser,result=AutoFill(company.loginID,newpassword,env=args.env,bankCode=company.bankCode,oFill=args.overfill,pLegalID=company.getPlegalID(company.legalID),JBC=JBC,robot=args.robot,path=args.path,bro=login(company.loginID,newpassword,env=args.env,menhuPath=args.path,bro=browser))
				if saveToMysql:mysqlOpt(f"UPDATE registerinfo SET IsApplicate=1 WHERE LoginID='{company.loginID}'")
				else:save_file(f"完成! {time.strftime('%Y-%m-%d %X',time.localtime())}")
			browser.quit()
			return f'{result}\t\t\t\t'
		elif args.mode=='b':
			browser=login(username=company.loginID,passwd=newpassword,env=args.env,menhuPath=args.path,bro=browser)#改完密码后登陆
			browser,initialPWD=addOperator(opLoginID=company.opLoginID,env=args.env,newRole=1,bro=browser)#新增操作员
			if saveToMysql:mysqlOpt(f"""INSERT INTO registerinfo (CreateDate,Environmental,Grade,loginID,RegistTypes,InitialPWD) VALUES ("{time.strftime('%Y-%m-%d %X',time.localtime())}","PC {envDict[args.env]}","{gradeDic[args.grade]}","{company.opLoginID}","操作员","{initialPWD}")""")
			else:save_file(f'操作员登录号: {company.opLoginID}')
			print(f'操作员登录号: {company.opLoginID}\t初始密码:{initialPWD}')
			if args.robot:saveFileRobot(f'操作员登录号: {company.opLoginID}\t初始密码:{initialPWD}')
			if noPic or args.env=='k':#H5没有开发环境
				browser=changePassword(company.opLoginID,initialPWD,newpassword,paypassword,env=args.env,bro=browser)
			else:#不禁止加载图片则可以去H5页面修改密码
				# browser.quit()
				browser1=loginH5(username=company.opLoginID,passwd=initialPWD,env=args.env,menhuPath=args.path)#初始密码登陆
				browser1,newpassword=changePasswordH5(loginId=company.opLoginID,password=initialPWD,newpassword=newpassword,paypassword=paypassword,env=args.env,menhuPath=args.path,bro=browser1)
				browser1.quit()
			if saveToMysql:mysqlOpt(f"UPDATE registerinfo SET Password='******',Payword='{paypassword}' WHERE LoginID='{company.opLoginID}'")
			else:save_file(f'操作员登陆密码: {newpassword}\t操作员支付密码: {paypassword}')
			print(f'操作员登陆密码: {newpassword}\t操作员支付密码: {paypassword}')
			if args.robot:saveFileRobot(f'操作员登陆密码: {newpassword}\t操作员支付密码: {paypassword}')
			#电子凭证授信
			company.cusType='CORE' if args.grade=='1' else 'CUSTOMER'
			browser.maximize_window()
			browser,result,manHead,liaHead=AutoFillElect(company=company,renewal='n',reFill='y',passwd=newpassword,bro=browser)
			print(f'{result}\t\t\t\t')
			if args.robot:saveFileRobot(result)
			# 翼融平台客户录入
			browser.find_element_by_id('login').click()#登出
			if browserFund:
				browserFund=entryCustInfo(company=company,jump=0,needLogin=0,bro=browserFund)#换资金方经办员录入客户信息
			else:
				browserFund=entryCustInfo(company=company,jump=1,needLogin=1)#换资金方经办员录入客户信息
			print('翼融平台客户录入成功!\t\t\t\t\t\n')
			if args.robot:saveFileRobot('翼融平台客户录入成功!')
			return browser,browserFund
	except Exception as err:
		reason=getErrReason(browser)
		if not reason:reason=err
		print('开户失败!原因:',reason)
		sys.exit()
Exemplo n.º 4
0
 args.legalName, args.legalID, args.legal_bank, args.legalTel = getLegalInfo(
     args.env, args.legalName)
 company.legalName, company.legalID, company.bankCode, company.legalTel = getLegalInfo(
     args.env, args.legalName)
 BLRN = checkR_U(args, BLRN)
 args.precreditID = BLRN[:15] if args.type in ['1', '3'] else BLRN
 # args.companyName='测试合联电子信息有限公司';args.precreditID='4ba57ee8e414423'
 # print(f'企业名称:{args.companyName}\n营业执照/三证合一:{args.precreditID}')
 if args.manual in ['y', None, 'Y']:
     creditHead = 0
     for creditType in args.creditType:
         out(f'正在导入预授信,类型 {creditType}...')
         save_excel(args.precreditID, args.companyName, creditType,
                    args.daddy)
         creditResult, creditHead = uploadExcel(idlist=[company.BLRN],
                                                env=args.env,
                                                head=creditHead)
         if args.daddy == '2':
             addWhiteList(args.env, creditHead, company)
         if not creditResult:  #预授信
             s = input(f'导入预授信失败,类型 {creditType} ,请手动完成后按回车,退出请按"q":')
             if s == 'q':
                 browser.quit()
                 sys.exit(0)
 else:
     s = input('请手动完成预授信后按回车,退出请按"q":')
     if s == 'q':
         browser.quit()
         sys.exit(0)
 print('已完成预授信\t\t')
 browser, result = main(args)
Exemplo n.º 5
0
def main(args, **bro):
    try:
        global newpassword, paypassword
        browser = uploadPic(
            args,
            fillLegalInfo(
                args,
                fillCompanyInfo(args,
                                step3(args, step2(args, step1(args, **bro))))))
        if saveToMysql:
            mysqlOpt(
                f"UPDATE registerinfo SET IsReview=0,IsPreCredit=0,IsApplicate=0 WHERE LoginID='{args.loginID}'"
            )
        if args.robot: saveFileRobot('已提交开户申请,下一步大总管审核')
        # browser=bbossCheck(args.loginID,env=args.env,op='3',bro=browser)
        out('大总管审核中……\t\t\t')
        auditSta = 3 if args.auditSta else 2
        bbCheckData = bbossCheck(args.loginID,
                                 env=args.env,
                                 op='3',
                                 auditSta=auditSta,
                                 path=args.path)
        # print("pathH5:",args.path)
        if bbCheckData['auditSta'] == '审核通过':
            out('大总管审核通过……\t\t\t')
        else:
            print('大总管', bbCheckData['auditSta'], bbCheckData['respCode'],
                  bbCheckData['respMsg'])
            sys.exit()
        if args.robot: saveFileRobot('大总管审核完成,下一步预授信')
        if saveToMysql:
            mysqlOpt(
                f"UPDATE registerinfo SET IsReview=1 WHERE LoginID='{args.loginID}'"
            )
        if args.doPrecredit:
            if args.manual == 'y':
                creditHead = 0
                creditTypeDic = {
                    '1': '佣金',
                    '2': '采购',
                    '3': '小CEO',
                }
                for creditType in args.creditType:
                    out(f'正在导入预授信,类型 {creditTypeDic[creditType]}...')
                    save_excel(args.precreditID, args.companyName, creditType,
                               args.daddy)
                    creditResult, creditHead = uploadExcel(
                        idlist=[company.BLRN],
                        env=args.env,
                        head=creditHead,
                        menhuPath=args.path)
                    addWhiteList(args.env, creditHead, company, args.daddy,
                                 args.robot)
                    if not creditResult:  #预授信
                        if args.robot:
                            print(f'导入预授信失败,类型 {creditTypeDic[creditType]}')
                            sys.exit()
                        else:
                            s = input(
                                f'导入预授信失败,类型 {creditTypeDic[creditType]} ,请手动完成后按回车,退出请按"q":'
                            )
                            if s == 'q':
                                browser.quit()
                                sys.exit(0)
            else:
                if args.robot:
                    sendInput('请手动导入预授信后发送 已完成预授信')
                    getInput('已完成预授信')
                else:
                    s = input('请手动完成预授信后按回车,退出请按"q":')
                    if s == 'q':
                        browser.quit()
                        sys.exit(0)
            print('已完成预授信\t\t')
        if args.robot: saveFileRobot('已完成预授信,下一步获取初始密码')
        if saveToMysql:
            mysqlOpt(
                f"UPDATE registerinfo SET IsPreCredit=1 WHERE LoginID='{args.loginID}'"
            )
        else:
            save_file('已完成预授信')
        if args.env == 'c':
            # browser,om_cookie=loginOM(env=args.env,bro=browser)
            out('正在获取初始密码...')
            password = getOMpassword(args.loginID,
                                     args.legalTel,
                                     env=args.env,
                                     path=args.path)
            out('正在获取商户号...')
            merchantNum = getMerchantNum(args.loginID,
                                         env=args.env,
                                         path=args.path)
            if saveToMysql:
                mysqlOpt(
                    f"UPDATE registerinfo SET MerchantNum='{merchantNum}',InitialPWD='{password}' WHERE LoginID='{args.loginID}'"
                )
            else:
                save_file(f'初始密码: {password}')
        elif args.env in ['p', 's']:
            if args.robot:
                sendInput('请发送初始密码,格式:初始密码 xxxx')
                password = getInput('初始密码')
            else:
                password = input('输入初始密码后按回车,退出请按"q":')
                if password == 'q':
                    browser.quit()
                    sys.exit(0)
            if saveToMysql:
                mysqlOpt(
                    f"UPDATE registerinfo SET InitialPWD='{password}' WHERE LoginID='{args.loginID}'"
                )
            else:
                save_file(f'初始密码: {password}')
        print(f'初始密码: {password}\t\t\t\t')
        if args.robot: saveFileRobot(f'初始密码: {password}')
        browser = loginH5(username=args.loginID,
                          passwd=password,
                          env=args.env,
                          menhuPath=args.path,
                          bro=browser)  #初始密码登陆
        browser, newpassword = changePasswordH5(loginId=args.loginID,
                                                password=password,
                                                newpassword=newpassword,
                                                paypassword=paypassword,
                                                env=args.env,
                                                menhuPath=args.path,
                                                bro=browser)
        if saveToMysql:
            mysqlOpt(
                f"UPDATE registerinfo SET Password='******',Payword='{paypassword}' WHERE LoginID='{args.loginID}'"
            )
        else:
            save_file(f'登陆密码: {newpassword}\t支付密码: {paypassword}')
        print(f'登陆密码: {newpassword}\t支付密码: {paypassword}\t\t')
        if args.robot:
            saveFileRobot(f'登陆密码: {newpassword}\t支付密码: {paypassword}\t\t')
        result = '密码修改完成!'
        if args.all in ['y', None, 'Y']:
            browser = loginH5(username=args.loginID,
                              passwd=newpassword,
                              env=args.env,
                              fillLoginID=0,
                              menhuPath=args.path,
                              bro=browser)  #修改后的密码登陆
            JBC = True if args.daddy == '2' else False
            browser, result = AutoFillH5(loginId=args.loginID,
                                         password=newpassword,
                                         bankCode=args.legal_bank,
                                         env=args.env,
                                         change=change,
                                         pLegalID=args.pLegalID,
                                         oFill=args.overfill,
                                         JBC=JBC,
                                         robot=args.robot,
                                         bro=browser)
            if saveToMysql:
                mysqlOpt(
                    f"UPDATE registerinfo SET IsApplicate=1 WHERE LoginID='{args.loginID}'"
                )
            # browser.quit()
        return browser, result
    except Exception as err:
        reason = getErrReason(browser)
        if not reason: reason = err
        print('开户失败!原因:', reason)
        sys.exit()