コード例 #1
0
 public static function scanForItemWonNotifications()
 {
     $query = 'SELECT au.*, aumb.max_bid FROM Auction AS au JOIN AuctionsMaxBid AS aumb ON aumb.auction_id = au.id
                   WHERE au.end_date < NOW() AND au.id NOT IN
                  (SELECT auction_id FROM Notification WHERE type = ?)';
     $results = Database::select($query, [NotificationType::itemWon()]);
     if (count($results)) {
         $auctions = Auction::arrayFromSQLRows($results);
         foreach ($auctions as $auction) {
             self::sendItemWonNotification($auction);
         }
     }
 }
コード例 #2
0
ファイル: ItemCategory.php プロジェクト: sampayne/COMP3013
 public static function categoriesForItem($item_id)
 {
     $results = Database::select('SELECT * FROM Category WHERE id IN (SELECT category_id FROM ItemCategory WHERE item_id = ?)', [$item_id]);
     return self::arrayFromSQLRows($results);
 }
コード例 #3
0
ファイル: Auction.php プロジェクト: sampayne/COMP3013
 public function getReserve()
 {
     if ($this->reserve_price < 0) {
         $result = Database::select('SELECT reserve_price FROM Auction WHERE id = ?', [$this->id]);
         $this->reserve_price = $result[0][0];
     }
     return $this->reserve_price;
 }
コード例 #4
0
ファイル: Notification.php プロジェクト: sampayne/COMP3013
 public static function forUser($user_id)
 {
     $results = Database::select('SELECT * FROM Notification WHERE user_id = ? AND cleared = 0', [$user_id]);
     return self::arrayFromSQLRows($results);
 }