Skip to content

Commit

Permalink
更新导入歌单的id生成方式
Browse files Browse the repository at this point in the history
  • Loading branch information
lyswhut committed May 25, 2024
1 parent 8b3585f commit 0d996e2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/screens/Home/Views/Leaderboard/listAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { getListDetail, getListDetailAll } from '@/core/leaderboard'
import { LIST_IDS } from '@/config/constant'
import listState from '@/store/list/state'
import syncSourceList from '@/core/syncSourceList'
import { confirmDialog, toast } from '@/utils/tools'
import { confirmDialog, toMD5, toast } from '@/utils/tools'


const getListId = (id: string) => `board__${id}`
Expand Down Expand Up @@ -33,7 +33,7 @@ export const handlePlay = async(id: string, list?: LX.Music.MusicInfoOnline[], i

export const handleCollect = async(id: string, name: string, source: LX.OnlineSource) => {
const listId = getListId(id)
const targetList = listState.userList.find(l => l.id == listId)
const targetList = listState.userList.find(l => l.sourceListId == listId)
if (targetList) {
const confirm = await confirmDialog({
message: global.i18n.t('duplicate_list_tip', { name: targetList.name }),
Expand All @@ -48,7 +48,7 @@ export const handleCollect = async(id: string, name: string, source: LX.OnlineSo
const list = await getListDetailAll(id)
await createList({
name,
id: listId,
id: `${source}_${toMD5(listId)}`,
list,
source,
sourceListId: listId,
Expand Down
6 changes: 3 additions & 3 deletions src/screens/SonglistDetail/listAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { getListDetail, getListDetailAll } from '@/core/songlist'
import { LIST_IDS } from '@/config/constant'
import listState from '@/store/list/state'
import syncSourceList from '@/core/syncSourceList'
import { confirmDialog, toast } from '@/utils/tools'
import { confirmDialog, toMD5, toast } from '@/utils/tools'
import { type Source } from '@/store/songlist/state'

const getListId = (id: string, source: LX.OnlineSource) => `${source}__${id}`
Expand Down Expand Up @@ -34,7 +34,7 @@ export const handlePlay = async(id: string, source: Source, list?: LX.Music.Musi
export const handleCollect = async(id: string, source: Source, name: string) => {
const listId = getListId(id, source)

const targetList = listState.userList.find(l => l.id == listId)
const targetList = listState.userList.find(l => l.sourceListId == listId)
if (targetList) {
const confirm = await confirmDialog({
message: global.i18n.t('duplicate_list_tip', { name: targetList.name }),
Expand All @@ -49,7 +49,7 @@ export const handleCollect = async(id: string, source: Source, name: string) =>
const list = await getListDetailAll(source, id)
await createList({
name,
id: listId,
id: `${source}_${toMD5(listId)}`,
list,
source,
sourceListId: id,
Expand Down

0 comments on commit 0d996e2

Please sign in to comment.