dev: 进一步细化了项目结构
This commit is contained in:
@@ -0,0 +1,8 @@
|
|||||||
|
from flask import Blueprint
|
||||||
|
from ..services import cards
|
||||||
|
|
||||||
|
card_bp = Blueprint("card", __name__, "/card")
|
||||||
|
|
||||||
|
@card_bp.route("/<id>")
|
||||||
|
def search_card(id):
|
||||||
|
return cards.readCard(id)
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
import json
|
||||||
|
|
||||||
|
def readCardList() -> dict:
|
||||||
|
with open("cards/list.json", "r", encoding="utf8") as f:
|
||||||
|
text = f.read()
|
||||||
|
result = json.loads(text)
|
||||||
|
|
||||||
|
return result
|
||||||
|
|
||||||
|
def readCard(id: str):
|
||||||
|
return readCardList().get(id, -1)
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
import json
|
||||||
|
|
||||||
|
def readMatterList() -> dict:
|
||||||
|
with open("matters/list.json", "r", encoding="utf8") as f:
|
||||||
|
text = f.read()
|
||||||
|
result = json.loads(text)
|
||||||
|
|
||||||
|
return result
|
||||||
|
|
||||||
|
def readMatter(id: str):
|
||||||
|
return readMatterList().get(id, -1)
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
import json
|
||||||
|
|
||||||
|
def readReactionList() -> dict:
|
||||||
|
with open("reactions/list.json", "r", encoding="utf8") as f:
|
||||||
|
text = f.read()
|
||||||
|
result = json.loads(text)
|
||||||
|
|
||||||
|
return result
|
||||||
|
|
||||||
|
def readReaction(id: str):
|
||||||
|
return readReactionList().get(id, -1)
|
||||||
Reference in New Issue
Block a user