Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
new-api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
9d6c1546
authored
Aug 09, 2025
by
Calcium-Ion
Committed by
GitHub
Aug 09, 2025
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1458 from simplty/fix/midjourney-field-compatibility
fix(midjourney): 为 Midjourney 任务添加视频 URL 字段
parents
807ec200
8f484651
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
0 deletions
+30
-0
controller/midjourney.go
+30
-0
No files found.
controller/midjourney.go
View file @
9d6c1546
...
@@ -145,6 +145,22 @@ func UpdateMidjourneyTaskBulk() {
...
@@ -145,6 +145,22 @@ func UpdateMidjourneyTaskBulk() {
buttonStr
,
_
:=
json
.
Marshal
(
responseItem
.
Buttons
)
buttonStr
,
_
:=
json
.
Marshal
(
responseItem
.
Buttons
)
task
.
Buttons
=
string
(
buttonStr
)
task
.
Buttons
=
string
(
buttonStr
)
}
}
// 映射 VideoUrl
task
.
VideoUrl
=
responseItem
.
VideoUrl
// 映射 VideoUrls - 将数组序列化为 JSON 字符串
if
responseItem
.
VideoUrls
!=
nil
&&
len
(
responseItem
.
VideoUrls
)
>
0
{
videoUrlsStr
,
err
:=
json
.
Marshal
(
responseItem
.
VideoUrls
)
if
err
!=
nil
{
common
.
LogError
(
ctx
,
fmt
.
Sprintf
(
"序列化 VideoUrls 失败: %v"
,
err
))
task
.
VideoUrls
=
"[]"
// 失败时设置为空数组
}
else
{
task
.
VideoUrls
=
string
(
videoUrlsStr
)
}
}
else
{
task
.
VideoUrls
=
""
// 空值时清空字段
}
shouldReturnQuota
:=
false
shouldReturnQuota
:=
false
if
(
task
.
Progress
!=
"100%"
&&
responseItem
.
FailReason
!=
""
)
||
(
task
.
Progress
==
"100%"
&&
task
.
Status
==
"FAILURE"
)
{
if
(
task
.
Progress
!=
"100%"
&&
responseItem
.
FailReason
!=
""
)
||
(
task
.
Progress
==
"100%"
&&
task
.
Status
==
"FAILURE"
)
{
common
.
LogInfo
(
ctx
,
task
.
MjId
+
" 构建失败,"
+
task
.
FailReason
)
common
.
LogInfo
(
ctx
,
task
.
MjId
+
" 构建失败,"
+
task
.
FailReason
)
...
@@ -208,6 +224,20 @@ func checkMjTaskNeedUpdate(oldTask *model.Midjourney, newTask dto.MidjourneyDto)
...
@@ -208,6 +224,20 @@ func checkMjTaskNeedUpdate(oldTask *model.Midjourney, newTask dto.MidjourneyDto)
if
oldTask
.
Progress
!=
"100%"
&&
newTask
.
FailReason
!=
""
{
if
oldTask
.
Progress
!=
"100%"
&&
newTask
.
FailReason
!=
""
{
return
true
return
true
}
}
// 检查 VideoUrl 是否需要更新
if
oldTask
.
VideoUrl
!=
newTask
.
VideoUrl
{
return
true
}
// 检查 VideoUrls 是否需要更新
if
newTask
.
VideoUrls
!=
nil
&&
len
(
newTask
.
VideoUrls
)
>
0
{
newVideoUrlsStr
,
_
:=
json
.
Marshal
(
newTask
.
VideoUrls
)
if
oldTask
.
VideoUrls
!=
string
(
newVideoUrlsStr
)
{
return
true
}
}
else
if
oldTask
.
VideoUrls
!=
""
{
// 如果新数据没有 VideoUrls 但旧数据有,需要更新(清空)
return
true
}
return
false
return
false
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment