Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
2026-04-28 01:42:15 +08:00
co-authored by Copilot
parent a5d22d3b88
commit 5dfdc9da10
5 changed files with 26 additions and 24 deletions
+4 -4
View File
@@ -58,19 +58,19 @@ async def get_character_info(request: Request, state: AltersDep, redis: RedisDep
@router.get('/info/oath/{suitId}/{skillId}') @router.get('/info/oath/{suitId}/{skillId}')
async def get_oath_info(state: AltersDep, suitId: str, skillId: str, rarity: str, redis: RedisDep): async def get_oath_info(state: AltersDep, suitId: str, skillId: str, rarity: str, lv: int, redis: RedisDep):
def get_info(): def get_info():
skill = None skill = None
version = state.equVersion version = state.equVersion
equ = get_equipment(version) equ = get_equipment(version)
oath = next((x for x in equ.oath_suits if x.suitId == suitId and x.rarity == rarity), None) oath = next((x for x in equ.oath_suits if x.suitId == suitId and x.rarity == rarity and str(x.level) == str(lv)), None)
if oath is not None: if oath is not None:
oathSkill = next((x for x in oath.skills if x.skillId == skillId), None) oathSkill = next((x for x in oath.skills if x.skillId == skillId), None)
if oathSkill is not None: if oathSkill is not None:
skill = {**oathSkill.__dict__, 'point': oath.points, 'imageUrl': oath.imageUrl} skill = {**oathSkill.__dict__, 'point': oath.points.split(',')[lv - 1], 'imageUrl': oath.imageUrl}
return skill return skill
info = get_redis_info(redis, f'dcalc:oath:{suitId}:{rarity}:{skillId}', get_info) info = get_redis_info(redis, f'dcalc:oath:{suitId}:{rarity}:{lv}:{skillId}', get_info)
return response(data=info) return response(data=info)
Binary file not shown.
+2 -2
View File
@@ -27,8 +27,8 @@ export default defineRequest((request) => {
const res = await request.post(`/skillTree/`, { code }) const res = await request.post(`/skillTree/`, { code })
return res.data return res.data
}, },
async getOathInfo(suitId: string, skillId: string, rarity: string) { async getOathInfo(suitId: string, skillId: string, rarity: string, lv: number) {
const res = await request.get(`/info/oath/${suitId}/${skillId}`, { params: { rarity } }) const res = await request.get(`/info/oath/${suitId}/${skillId}`, { params: { rarity, lv } })
return res.data return res.data
}, },
} }
@@ -341,7 +341,7 @@ const curOathInfo = computed(() => {
return infoStore.oathSkills?.[curEquInfo.value?.suit[0]] return infoStore.oathSkills?.[curEquInfo.value?.suit[0]]
}) })
const curOathSkillLvs = asyncComputed(async () => { const curOathSkillInfo = asyncComputed(async () => {
if (!curOathInfo.value || !curEquInfo.value?.suit[0]) { if (!curOathInfo.value || !curEquInfo.value?.suit[0]) {
return undefined return undefined
} }
@@ -349,23 +349,24 @@ const curOathSkillLvs = asyncComputed(async () => {
curEquInfo.value?.suit[0], curEquInfo.value?.suit[0],
oathSkillId.value, oathSkillId.value,
curOathSkillLv.value.rarity, curOathSkillLv.value.rarity,
curOathSkillLv.value.lv,
) )
return res return res
}) })
const curOathSkillInfo = computed(() => { // const curOathSkillInfo = computed(() => {
const res = curOathSkillLvs.value // const res = curOathSkillLvs.value
if (!res) { // if (!res) {
return undefined // return undefined
} // }
// console.log(curEquInfo.value?.suit[0]) // // console.log(curEquInfo.value?.suit[0])
return { // return {
...res, // ...res,
SkillAttack: parseFloat(res.SkillAttack.toString().split(',')[curOathSkillLv.value.lv - 1]), // SkillAttack: parseFloat(res.SkillAttack.toString().split(',')[curOathSkillLv.value.lv - 1]),
Buffer: parseFloat(res.Buffer.toString().split(',')[curOathSkillLv.value.lv - 1]), // Buffer: parseFloat(res.Buffer.toString().split(',')[curOathSkillLv.value.lv - 1]),
point: parseFloat(res.point.toString().split(',')[curOathSkillLv.value.lv - 1]), // point: parseFloat(res.point.toString().split(',')[curOathSkillLv.value.lv - 1]),
} // }
}) // })
const chooseCategory = (cat: string) => { const chooseCategory = (cat: string) => {
type.value = cat type.value = cat
+5 -4
View File
@@ -13,6 +13,7 @@ export const useInfoStore = defineStore('infoStore', () => {
suitId: string suitId: string
skillId: string skillId: string
rarity: string rarity: string
lv: number
data: ISuit data: ISuit
}[] }[]
>([]) >([])
@@ -54,17 +55,17 @@ export const useInfoStore = defineStore('infoStore', () => {
return result return result
}) })
const getOathInfo = async (suitId: string, skillId: string, rarity: string) => { const getOathInfo = async (suitId: string, skillId: string, rarity: string, lv: number) => {
const res = oathCache.value.find( const res = oathCache.value.find(
(o) => o.suitId === suitId && o.skillId === skillId && o.rarity === rarity, (o) => o.suitId === suitId && o.skillId === skillId && o.rarity === rarity && o.lv === lv,
) )
if (res) { if (res) {
return { return {
...res.data, ...res.data,
} }
} }
const data: ISuit = await api.getOathInfo(suitId, skillId, rarity) const data: ISuit = await api.getOathInfo(suitId, skillId, rarity, lv)
oathCache.value.push({ suitId, skillId, rarity, data }) oathCache.value.push({ suitId, skillId, rarity, lv, data })
return { return {
...data, ...data,
} }