30 lines
770 B
Python
30 lines
770 B
Python
# -*- coding: utf-8 -*-
|
|
import json
|
|
import os
|
|
|
|
master_dir = r'C:\Users\청춘약국\source\animal-medication-api\data\master'
|
|
|
|
# 충돌 ID 수정 매핑
|
|
id_map = {
|
|
'apoquel.json': 'MASTER-017',
|
|
'bravecto.json': 'MASTER-018',
|
|
'simparica.json': 'MASTER-019',
|
|
'gabapentin.json': 'MASTER-020',
|
|
'metronidazole.json': 'MASTER-021'
|
|
}
|
|
|
|
for filename, new_id in id_map.items():
|
|
filepath = os.path.join(master_dir, filename)
|
|
with open(filepath, 'r', encoding='utf-8') as f:
|
|
data = json.load(f)
|
|
|
|
old_id = data['product_id']
|
|
data['product_id'] = new_id
|
|
|
|
with open(filepath, 'w', encoding='utf-8') as f:
|
|
json.dump(data, f, ensure_ascii=False, indent=2)
|
|
|
|
print(f'{filename}: {old_id} -> {new_id}')
|
|
|
|
print('Done')
|