コード例 #1
0
ファイル: logs.php プロジェクト: AnyApp/-Commercial-System
 public static function getInvestorAssetsLogs($investorID)
 {
     $assets = Assets::getInvestorAssets($investorID);
     $ans = [];
     foreach ($assets as $asset) {
         $logs = Logs::getAssetInvestLogs($asset['id']);
         $ans = array_merge($ans, $logs);
     }
     return $ans;
 }
コード例 #2
0
$this->respond(['GET', 'POST'], '/create', function ($request, $response, $service, $app) {
    $assetData = $request->param('assetData');
    // list of contacts ids
    $contactsData = $request->param('assetContacts');
    $investorsData = $request->param('assetInvestors');
    $id = Assets::createAssetInvest($assetData, $contactsData, $investorsData);
    if ($id > 0) {
        $response->json(Result::success('Asset Created.', ['id' => $id]));
    } else {
        $response->json(Result::error('Asset Creation Failed.'));
    }
});
$this->respond(['GET', 'POST'], '/get/[i:id]', function ($request, $response, $service, $app) {
    $id = $request->param('id');
    $assetData = Assets::getAsset($id);
    $assetLogs = Logs::getAssetInvestLogs($id);
    $assetContacts = Contacts::getAssetContacts($id);
    $assetInvestors = Investors::getAssetInvestors($id);
    $result = array("assetData" => $assetData, "assetLogs" => $assetLogs, "assetContacts" => $assetContacts, "assetInvestors" => $assetInvestors);
    if ($assetData) {
        $response->json(Result::success('', $result));
    } else {
        $response->json(Result::error('Asset not found'));
    }
});
$this->respond(['GET', 'POST'], '/edit/[:id]', function ($request, $response, $service, $app) {
    $id = $request->param('id');
    $assetData = $request->param('assetData');
    $contactsData = $request->param('assetContacts');
    $investorsData = $request->param('assetInvestors');
    $result = Assets::updateAssetInvest($id, $assetData, $contactsData, $investorsData);