Skip to content

Commit 1487ac9

Browse files
committed
8.7.8
1 parent 44f6c03 commit 1487ac9

File tree

3 files changed

+18
-14
lines changed

3 files changed

+18
-14
lines changed

src/Midjourney.API/Midjourney.API.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>
1010
<EnableCompressionInSingleFile>true</EnableCompressionInSingleFile>
1111
<SatelliteResourceLanguages>zh-Hans</SatelliteResourceLanguages>
12-
<AssemblyVersion>8.7.7</AssemblyVersion>
12+
<AssemblyVersion>8.7.8</AssemblyVersion>
1313
<DockerfileContext>..\..</DockerfileContext>
1414
</PropertyGroup>
1515

src/Midjourney.Base/DrawCounter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ public static bool InitUserTodayCounter(string userId)
281281
/// <param name="item"></param>
282282
public static void Success(TaskInfo item)
283283
{
284-
if (item == null || item.Status != TaskStatus.SUCCESS || item.Action == null)
284+
if (item == null || item.Action == null)
285285
{
286286
return;
287287
}

src/Midjourney.Base/Models/TaskInfo.cs

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -620,15 +620,15 @@ private void SuccessUpdate()
620620
var prompt = finalPrompt.ToLower();
621621

622622
// 解析速度模式
623-
if (prompt.Contains("--fast"))
623+
if (prompt.Contains("--fast", StringComparison.OrdinalIgnoreCase))
624624
{
625625
Mode = GenerationSpeedMode.FAST;
626626
}
627-
else if (prompt.Contains("--relax"))
627+
else if (prompt.Contains("--relax", StringComparison.OrdinalIgnoreCase))
628628
{
629629
Mode = GenerationSpeedMode.RELAX;
630630
}
631-
else if (prompt.Contains("--turbo"))
631+
else if (prompt.Contains("--turbo", StringComparison.OrdinalIgnoreCase))
632632
{
633633
Mode = GenerationSpeedMode.TURBO;
634634
}
@@ -655,7 +655,7 @@ private void SuccessUpdate()
655655
SetProperty(Constants.TASK_PROPERTY_FINAL_PROMPT, finalPrompt);
656656
}
657657

658-
UpdateUserDrawCount();
658+
UpdateUserDrawCount(true);
659659

660660
// 最后才设置完成时间和状态
661661
FinishTime = DateTimeOffset.Now.ToUnixTimeMilliseconds();
@@ -674,11 +674,6 @@ public void Fail(string reason)
674674
reason = reason.Substring(0, 4000); // 限制失败原因长度
675675
}
676676

677-
FinishTime = DateTimeOffset.Now.ToUnixTimeMilliseconds();
678-
Status = TaskStatus.FAILURE;
679-
FailReason = reason;
680-
Progress = "";
681-
682677
if (!string.IsNullOrWhiteSpace(reason))
683678
{
684679
if (reason.Contains("Banned prompt detected", StringComparison.OrdinalIgnoreCase)
@@ -712,17 +707,26 @@ public void Fail(string reason)
712707
}
713708
}
714709

715-
UpdateUserDrawCount();
710+
FinishTime = DateTimeOffset.Now.ToUnixTimeMilliseconds();
711+
Status = TaskStatus.FAILURE;
712+
FailReason = reason;
713+
Progress = "";
714+
715+
UpdateUserDrawCount(false);
716716
}
717717

718718
/// <summary>
719719
/// 更新用户绘图次数。
720720
/// </summary>
721-
public void UpdateUserDrawCount()
721+
public void UpdateUserDrawCount(bool success)
722722
{
723723
try
724724
{
725-
DrawCounter.Success(this);
725+
if (success)
726+
{
727+
DrawCounter.Success(this);
728+
}
729+
726730

727731
//if (!string.IsNullOrWhiteSpace(UserId))
728732
//{

0 commit comments

Comments
 (0)