Skip to content

Commit c770917

Browse files
committed
fix 完成率 0%--30 分钟不再增加
1 parent 2acf69b commit c770917

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

laravel/app/Http/Repository/ApiRepository.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ public function autoFailed()
7878
// 2. 完成率 50% -- 1 分钟不再增加
7979
// 3. 完成率 10% -- 5 分钟不再增加
8080
// 4. 完成率 1% -- 10 分钟不再增加
81+
// 5. 完成率 0% -- 30 分钟不再增加
8182
$excels = DB::connection()->select('SELECT ae.id,ae.api_param_id,ae.state,ae.total_excel,ael.api_excel_id,ael.sort_index,ael.created_at FROM `boss_api_excel` ae LEFT JOIN boss_api_excel_logs ael ON ae.id=ael.api_excel_id AND ael.id=(SELECT id FROM boss_api_excel_logs WHERE boss_api_excel_logs.api_excel_id=ae.id ORDER BY sort_index DESC LIMIT 1) WHERE ae.state=1 AND ae.`deleted_at` IS NULL ');
8283

8384
foreach ($excels as $excel) {
@@ -91,7 +92,7 @@ public function autoFailed()
9192
// 记录完成率
9293
$finish = (($excel->sort_index + 1) / $excel->total_excel) * 100;
9394
$finish = sprintf("%.2f", $finish);
94-
if (($finish > '96' && strtotime($excel->created_at) + 5 < time()) || ($finish > '50' && strtotime($excel->created_at) + 60 < time()) || ($finish > '10' && strtotime($excel->created_at) + 300 < time()) || ($finish > '1' && strtotime($excel->created_at) + 600 < time())) {
95+
if (($finish > '96' && strtotime($excel->created_at) + 5 < time()) || ($finish > '50' && strtotime($excel->created_at) + 60 < time()) || ($finish > '10' && strtotime($excel->created_at) + 300 < time()) || ($finish > '1' && strtotime($excel->created_at) + 600 < time()) || ($finish >= 0 && strtotime($excel->created_at) + 1800 < time())) {
9596
ApiExcel::where('id', $excel->id)->update(['state' => 5]);
9697
}
9798
}

0 commit comments

Comments
 (0)