trafficmonitor init...2
This commit is contained in:
parent
519c09bb7e
commit
da9f79b32b
@ -26,4 +26,12 @@ class CollectorModel extends CommonModel
|
|||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getLastEntity($uid): CollectorEntity|null
|
||||||
|
{
|
||||||
|
return $this
|
||||||
|
->where('trafficinfo_uid', $uid)
|
||||||
|
->orderBy('created_at', 'DESC')
|
||||||
|
->first(); // 첫 번째 레코드(=가장 최신)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -109,11 +109,7 @@ class CollectorService extends CommonService
|
|||||||
throw new \Exception($message);
|
throw new \Exception($message);
|
||||||
}
|
}
|
||||||
// 이전 데이터를 조회하여 Rate 계산에 사용
|
// 이전 데이터를 조회하여 Rate 계산에 사용
|
||||||
$lastEntity = $this->model
|
$lastEntity = $this->model->getLastEntity($trafficEntity->getPK());
|
||||||
->where('trafficinfo_uid', $trafficEntity->getPK())
|
|
||||||
->orderBy('created_at', 'DESC')
|
|
||||||
->first();
|
|
||||||
dd($lastEntity);
|
|
||||||
$inKbitsSec = 0.0;
|
$inKbitsSec = 0.0;
|
||||||
$outKbitsSec = 0.0;
|
$outKbitsSec = 0.0;
|
||||||
// 이전 데이터가 있어야만 Rate 계산 가능
|
// 이전 데이터가 있어야만 Rate 계산 가능
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user