【代码优化】AI:音乐、图片的更新状态的接口调整

pull/468/MERGE
YunaiV 2024-06-29 09:47:11 +08:00
parent 68c573d902
commit f98f794f77
4 changed files with 16 additions and 20 deletions

View File

@ -96,14 +96,8 @@ export const ImageApi = {
},
// 更新绘画发布状态
updateImagePublicStatus: async (id: number, publicStatus: boolean) => {
return await request.put({
url: '/ai/image/update-public-status',
data: {
id,
publicStatus
}
})
updateImage: async (data: any) => {
return await request.put({ url: '/ai/image/update-public-status', data })
},
// 删除绘画

View File

@ -16,6 +16,7 @@ export interface MusicVO {
model: string // 模型
generateMode: number // 生成模式
tags: string // 音乐风格标签
duration: number // 音乐时长
publicStatus: boolean // 是否发布
taskId: string // 任务id
errorMessage: string // 错误信息
@ -28,15 +29,9 @@ export const MusicApi = {
return await request.get({ url: `/ai/music/page`, params })
},
// 更新绘画发布状态
updateMusicPublicStatus: async (id: number, publicStatus: boolean) => {
return await request.put({
url: '/ai/music/update-public-status',
data: {
id,
publicStatus
}
})
// 更新音乐
updateMusic: async (data: any) => {
return await request.put({ url: '/ai/music/update', data })
},
// 删除音乐

View File

@ -231,7 +231,10 @@ const handleUpdatePublicStatusChange = async (row: ImageVO) => {
const text = row.publicStatus ? '公开' : '私有'
await message.confirm('确认要"' + text + '"该图片吗?')
//
await ImageApi.updateImagePublicStatus(row.id, row.publicStatus)
await ImageApi.updateImage({
id: row.id,
publicStatus: row.publicStatus
})
await getList()
} catch {
row.publicStatus = !row.publicStatus

View File

@ -135,9 +135,10 @@
</el-link>
</template>
</el-table-column>
<el-table-column label="时长(秒)" align="center" prop="duration" width="100" />
<el-table-column label="提示词" align="center" prop="prompt" width="180" />
<el-table-column label="歌词" align="center" prop="lyric" width="180" />
<el-table-column label="描述" align="center" prop="gptDescriptionPrompt" width="180" />
<el-table-column label="描述" align="center" prop="gptDescriptionPrompt" width="180" />
<el-table-column label="生成模式" align="center" prop="generateMode" width="100">
<template #default="scope">
<dict-tag :type="DICT_TYPE.AI_GENERATE_MODE" :value="scope.row.generateMode" />
@ -265,7 +266,10 @@ const handleUpdatePublicStatusChange = async (row: MusicVO) => {
const text = row.publicStatus ? '公开' : '私有'
await message.confirm('确认要"' + text + '"该音乐吗?')
//
await MusicApi.updateMusicPublicStatus(row.id, row.publicStatus)
await MusicApi.updateMusic({
id: row.id,
publicStatus: row.publicStatus
})
await getList()
} catch {
row.publicStatus = !row.publicStatus