本文整理汇总了PHP中Gateway::getLastEntry方法的典型用法代码示例。如果您正苦于以下问题:PHP Gateway::getLastEntry方法的具体用法?PHP Gateway::getLastEntry怎么用?PHP Gateway::getLastEntry使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gateway
的用法示例。
在下文中一共展示了Gateway::getLastEntry方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run()
{
$newGateways = Gateway::getNewGatewayEuisFromInflux();
foreach ($newGateways as $newGateway) {
$newGateway->save();
}
$lastEntry = Gateway::getLastEntry();
Gateway::updateGatewayStatusFromInflux($lastEntry->last_seen);
}
示例2: function
<?php
/**
* Local variables
* @var \Phalcon\Mvc\Micro $app
*/
/**
* Add your routes here
*/
$app->get('/', function () use($app) {
$gateways = Gateway::find();
$lastEntry = Gateway::getLastEntry();
// this isn't 100% correct: if all gateways are down, the last update datetime won't be the same as the actual update time. Otherwise the update datetime could be up to gateway-update-interval off
echo $app['view']->render('index', array('gateways' => $gateways, 'lastUpdate' => $lastEntry->last_seen));
});
$app->get('/gateways', function () use($app) {
$response = new Phalcon\Http\Response();
$response->setContentType('application/json');
$gateways = Gateway::find();
$gatewaysArray = array();
foreach ($gateways as $gateway) {
$gatewayArray = $gateway->toArray();
unset($gatewayArray['ID']);
$gatewaysArray[] = $gatewayArray;
}
// Pass the content of a file
$response->setContent(json_encode($gatewaysArray));
return $response;
});
$app->get('/gateways/{eui}', function ($eui) use($app) {
$response = new Phalcon\Http\Response();