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
f134b9cf
authored
Jul 15, 2024
by
CalciumIon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: try to fix mj
parent
22ed8873
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
9 deletions
+12
-9
controller/midjourney.go
+12
-9
No files found.
controller/midjourney.go
View file @
f134b9cf
...
...
@@ -146,7 +146,7 @@ func UpdateMidjourneyTaskBulk() {
buttonStr
,
_
:=
json
.
Marshal
(
responseItem
.
Buttons
)
task
.
Buttons
=
string
(
buttonStr
)
}
shouldReturnQuota
:=
false
if
(
task
.
Progress
!=
"100%"
&&
responseItem
.
FailReason
!=
""
)
||
(
task
.
Progress
==
"100%"
&&
task
.
Status
==
"FAILURE"
)
{
common
.
LogInfo
(
ctx
,
task
.
MjId
+
" 构建失败,"
+
task
.
FailReason
)
task
.
Progress
=
"100%"
...
...
@@ -154,20 +154,23 @@ func UpdateMidjourneyTaskBulk() {
if
err
!=
nil
{
common
.
LogError
(
ctx
,
"error update user quota cache: "
+
err
.
Error
())
}
else
{
quota
:=
task
.
Quota
if
quota
!=
0
{
err
=
model
.
IncreaseUserQuota
(
task
.
UserId
,
quota
)
if
err
!=
nil
{
common
.
LogError
(
ctx
,
"fail to increase user quota: "
+
err
.
Error
())
}
logContent
:=
fmt
.
Sprintf
(
"构图失败 %s,补偿 %s"
,
task
.
MjId
,
common
.
LogQuota
(
quota
))
model
.
RecordLog
(
task
.
UserId
,
model
.
LogTypeSystem
,
logContent
)
if
task
.
Quota
!=
0
{
shouldReturnQuota
=
true
}
}
}
err
=
task
.
Update
()
if
err
!=
nil
{
common
.
LogError
(
ctx
,
"UpdateMidjourneyTask task error: "
+
err
.
Error
())
}
else
{
if
shouldReturnQuota
{
err
=
model
.
IncreaseUserQuota
(
task
.
UserId
,
task
.
Quota
)
if
err
!=
nil
{
common
.
LogError
(
ctx
,
"fail to increase user quota: "
+
err
.
Error
())
}
logContent
:=
fmt
.
Sprintf
(
"构图失败 %s,补偿 %s"
,
task
.
MjId
,
common
.
LogQuota
(
task
.
Quota
))
model
.
RecordLog
(
task
.
UserId
,
model
.
LogTypeSystem
,
logContent
)
}
}
}
}
...
...
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