本文整理汇总了PHP中Assets::getAllAssets方法的典型用法代码示例。如果您正苦于以下问题:PHP Assets::getAllAssets方法的具体用法?PHP Assets::getAllAssets怎么用?PHP Assets::getAllAssets使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Assets
的用法示例。
在下文中一共展示了Assets::getAllAssets方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: function
}
});
$this->respond(['GET', 'POST'], '/get/[i:id]', function ($request, $response, $service, $app) {
$id = $request->param('id');
$assetData = Assets::getAsset($id);
$assetInvestors = Investors::getAssetInvestors($id);
$result = array("assetData" => $assetData, "assetInvestors" => $assetInvestors);
if ($assetData) {
$response->json(Result::success('', $result));
} else {
$response->json(Result::error('Asset not found'));
}
});
$this->respond(['GET', 'POST'], '/get-for-edit/[i:id]', function ($request, $response, $service, $app) {
$id = $request->param('id');
$assetData = Assets::getAsset($id);
$assetContacts = Contacts::getAssetContacts($id);
$assetInvestors = Investors::getAssetInvestors($id);
$assetAreas = RentAreas::getAssetRentAreas($id);
$assetProcesses = RentProcesses::getAssetRentProcesses($id);
$result = array("assetData" => $assetData, "assetContacts" => $assetContacts, "assetInvestors" => $assetInvestors, "assetAreas" => $assetAreas, "assetProcesses" => $assetProcesses);
if ($assetData) {
$response->json(Result::success('', $result));
} else {
$response->json(Result::error('Asset not found'));
}
});
$this->respond(['GET', 'POST'], '/get/all', function ($request, $response, $service, $app) {
$result = Assets::getAllAssets();
$response->json(Result::success('', $result));
});
示例2: getMarketingListLogs
public static function getMarketingListLogs()
{
$ans = [];
$assets = Assets::getAllAssets();
foreach ($assets as $asset) {
$assetLogs = Logs::getAssetInvestLogs($asset['id']);
$hasAliveLogs = false;
foreach ($assetLogs as $assetLog) {
if ($assetLog['status'] == 'alive') {
$hasAliveLogs = true;
break;
}
}
// check if too old
$oldestLogDate = date_create(self::getOldestLogDate($assetLogs));
$months = 3;
$minDate = date_sub(date_create(date('Y-m-d')), date_interval_create_from_date_string($months . ' month'));
$tooOld = false;
if (date_timestamp_get($oldestLogDate) < date_timestamp_get($minDate)) {
$tooOld = true;
}
if (!$tooOld && $hasAliveLogs && $asset['isForSale'] == 1) {
if (count($assetLogs) == 1) {
$asset['display'] = self::getLogTitle($assetLogs[0]);
} else {
$asset['display'] = $asset['name'];
}
array_push($ans, $asset);
}
}
usort($ans, function ($a1, $a2) {
$assetLogs1 = Logs::getAssetInvestLogs($a1['id']);
$assetLogs2 = Logs::getAssetInvestLogs($a2['id']);
$v1 = strtotime(self::getNewestLogDate($assetLogs1));
$v2 = strtotime(self::getNewestLogDate($assetLogs2));
return $v1 - $v2;
// $v2 - $v1 to reverse direction
});
return $ans;
}