Completed
Push — master ( 481865...ed4291 )
by John
24s queued 10s
created

MonitorBase::updateStatus()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 11
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 3
eloc 8
c 1
b 0
f 1
nc 3
nop 2
dl 0
loc 11
rs 10
1
<?php
2
3
namespace App\Babel\Monit;
4
5
use App\Models\Eloquent\JudgeServerModel;
6
use ErrorException;
7
use Exception;
8
use Throwable;
9
10
class MonitorBase
11
{
12
    public function updateStatus($jsid, $status)
13
    {
14
        $judgeServer=JudgeServerModel::find($jsid);
15
        if (is_null($judgeServer)) {
16
            return false;
17
        } else {
18
            if ($judgeServer->available==0) {
19
                $status=-2;
20
            }
21
            $judgeServer->status=$status;
22
            $judgeServer->status_update_at=date("Y-m-d H:i:s");
23
        }
24
    }
25
}
26