2022-08-26 12:39:11 +02:00
|
|
|
from fastapi import APIRouter, Request, Response
|
|
|
|
|
|
|
|
from core_common import core_process_request, core_prepare_response, E
|
|
|
|
|
2022-09-06 01:36:43 +02:00
|
|
|
import utils.card as conv
|
|
|
|
|
2022-08-26 12:39:11 +02:00
|
|
|
router = APIRouter(prefix="/local2", tags=["local2"])
|
|
|
|
router.model_whitelist = ["MDX"]
|
|
|
|
|
|
|
|
|
2022-11-15 15:03:37 +01:00
|
|
|
@router.post("/{gameinfo}/system_2/convcardnumber")
|
2022-08-26 12:39:11 +02:00
|
|
|
async def system_2_convcardnumber(request: Request):
|
|
|
|
request_info = await core_process_request(request)
|
2022-11-15 15:03:37 +01:00
|
|
|
cid = request_info["root"][0].find("data/card_id").text
|
2022-08-26 12:39:11 +02:00
|
|
|
|
|
|
|
response = E.response(
|
|
|
|
E.system_2(
|
2022-09-06 01:36:43 +02:00
|
|
|
E.data(E.card_number(conv.to_konami_id(cid), __type="str")),
|
2022-08-26 12:39:11 +02:00
|
|
|
E.result(0, __type="s32"),
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
response_body, response_headers = await core_prepare_response(request, response)
|
|
|
|
return Response(content=response_body, headers=response_headers)
|