def loop_generate_phone(cls): hail = HandleYaml(PERSONPHONE_PATH) admin_value = cls.generate_phone(reg_name="admin", reg_type=0) investor_value = cls.generate_phone(reg_name="investor") investor_value.update(admin_value) browser_value = cls.generate_phone(reg_name='browser') browser_value.update(investor_value) hail.write_phone_yaml(browser_value)
def phone_yaml(cls): my_yaml = HandleYaml(PHONE_PATH) investor_data = cls.get_phone_nums('investor') borrower_data = cls.get_phone_nums('borrower') borrower_data.update(investor_data) admin_data = cls.get_phone_nums('admin', type=0) admin_data.update(borrower_data) my_yaml.write_phone_yaml(admin_data)
def generate_phone(cls): my_data = {} generate_phone_path = os.path.join(config_path, hy.read_yaml('api', 'phonePath')) my_yaml = HandleYaml(filepath=generate_phone_path) admin_result = cls.get_phone(username='******', type=0) my_data.update(admin_result) invest_result = cls.get_phone(username='******') my_data.update(invest_result) loan_result = cls.get_phone(username='******') my_data.update(loan_result) my_yaml.write_yaml(data=my_data, mode='w')
def generate_phone(cls): hy_yaml = HandleYaml(filepath=phone_yaml) gen_phone = {} # admin admin_result = HandlePhone.get_phone(user='******', type_num=0) gen_phone.update(admin_result) # investor invest_result = HandlePhone.get_phone(user='******', type_num=1) gen_phone.update(invest_result) # loan loan_result = HandlePhone.get_phone(user='******', type_num=1) gen_phone.update(loan_result) hy_yaml.write_yaml(data=gen_phone)
def set_up(): hr = HandleRequest() hm = HandleMysql() hl = HandleYaml(PERSONPHONE_PATH) hr.common_head(hy.read_yaml('request', 'header')) yield hr, hm, hl hr.close() hm.close()
def set_up(): hr = HandleRequests() hm = HandleMysql() hl = HandleYaml(PHONE_PATH) hr.common_heads({hy.read_yaml('request', 'request_head'): hy.read_yaml('request', 'request_value')}) yield hr, hm, hl hr.close() hm.close()
def handle_para(cls, data): hl = HandleYaml(PHONE_PATH) hm = HandleMysql() if re.search(r'{no_exist_phone}', data): phone = hm.no_exsit_phone_mysql() re_data = re.sub(r'{no_exist_phone}', phone, data) HandleMysql().close() return re_data if re.search(r'{invest_phone}', data): re_data = re.sub(r'{invest_phone}', hl.read_yaml('investor', 'mobile_phone'), data) return re_data if re.search(r'{user_id_re}', data): re_data = re.sub(r'{user_id_re}', str(hl.read_yaml('investor', 'id')), data) return re_data if re.search(r'{member_id_re}', data): re_data = re.sub(r'{member_id_re}', str(hl.read_yaml('borrower', 'id')), data) return re_data if re.search(r'{borrow_phone}', data): re_data = re.sub(r'{borrow_phone}', hl.read_yaml('borrower', 'mobile_phone'), data) return re_data if re.search(r'{no_exist_num}', data): re_data = re.sub( r'{no_exist_num}', str( hm.get_mysql_result(hy.read_yaml('mysql', 'id_sql')) ['maxId'] + 1), data) return re_data if re.search(r'{admin_phone}', data): re_data = re.sub(r'{admin_phone}', hl.read_yaml('admin', 'mobile_phone'), data) return re_data if re.search(r'{load_id}', data): re_data = re.sub(r'{load_id}', str(getattr(cls, 'program_id')), data) return re_data if re.search(r'{user_id}', data): my_data = re.sub(r'{user_id}', str(hl.read_yaml('investor', 'id')), data) re_data = re.sub(r'{loan_id_re}', str(getattr(cls, 'program_id')), my_data) return re_data return data
def get_data(cls, data): hl = HandleYaml(PERSONPHONE_PATH) if re.search("{no_exist_phone}", data): hm = HandleMysql() result_value = re.sub("{no_exist_phone}", hm.get_no_exist_phone(), data) hm.close() return result_value if re.search("{invest_phone}", data): result_value = re.sub("{invest_phone}", hl.read_yaml('investor', 'mobile_phone'), data) return result_value if re.search("{user_id_re}", data): result_value = re.sub("{user_id_re}", str(hl.read_yaml('investor', 'id')), data) return result_value if re.search('{member_id_re}', data): result_value = re.sub("{member_id_re}", str(hl.read_yaml('browser', 'id')), data) return result_value if re.search("{borrow_phone}", data): result_value = re.sub("{borrow_phone}", hl.read_yaml('browser', 'mobile_phone'), data) return result_value if re.search("{admin_phone}", data): result_value = re.sub("{admin_phone}", hl.read_yaml('admin', 'mobile_phone'), data) return result_value if re.search("{load_id}", data): result_value = re.sub("{load_id}", str(getattr(cls, 'item_id')), data) return result_value if re.search(r"{loan_id_re}", data): loan_id_str = str(getattr(HandleRe, 'verify_loan_id')) my_value = re.sub('{loan_id_re}', loan_id_str, data) result_value = re.sub(r"{user_id}", str(hl.read_yaml('investor', 'id')), my_value) return result_value return data