更新导入歌单的id生成方式
parent
53b470ed09
commit
b8287acff3
|
@ -5,6 +5,7 @@ import { getListDetail, getListDetailAll } from '@renderer/store/leaderboard/act
|
||||||
import { createUserList, setTempList } from '@renderer/store/list/action'
|
import { createUserList, setTempList } from '@renderer/store/list/action'
|
||||||
import { playList } from '@renderer/core/player/action'
|
import { playList } from '@renderer/core/player/action'
|
||||||
import { LIST_IDS } from '@common/constants'
|
import { LIST_IDS } from '@common/constants'
|
||||||
|
import { toMD5 } from '@renderer/utils'
|
||||||
|
|
||||||
const getListId = (id: string) => `board__${id}`
|
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)
|
// console.log(this.listDetail.info)
|
||||||
// if (!this.listDetail.info.name) return
|
// if (!this.listDetail.info.name) return
|
||||||
const listId = getListId(id)
|
const listId = getListId(id)
|
||||||
const targetList = userLists.find(l => l.id == listId)
|
const targetList = userLists.find(l => l.sourceListId == listId)
|
||||||
if (targetList) {
|
if (targetList) {
|
||||||
const confirm = await dialog.confirm({
|
const confirm = await dialog.confirm({
|
||||||
message: window.i18n.t('duplicate_list_tip', { name: targetList.name }),
|
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)
|
const list = await getListDetailAll(id)
|
||||||
await createUserList({
|
await createUserList({
|
||||||
name,
|
name,
|
||||||
id: listId,
|
id: `${source}_${toMD5(listId)}`,
|
||||||
list,
|
list,
|
||||||
source,
|
source,
|
||||||
sourceListId: listId,
|
sourceListId: listId,
|
||||||
|
|
|
@ -5,6 +5,7 @@ import { getListDetail, getListDetailAll } from '@renderer/store/songList/action
|
||||||
import { createUserList, setTempList } from '@renderer/store/list/action'
|
import { createUserList, setTempList } from '@renderer/store/list/action'
|
||||||
import { playList } from '@renderer/core/player/action'
|
import { playList } from '@renderer/core/player/action'
|
||||||
import { LIST_IDS } from '@common/constants'
|
import { LIST_IDS } from '@common/constants'
|
||||||
|
import { toMD5 } from '@renderer/utils'
|
||||||
|
|
||||||
const getListId = (id: string, source: LX.OnlineSource) => `${source}__${id}`
|
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)
|
// console.log(this.listDetail.info)
|
||||||
// if (!this.listDetail.info.name) return
|
// if (!this.listDetail.info.name) return
|
||||||
const listId = getListId(id, source)
|
const listId = getListId(id, source)
|
||||||
const targetList = userLists.find(l => l.id == listId)
|
const targetList = userLists.find(l => l.sourceListId == listId)
|
||||||
if (targetList) {
|
if (targetList) {
|
||||||
const confirm = await dialog.confirm({
|
const confirm = await dialog.confirm({
|
||||||
message: window.i18n.t('duplicate_list_tip', { name: targetList.name }),
|
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)
|
const list = await getListDetailAll(id, source)
|
||||||
await createUserList({
|
await createUserList({
|
||||||
name,
|
name,
|
||||||
id: listId,
|
id: `${source}_${toMD5(listId)}`,
|
||||||
list,
|
list,
|
||||||
source,
|
source,
|
||||||
sourceListId: id,
|
sourceListId: id,
|
||||||
|
|
Loading…
Reference in New Issue