update(Auth): 播放行为鉴权

feature/artists
mackt 7 months ago
parent 445c27c69e
commit 67ed529e8c

@ -50,7 +50,8 @@ export default function Journal() {
return;
}
setPlayListInfo({ type: 'collectSingle', id: null });
const res = setPlayListInfo({ type: 'collectSingle', id: null });
if (!res) return;
setPlayList(songList);
setAudioId(id);
};

@ -65,7 +65,8 @@ export default function Journal() {
return;
}
setPlayListInfo({ type: 'collectVol', id: null });
const res = setPlayListInfo({ type: 'collectVol', id: null });
if (!res) return;
setPlayList(songList);
setAudioId(songList[0].id);
};

@ -48,10 +48,11 @@ export default function ButtonFM() {
const res = await apiGetSongRandom(5);
if (res.code === 200 && res.data.length > 0) {
setPlayListInfo({
const setRes = setPlayListInfo({
type: 'fm',
id: null,
});
if (!setRes) return;
setPlayList(res.data);
setPlayOrder('list_loop');
setPlayQueue([res.data[0]]);

@ -32,10 +32,11 @@ export default function VolPlayButton({
const handlePlay = (state: boolean) => {
if (state && !isCurrentVol) {
setPlayListInfo({
const res = setPlayListInfo({
type: 'vol',
id: journalInfo.id,
});
if (!res) return;
setPlayList(songList);
setAudioId(songList[0].id);
}

@ -48,7 +48,8 @@ export default function SongCardList({ listInfo, songList, className, collectTyp
}
// 重新设置播放列表
setPlayListInfo(listInfo as IPlayListInfo);
const res = setPlayListInfo(listInfo as IPlayListInfo);
if (!res) return;
setPlayList(songList);
setAudioId(id);
};

@ -33,7 +33,7 @@ interface AuioState {
setShow: (value: boolean) => void;
// 显示/隐藏单曲卡片
setShowCard: (value: boolean) => void;
setPlayListInfo: (info: IPlayListInfo) => void;
setPlayListInfo: (info: IPlayListInfo) => boolean;
// 设置播放列表
updatePlayList: (list: SongInfo[]) => void;
// 设置播放列表
@ -205,11 +205,17 @@ const useAudioState = create<AuioState>()(
}),
),
setPlayListInfo: (list) => {
if (!checkAuthOffline()) {
openLogin();
return false;
}
set(
produce((state) => {
state.playListInfo = list;
}),
);
return true;
},
updatePlayList: (list) => {
set(
@ -219,11 +225,6 @@ const useAudioState = create<AuioState>()(
);
},
setPlayList: (list) => {
if (!checkAuthOffline()) {
openLogin();
return;
}
set(
produce((state) => {
state.playList = list;
@ -231,6 +232,7 @@ const useAudioState = create<AuioState>()(
state.playQueue = list;
}),
);
return true;
},
setPlayQueue: (list) => {
set(

Loading…
Cancel
Save