feat: 添加掉落物的url查询API
@@ -186,6 +186,21 @@ async def get_web_config() -> InfoOut:
|
||||
return InfoOut(data={"WebConfig": data})
|
||||
|
||||
|
||||
@router.post(
|
||||
"/get/materials", summary="获取材料URL", response_model=InfoOut, status_code=200
|
||||
)
|
||||
async def get_materials(
|
||||
materials: GetMaterialsIn = Body(..., description="材料ID")
|
||||
) -> InfoOut:
|
||||
try:
|
||||
data = await Config.get_materials(materials.dropId)
|
||||
except Exception as e:
|
||||
return InfoOut(
|
||||
code=500, status="error", message=f"{type(e).__name__}: {str(e)}", data={}
|
||||
)
|
||||
return InfoOut(data={"FileUrl": data})
|
||||
|
||||
|
||||
@router.post(
|
||||
"/get/overview", summary="信息总览", response_model=InfoOut, status_code=200
|
||||
)
|
||||
|
||||
@@ -30,9 +30,10 @@ import requests
|
||||
import truststore
|
||||
from pathlib import Path
|
||||
from fastapi import WebSocket
|
||||
from urllib.parse import quote
|
||||
from collections import defaultdict
|
||||
from datetime import datetime, timedelta, date, timezone
|
||||
from typing import Literal, Optional, Tuple
|
||||
from typing import Literal, Optional
|
||||
|
||||
from app.models.ConfigBase import *
|
||||
from app.utils.constants import *
|
||||
@@ -1741,6 +1742,12 @@ class AppConfig(GlobalConfig):
|
||||
|
||||
return stage_data
|
||||
|
||||
async def get_materials(self, dropId):
|
||||
"""获取材料URL"""
|
||||
if dropId not in MATERIALS_MAP:
|
||||
raise ValueError(f"未知的材料ID: {dropId}")
|
||||
return f"file:///{quote((Path.cwd() / f"res/images/materials/{dropId}.png").as_posix())}"
|
||||
|
||||
async def get_script_combox(self):
|
||||
"""获取脚本下拉框信息"""
|
||||
|
||||
|
||||
@@ -67,6 +67,10 @@ class GetStageIn(BaseModel):
|
||||
)
|
||||
|
||||
|
||||
class GetMaterialsIn(BaseModel):
|
||||
dropId: str = Field(..., description="材料ID")
|
||||
|
||||
|
||||
class GlobalConfig_Function(BaseModel):
|
||||
HistoryRetentionTime: Optional[Literal[7, 15, 30, 60, 90, 180, 365, 0]] = Field(
|
||||
None, description="历史记录保留时间, 0表示永久保存"
|
||||
|
||||
@@ -206,5 +206,9 @@ MATERIALS_MAP = {
|
||||
"3261": "医疗芯片",
|
||||
"3271": "辅助芯片",
|
||||
"3281": "特种芯片",
|
||||
"PR-A": "医疗/重装芯片",
|
||||
"PR-B": "术师/狙击芯片",
|
||||
"PR-C": "先锋/辅助芯片",
|
||||
"PR-D": "近卫/特种芯片",
|
||||
}
|
||||
"""掉落物索引表"""
|
||||
|
||||
BIN
res/images/materials/2001.png
Normal file
|
After Width: | Height: | Size: 40 KiB |
BIN
res/images/materials/2002.png
Normal file
|
After Width: | Height: | Size: 40 KiB |
BIN
res/images/materials/2003.png
Normal file
|
After Width: | Height: | Size: 45 KiB |
BIN
res/images/materials/2004.png
Normal file
|
After Width: | Height: | Size: 47 KiB |
BIN
res/images/materials/30011.png
Normal file
|
After Width: | Height: | Size: 36 KiB |
BIN
res/images/materials/30012.png
Normal file
|
After Width: | Height: | Size: 43 KiB |
BIN
res/images/materials/30013.png
Normal file
|
After Width: | Height: | Size: 49 KiB |
BIN
res/images/materials/30014.png
Normal file
|
After Width: | Height: | Size: 54 KiB |
BIN
res/images/materials/30021.png
Normal file
|
After Width: | Height: | Size: 35 KiB |
BIN
res/images/materials/30022.png
Normal file
|
After Width: | Height: | Size: 40 KiB |
BIN
res/images/materials/30023.png
Normal file
|
After Width: | Height: | Size: 43 KiB |
BIN
res/images/materials/30024.png
Normal file
|
After Width: | Height: | Size: 51 KiB |
BIN
res/images/materials/30031.png
Normal file
|
After Width: | Height: | Size: 34 KiB |
BIN
res/images/materials/30032.png
Normal file
|
After Width: | Height: | Size: 43 KiB |
BIN
res/images/materials/30033.png
Normal file
|
After Width: | Height: | Size: 46 KiB |
BIN
res/images/materials/30034.png
Normal file
|
After Width: | Height: | Size: 48 KiB |
BIN
res/images/materials/30041.png
Normal file
|
After Width: | Height: | Size: 33 KiB |
BIN
res/images/materials/30042.png
Normal file
|
After Width: | Height: | Size: 42 KiB |
BIN
res/images/materials/30043.png
Normal file
|
After Width: | Height: | Size: 49 KiB |
BIN
res/images/materials/30044.png
Normal file
|
After Width: | Height: | Size: 61 KiB |
BIN
res/images/materials/30051.png
Normal file
|
After Width: | Height: | Size: 29 KiB |
BIN
res/images/materials/30052.png
Normal file
|
After Width: | Height: | Size: 36 KiB |
BIN
res/images/materials/30053.png
Normal file
|
After Width: | Height: | Size: 47 KiB |
BIN
res/images/materials/30054.png
Normal file
|
After Width: | Height: | Size: 57 KiB |
BIN
res/images/materials/30061.png
Normal file
|
After Width: | Height: | Size: 40 KiB |
BIN
res/images/materials/30062.png
Normal file
|
After Width: | Height: | Size: 40 KiB |
BIN
res/images/materials/30063.png
Normal file
|
After Width: | Height: | Size: 45 KiB |
BIN
res/images/materials/30064.png
Normal file
|
After Width: | Height: | Size: 50 KiB |
BIN
res/images/materials/30073.png
Normal file
|
After Width: | Height: | Size: 41 KiB |
BIN
res/images/materials/30074.png
Normal file
|
After Width: | Height: | Size: 46 KiB |
BIN
res/images/materials/30083.png
Normal file
|
After Width: | Height: | Size: 41 KiB |
BIN
res/images/materials/30084.png
Normal file
|
After Width: | Height: | Size: 56 KiB |
BIN
res/images/materials/30093.png
Normal file
|
After Width: | Height: | Size: 47 KiB |
BIN
res/images/materials/30094.png
Normal file
|
After Width: | Height: | Size: 52 KiB |
BIN
res/images/materials/30103.png
Normal file
|
After Width: | Height: | Size: 46 KiB |
BIN
res/images/materials/30104.png
Normal file
|
After Width: | Height: | Size: 55 KiB |
BIN
res/images/materials/30115.png
Normal file
|
After Width: | Height: | Size: 58 KiB |
BIN
res/images/materials/30125.png
Normal file
|
After Width: | Height: | Size: 61 KiB |
BIN
res/images/materials/30135.png
Normal file
|
After Width: | Height: | Size: 62 KiB |
BIN
res/images/materials/30145.png
Normal file
|
After Width: | Height: | Size: 61 KiB |
BIN
res/images/materials/30155.png
Normal file
|
After Width: | Height: | Size: 54 KiB |
BIN
res/images/materials/30165.png
Normal file
|
After Width: | Height: | Size: 57 KiB |
BIN
res/images/materials/31013.png
Normal file
|
After Width: | Height: | Size: 41 KiB |
BIN
res/images/materials/31014.png
Normal file
|
After Width: | Height: | Size: 46 KiB |
BIN
res/images/materials/31023.png
Normal file
|
After Width: | Height: | Size: 53 KiB |
BIN
res/images/materials/31024.png
Normal file
|
After Width: | Height: | Size: 61 KiB |
BIN
res/images/materials/31033.png
Normal file
|
After Width: | Height: | Size: 38 KiB |
BIN
res/images/materials/31034.png
Normal file
|
After Width: | Height: | Size: 53 KiB |
BIN
res/images/materials/31043.png
Normal file
|
After Width: | Height: | Size: 50 KiB |
BIN
res/images/materials/31044.png
Normal file
|
After Width: | Height: | Size: 55 KiB |
BIN
res/images/materials/31053.png
Normal file
|
After Width: | Height: | Size: 56 KiB |
BIN
res/images/materials/31054.png
Normal file
|
After Width: | Height: | Size: 60 KiB |
BIN
res/images/materials/31063.png
Normal file
|
After Width: | Height: | Size: 41 KiB |
BIN
res/images/materials/31064.png
Normal file
|
After Width: | Height: | Size: 53 KiB |
BIN
res/images/materials/31073.png
Normal file
|
After Width: | Height: | Size: 55 KiB |
BIN
res/images/materials/31074.png
Normal file
|
After Width: | Height: | Size: 64 KiB |
BIN
res/images/materials/31083.png
Normal file
|
After Width: | Height: | Size: 53 KiB |
BIN
res/images/materials/31084.png
Normal file
|
After Width: | Height: | Size: 59 KiB |
BIN
res/images/materials/31093.png
Normal file
|
After Width: | Height: | Size: 43 KiB |
BIN
res/images/materials/31094.png
Normal file
|
After Width: | Height: | Size: 52 KiB |
BIN
res/images/materials/3112.png
Normal file
|
After Width: | Height: | Size: 34 KiB |
BIN
res/images/materials/3113.png
Normal file
|
After Width: | Height: | Size: 40 KiB |
BIN
res/images/materials/3114.png
Normal file
|
After Width: | Height: | Size: 50 KiB |
BIN
res/images/materials/3211.png
Normal file
|
After Width: | Height: | Size: 39 KiB |
BIN
res/images/materials/3212.png
Normal file
|
After Width: | Height: | Size: 46 KiB |
BIN
res/images/materials/3213.png
Normal file
|
After Width: | Height: | Size: 52 KiB |
BIN
res/images/materials/3221.png
Normal file
|
After Width: | Height: | Size: 39 KiB |
BIN
res/images/materials/3222.png
Normal file
|
After Width: | Height: | Size: 46 KiB |
BIN
res/images/materials/3223.png
Normal file
|
After Width: | Height: | Size: 52 KiB |
BIN
res/images/materials/3231.png
Normal file
|
After Width: | Height: | Size: 40 KiB |
BIN
res/images/materials/3232.png
Normal file
|
After Width: | Height: | Size: 48 KiB |
BIN
res/images/materials/3233.png
Normal file
|
After Width: | Height: | Size: 54 KiB |
BIN
res/images/materials/3241.png
Normal file
|
After Width: | Height: | Size: 40 KiB |
BIN
res/images/materials/3242.png
Normal file
|
After Width: | Height: | Size: 47 KiB |
BIN
res/images/materials/3243.png
Normal file
|
After Width: | Height: | Size: 52 KiB |
BIN
res/images/materials/3251.png
Normal file
|
After Width: | Height: | Size: 39 KiB |
BIN
res/images/materials/3252.png
Normal file
|
After Width: | Height: | Size: 46 KiB |
BIN
res/images/materials/3253.png
Normal file
|
After Width: | Height: | Size: 51 KiB |
BIN
res/images/materials/3261.png
Normal file
|
After Width: | Height: | Size: 40 KiB |
BIN
res/images/materials/3262.png
Normal file
|
After Width: | Height: | Size: 48 KiB |
BIN
res/images/materials/3263.png
Normal file
|
After Width: | Height: | Size: 53 KiB |
BIN
res/images/materials/3271.png
Normal file
|
After Width: | Height: | Size: 40 KiB |
BIN
res/images/materials/3272.png
Normal file
|
After Width: | Height: | Size: 48 KiB |
BIN
res/images/materials/3273.png
Normal file
|
After Width: | Height: | Size: 54 KiB |
BIN
res/images/materials/3281.png
Normal file
|
After Width: | Height: | Size: 39 KiB |
BIN
res/images/materials/3282.png
Normal file
|
After Width: | Height: | Size: 46 KiB |
BIN
res/images/materials/3283.png
Normal file
|
After Width: | Height: | Size: 52 KiB |
BIN
res/images/materials/3301.png
Normal file
|
After Width: | Height: | Size: 48 KiB |
BIN
res/images/materials/3302.png
Normal file
|
After Width: | Height: | Size: 50 KiB |
BIN
res/images/materials/3303.png
Normal file
|
After Width: | Height: | Size: 46 KiB |
BIN
res/images/materials/4001.png
Normal file
|
After Width: | Height: | Size: 52 KiB |
BIN
res/images/materials/4006.png
Normal file
|
After Width: | Height: | Size: 50 KiB |
BIN
res/images/materials/PR-A.png
Normal file
|
After Width: | Height: | Size: 50 KiB |
BIN
res/images/materials/PR-B.png
Normal file
|
After Width: | Height: | Size: 48 KiB |
BIN
res/images/materials/PR-C.png
Normal file
|
After Width: | Height: | Size: 49 KiB |
BIN
res/images/materials/PR-D.png
Normal file
|
After Width: | Height: | Size: 47 KiB |