添加README

This commit is contained in:
CakeCN
2025-05-10 12:13:43 +08:00
parent f9fd265875
commit e475d84f30
7 changed files with 24 additions and 28 deletions

View File

@@ -4,7 +4,7 @@ import re
class CourseList:
def __init__(self, db_file='db/data/course/course_list.json'):
self.db_file = db_file
with open(self.db_file, 'r') as f:
with open(self.db_file, 'r', encoding='utf-8') as f:
self.db = json.load(f)
def add_course(self, course_id, course_name, course_create_date, course_update_data, course_img_path):
@@ -17,7 +17,7 @@ class CourseList:
self.db[course_id]['course_update_data'] = course_update_data
self.db[course_id]['course_img_path'] = course_img_path
with open(self.db_file, 'w') as f:
with open(self.db_file, 'w', encoding='utf-8') as f:
json.dump(self.db, f, indent=4)
@@ -44,7 +44,7 @@ class CourseList:
self.db[course_id]['course_update_data'] = course_update_data
self.db[course_id]['course_img_path'] = course_img_path
with open(self.db_file, 'w') as f:
with open(self.db_file, 'w', encoding='utf-8') as f:
json.dump(self.db, f, indent=4)
def delete_course(self, course_id):