本文整理汇总了PHP中ConnectionFactory::SelectRowsAsClasses方法的典型用法代码示例。如果您正苦于以下问题:PHP ConnectionFactory::SelectRowsAsClasses方法的具体用法?PHP ConnectionFactory::SelectRowsAsClasses怎么用?PHP ConnectionFactory::SelectRowsAsClasses使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConnectionFactory
的用法示例。
在下文中一共展示了ConnectionFactory::SelectRowsAsClasses方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getBountiesCountForUser
public static function getBountiesCountForUser($userID)
{
/*$query = "SELECT * FROM bounties JOIN users ON (bounties.target_id = users.id) WHERE bounties.is_complete = 0 AND bounties.target_id != ? ORDER BY rand() LIMIT 15";*/
$query = "SELECT SUM( payment ) AS bounty\n\t\t\t\t\t\tFROM `bounties` \n\t\t\t\t\t\tJOIN users ON ( bounties.target_id = users.id ) \n\t\t\t\t\t\tWHERE bounties.is_complete =0\n\t\t\t\t\t\tAND bounties.target_id !=?\n\t\t\t\t\t\tAND target_id NOT IN (SELECT bounties.target_id FROM bounties WHERE bounties.requester_id = {$userID})\n\t\t\t\t\t\tGROUP BY `target_id` \n\t\t\t\t\t\tLIMIT 15";
$objBounties = ConnectionFactory::SelectRowsAsClasses($query, array($userID), __CLASS__);
return $objBounties;
}
示例2: getUserComments
public static function getUserComments($userID)
{
$query = "Select * FROM comments Where comments.receiver_id = ? AND comments.type=1 ORDER BY comments.id DESC LIMIT 0,10";
$values = array($userID);
$comments = ConnectionFactory::SelectRowsAsClasses($query, $values, __CLASS__);
return $comments;
}
示例3: getAllCities
public static function getAllCities()
{
$objCities = Lvl6MemCache::getCache('allCities');
if ($objCities) {
return $objCities;
}
$objCities = ConnectionFactory::SelectRowsAsClasses("SELECT * FROM cities", array(), __CLASS__);
Lvl6MemCache::addCache('allCities', $objCities);
return $objCities;
}
示例4: getItemIDsToItemsVisibleInShop
public static function getItemIDsToItemsVisibleInShop($playerLevel)
{
$query = "SELECT * FROM items WHERE min_level <= ? ORDER BY min_level";
$objItems = ConnectionFactory::SelectRowsAsClasses($query, array($playerLevel + 1), __CLASS__);
$toreturn = array();
foreach ($objItems as $objItem) {
$itemID = $objItem->getID();
$toreturn[$itemID] = $objItem;
}
return $toreturn;
}
示例5: getRealEstateIDsToRealEstatesVisibleInShop
public static function getRealEstateIDsToRealEstatesVisibleInShop($playerLevel)
{
$query = "SELECT * FROM realestate WHERE min_level <= ? ORDER BY min_level";
$objREs = ConnectionFactory::SelectRowsAsClasses($query, array($playerLevel + 1), __CLASS__);
$toreturn = array();
foreach ($objREs as $objRE) {
$reID = $objRE->getID();
$toreturn[$reID] = $objRE;
}
return $toreturn;
}
示例6: getUnlockMissionsInCity
public static function getUnlockMissionsInCity($playerLevel, $cityID)
{
$objMissions = Lvl6MemCache::getCache('unlockMissionsInCity' . $playerLevel . $cityID);
if ($objMissions) {
return $objMissions;
}
$query = "SELECT * FROM missions WHERE missions.min_level =\n (SELECT missions.min_level FROM missions WHERE missions.min_level > ? AND missions.city_id = ? LIMIT 0,1)";
//$query = "SELECT * FROM missions WHERE min_level > ? AND city_id = ? ORDER BY min_level LIMIT 2";
$objMissions = ConnectionFactory::SelectRowsAsClasses($query, array($playerLevel, $cityID), __CLASS__);
Lvl6MemCache::addCache('unlockMissionsInCity' . $playerLevel . $cityID, $objMissions);
return $objMissions;
}
示例7: get_locked_items_visible_in_shop
/**
* this function will display the next two locked items
* TODO: make it configurable bu assigning constant instead of two
* @return the locked items as classes
*/
public static function get_locked_items_visible_in_shop($playerLevel, $item_type)
{
$toreturn = Lvl6MemCache::getCache('locked_items_visible_in_shop' . $playerLevel . $item_type);
if ($toreturn) {
return $toreturn;
}
$query = "SELECT * FROM items WHERE items.min_level = (SELECT items.min_level as next_level FROM items WHERE items.min_level > ? and items.type = ? LIMIT 0,1)";
//$query = "SELECT * FROM items WHERE min_level > ? AND type = ? ORDER BY min_level ASC LIMIT 0,1";
$objItems = ConnectionFactory::SelectRowsAsClasses($query, array($playerLevel, $item_type), __CLASS__);
$toreturn = array();
foreach ($objItems as $objItem) {
$itemID = $objItem->getID();
$toreturn[$itemID] = $objItem;
}
Lvl6MemCache::addCache('locked_items_visible_in_shop' . $playerLevel . $item_type, $toreturn);
return $toreturn;
}
示例8: getPotentialOpponents
public function getPotentialOpponents()
{
$userID = $this->id;
$level = $this->level;
$agencySize = $this->agency_size;
// get up to 10 people to list on the attack list
$attackListSize = 10;
$maxAgencySize = $agencySize + 5;
$minAgencySize = max(array(1, $agencySize - 5));
// temporary solution for level range
$minLevel = $level - 5;
$maxLevel = $level + 5;
$query = "SELECT * FROM users WHERE level <= ? AND level >= ? AND agency_size <= ? AND agency_size >= ? AND id != ?";
$objAllPotOpps = ConnectionFactory::SelectRowsAsClasses($query, array($maxLevel, $minLevel, $maxAgencySize, $minAgencySize, $userID), __CLASS__);
if (!$objAllPotOpps || count($objAllPotOpps) < $attackListSize) {
// TODO: execute further queries with higher level or agency size ranges if too few users
//the next lines is temp solution if there is 1<x<attacklistsize opponents
if ($objAllPotOpps) {
return $objAllPotOpps;
} else {
return array();
}
}
// get random indices
$randomIntegers = getRandomIntegers($attackListSize, count($objAllPotOpps));
$opponents = array();
foreach ($randomIntegers as $key => $value) {
array_push($opponents, $objAllPotOpps[$key]);
}
return $opponents;
}
示例9: allMissionsInCityReadyForNextLevel
private function allMissionsInCityReadyForNextLevel($nextLevel, $cityID, $userID)
{
$cityMissions = Mission::getMissionsInCity($cityID);
$numCityMissions = count($cityMissions);
$query = "SELECT * from users_missions WHERE user_id=? AND curr_rank=? AND (";
$missionConditions = array();
$values = array();
array_push($values, $userID);
array_push($values, $nextLevel);
foreach ($cityMissions as $mission) {
array_push($missionConditions, "mission_id=?");
$missionID = $mission->getID();
array_push($values, $missionID);
}
$query .= getArrayInString($missionConditions, ' OR ') . ")";
$usersMissionsReadyInCity = ConnectionFactory::SelectRowsAsClasses($query, $values, __CLASS__);
return count($usersMissionsReadyInCity) >= $numCityMissions;
}
示例10: getdeviceTokenAndSendMessage
function getdeviceTokenAndSendMessage($udid, $message)
{
echo "UDID = " . $udid;
$query = "select apns_devices.pid, apns_devices.devicetoken from apns_devices WHERE apns_devices.deviceuid = '" . $udid . "'";
$devices = ConnectionFactory::SelectRowsAsClasses($query, array(), __CLASS__);
print_r($device);
die;
//$inactiveUsers = User::lastTwoDayInactive();
foreach ($devices as $device) {
echo "DEVICE TOKEN = " . $device->devicetoken;
sendMessageToDevice($device->devicetoken, $message);
}
}
示例11: getSoldierCode
public static function getSoldierCode()
{
$soldierCode = ConnectionFactory::SelectRowsAsClasses("SELECT code FROM soldier_code LIMIT 0,1", array(), __CLASS__);
return $soldierCode;
}
示例12: getMissionsInCityGivenPlayerLevel
public static function getMissionsInCityGivenPlayerLevel($playerLevel, $cityID)
{
$query = "SELECT * FROM missions WHERE min_level <= ? AND city_id = ? ORDER BY min_level";
$objMissions = ConnectionFactory::SelectRowsAsClasses($query, array($playerLevel, $cityID), __CLASS__);
return $objMissions;
}
示例13: getBountiesForUser
public static function getBountiesForUser($userID)
{
$query = "SELECT * FROM bounties JOIN users ON (bounties.target_id = users.id) WHERE bounties.is_complete = 0 AND bounties.target_id != ?";
$objBounties = ConnectionFactory::SelectRowsAsClasses($query, array($userID), __CLASS__);
return $objBounties;
}
示例14: updateHealthOfflineTimerSpecialUsers
public static function updateHealthOfflineTimerSpecialUsers($interval)
{
$query = "SELECT users.id, users.udid, users.c2dm_token, users.device_os FROM users JOIN user_timers ON (users.id = user_timers.user_id) WHERE FLOOR(TIMESTAMPDIFF(MINUTE, health_timer, NOW())/" . $interval . ")> (users.health_max-users.health) AND (users.health_max-users.health)>0";
$fullHealth = ConnectionFactory::SelectRowsAsClasses($query, array(), __CLASS__);
$query = "update users, user_timers set user_timers.health_timer = NOW(), users.health =\n IF (users.health + FLOOR(TIMESTAMPDIFF(MINUTE, user_timers.health_timer, NOW())/" . $interval . ") < users.health_max,\n users.health + FLOOR(TIMESTAMPDIFF(MINUTE, user_timers.health_timer, NOW())/" . $interval . "),\n users.health_max)\n WHERE users.id = user_timers.user_id AND TIMESTAMPDIFF(HOUR, user_timers.health_timer, NOW()) > 1 AND users.type = 3";
if (ConnectionFactory::getAssociativeArray($query)) {
return $fullHealth;
}
}
示例15: getUserUpkeepRealEstate
public static function getUserUpkeepRealEstate($userID)
{
$query = "Select realestate.id, realestate.price, users_realestates.quantity, realestate.upkeep From realestate, users_realestates\n where users_realestates.user_id = :userID and users_realestates.realestate_id = realestate.id\n AND realestate.upkeep > 0\n order by realestate.upkeep desc";
$objItem = ConnectionFactory::SelectRowsAsClasses($query, array("userID" => $userID), __CLASS__);
return $objItem;
}