diff --git a/app/tmnet_db_func.py b/app/tmnet_db_func.py index d87b8b3..a6180f3 100644 --- a/app/tmnet_db_func.py +++ b/app/tmnet_db_func.py @@ -281,18 +281,19 @@ class TmnetDbHelper(TableDbHelperBase): return 0, e def clear_old_cross_examine_records(self): - old_data_sql = "select * from cross_doctor_metadata.cross_phase_problem_record where end_date is null" + old_data_sql = "select * from cross_doctor_matedata.cross_phase_problems_record where end_date is null" old_data = self.do_select(old_data_sql) clear_list = [] now_date, suc_num = datetime.now().strftime('%Y%m%d'), 0 for row in old_data: phase_type = row['phase_type'] - if phase_type[-4] == '^^^^': - clear_list.append({ - 'crossid': row['crossid'], - 'start_hm': row['start_hm'], - 'first_date': row['first_date'] - }) + if len(phase_type) >= 5: + if phase_type[-4] == '^^^^': + clear_list.append({ + 'crossid': row['crossid'], + 'start_hm': row['start_hm'], + 'first_date': row['first_date'] + }) conn, cursor = self.connect() try: clear_sql = """ diff --git a/daily_cross_pahse_problems.py b/daily_cross_pahse_problems.py index 9791e21..f070de2 100644 --- a/daily_cross_pahse_problems.py +++ b/daily_cross_pahse_problems.py @@ -61,7 +61,7 @@ def init(args): dev = int(args.dev) day = args.day if dev == 0: - g_cloud_db['host'] = '172.21.32.41' + g_cloud_db['host'] = '172.21.32.43' g_cloud_db['port'] = 3306 g_dbinfo['host'] = '172.21.32.21' g_db_pool.init_pool(g_dbinfo) @@ -69,7 +69,7 @@ def init(args): if day == 0: day = (datetime.now() - timedelta(days=1)).strftime('%Y%m%d') today_data = g_db_cloud.query_all_cross_examine_problems(day) - yes_str = datetime.strptime(day, '%Y%m%d').strftime('%Y-%m-%d') + yes_str = (datetime.strptime(day, '%Y%m%d') - timedelta(days=1)).strftime('%Y-%m-%d') yesterday_records = g_db_cross.query_all_cross_examine_records(yes_str) yesterday_data_dict = parse_records2dict(yesterday_records) today_records = {}