更新导入歌单的id生成方式

pull/1989/head
lyswhut 2024-05-25 19:54:46 +08:00
parent 53b470ed09
commit b8287acff3
2 changed files with 6 additions and 4 deletions

View File

@ -5,6 +5,7 @@ import { getListDetail, getListDetailAll } from '@renderer/store/leaderboard/act
import { createUserList, setTempList } from '@renderer/store/list/action'
import { playList } from '@renderer/core/player/action'
import { LIST_IDS } from '@common/constants'
import { toMD5 } from '@renderer/utils'
const getListId = (id: string) => `board__${id}`
@ -12,7 +13,7 @@ export const addSongListDetail = async(id: string, name: string, source: LX.Onli
// console.log(this.listDetail.info)
// if (!this.listDetail.info.name) return
const listId = getListId(id)
const targetList = userLists.find(l => l.id == listId)
const targetList = userLists.find(l => l.sourceListId == listId)
if (targetList) {
const confirm = await dialog.confirm({
message: window.i18n.t('duplicate_list_tip', { name: targetList.name }),
@ -27,7 +28,7 @@ export const addSongListDetail = async(id: string, name: string, source: LX.Onli
const list = await getListDetailAll(id)
await createUserList({
name,
id: listId,
id: `${source}_${toMD5(listId)}`,
list,
source,
sourceListId: listId,

View File

@ -5,6 +5,7 @@ import { getListDetail, getListDetailAll } from '@renderer/store/songList/action
import { createUserList, setTempList } from '@renderer/store/list/action'
import { playList } from '@renderer/core/player/action'
import { LIST_IDS } from '@common/constants'
import { toMD5 } from '@renderer/utils'
const getListId = (id: string, source: LX.OnlineSource) => `${source}__${id}`
@ -12,7 +13,7 @@ export const addSongListDetail = async(id: string, source: LX.OnlineSource, name
// console.log(this.listDetail.info)
// if (!this.listDetail.info.name) return
const listId = getListId(id, source)
const targetList = userLists.find(l => l.id == listId)
const targetList = userLists.find(l => l.sourceListId == listId)
if (targetList) {
const confirm = await dialog.confirm({
message: window.i18n.t('duplicate_list_tip', { name: targetList.name }),
@ -27,7 +28,7 @@ export const addSongListDetail = async(id: string, source: LX.OnlineSource, name
const list = await getListDetailAll(id, source)
await createUserList({
name,
id: listId,
id: `${source}_${toMD5(listId)}`,
list,
source,
sourceListId: id,