コード例 #1
0
ファイル: ListingManager.php プロジェクト: Maxlander/shixi
 /**
  * @param int $userSID
  * @param int $productSID
  * @param int $contractID
  * @param int $listingNumber
  */
 public static function activateListingsAfterPaid($userSID, $productSID, $contractID, $listingNumber)
 {
     $limit = '';
     if ($listingNumber != null) {
         $limit = 'LIMIT 0,' . $listingNumber;
     }
     $serializedProductSID = SJB_ProductsManager::generateQueryBySID($productSID);
     $listingsSIDsToProceed = SJB_DB::query("SELECT `sid` FROM `listings` WHERE `checkouted` = 0 AND `complete` = 1 AND `contract_id` = 0 AND `user_sid` = ?n AND `product_info` REGEXP '({$serializedProductSID})' ORDER BY `sid` DESC {$limit}", $userSID);
     if (!empty($listingsSIDsToProceed)) {
         foreach ($listingsSIDsToProceed as $listingSIDToProceed) {
             SJB_DB::query('UPDATE `listings` SET `contract_id` = ?n, `checkouted` = 1 WHERE `sid` = ?n', $contractID, $listingSIDToProceed['sid']);
             self::activateListingBySID($listingSIDToProceed['sid']);
         }
         SJB_ProductsManager::incrementPostingsNumber($productSID, count($listingsSIDsToProceed));
         SJB_ContractSql::updatePostingsNumber($contractID, count($listingsSIDsToProceed));
     }
 }
コード例 #2
0
ファイル: shopping_cart.php プロジェクト: Maxlander/shixi
 /**
  * @param $userSID
  * @param $productSID
  * @param $limitCheckoutedListingsToDelete
  */
 public function deleteCheckoutedListingsByProduct($userSID, $productSID, $limitCheckoutedListingsToDelete)
 {
     $serializedProductSID = SJB_ProductsManager::generateQueryBySID($productSID);
     $listingsToDelete = SJB_DB::query("SELECT `sid` FROM `listings` WHERE `checkouted` = 0 AND `complete` = 1 AND `contract_id` = 0 AND `user_sid` = ?n AND `product_info` REGEXP '({$serializedProductSID})' ORDER BY `sid` DESC LIMIT ?n", $userSID, $limitCheckoutedListingsToDelete);
     $criteriaSaver = new SJB_ListingCriteriaSaver('MyListings');
     $foundListingsSIDs = $criteriaSaver->getObjectSIDs();
     foreach ($listingsToDelete as $listing) {
         SJB_ListingManager::deleteListingBySID($listing['sid']);
         if ($foundListingsSIDs != null) {
             $key = array_search($listing['sid'], $foundListingsSIDs);
             unset($foundListingsSIDs[$key]);
         }
     }
     if ($foundListingsSIDs != null) {
         $criteriaSaver->setSessionForObjectSIDs($foundListingsSIDs);
     }
 }
コード例 #3
0
ファイル: ListingDBManager.php プロジェクト: Maxlander/shixi
 public static function getNumberOfCheckoutedListingsByProductSID($productSID, $currentUserID)
 {
     $serializedProductSID = SJB_ProductsManager::generateQueryBySID($productSID);
     return SJB_DB::queryValue("SELECT COUNT(`sid`) FROM `listings` WHERE `checkouted` = 0 AND `complete` = 1 AND `contract_id` = 0 AND `user_sid` = ?n AND `product_info` REGEXP '({$serializedProductSID})'", $currentUserID);
 }