Beispiel #1
0
    $seller = $data['seller'];
    $tokers = explode("-", $seller);
    $seller = $tokers[1];
    $enteredBy = $data['enteredBy'];
    $tokers = explode("-", $enteredBy);
    $enteredBy = $tokers[1];
    $description = $data['description'];
    $categoryId = $data['category'];
    $amount = $data['amount'];
    $dateAdded = $data['dateAdded'];
    $trade = new TradeModel();
    $trade->setDateAdded($dateAdded);
    $trade->setDescription($description);
    $trade->setAmount($amount);
    $trade->setCategoryId($categoryId);
    $trade->setSellerUid($seller);
    $trade->setBuyerUid($buyer);
    $trade->setEnteredByUid($enteredBy);
    //die(print_r($trade));
    $cra = new CesRestAPI();
    print $cra->insertTradeSQL($trade);
})->setName('trades put');
//Recommend all
$app->get('/recommend/all', function () {
    $cra = new CesRestAPI();
    print $cra->getAllRecommendsJSON();
})->setName('recommend all');
//Recommends by user
$app->get('/recommend/:uid', function ($uid) {
    $cra = new CesRestAPI();
    print $cra->getRecommendsByUserJSON($uid);