本文整理汇总了PHP中BxDolDb::getRow方法的典型用法代码示例。如果您正苦于以下问题:PHP BxDolDb::getRow方法的具体用法?PHP BxDolDb::getRow怎么用?PHP BxDolDb::getRow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BxDolDb
的用法示例。
在下文中一共展示了BxDolDb::getRow方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getProfileInfo
function _checkProfileMatch($iProfileId, $sAction)
{
$aProfile = getProfileInfo($iProfileId);
if ($aProfile['Status'] == 'Active' && ($aProfile['UpdateMatch'] || $sAction == 'join')) {
$oDb = new BxDolDb();
// clear field "UpdateMatch"
$oDb->query("UPDATE `Profiles` SET `UpdateMatch` = 0 WHERE `ID`= {$iProfileId}");
// clear cache
$oDb->query("DELETE FROM `sys_profiles_match`");
// get send mails
$aSendMails = $oDb->getRow("SELECT `profiles_match` FROM `sys_profiles_match_mails` WHERE `profile_id` = {$iProfileId}");
$aSend = !empty($aSendMails) ? unserialize($aSendMails['profiles_match']) : array();
$aProfiles = getMatchProfiles($iProfileId);
foreach ($aProfiles as $iProfId) {
if (!isset($aSend[(int) $iProfId])) {
$oEmailTemplate = new BxDolEmailTemplates();
$aMessage = $oEmailTemplate->parseTemplate('t_CupidMail', array('StrID' => $iProfId, 'MatchProfileLink' => getProfileLink($iProfileId)), $iProfId);
$aProfile = getProfileInfo($iProfId);
if (!empty($aProfile) && $aProfile['Status'] == 'Active') {
$oDb->query("INSERT INTO `sys_sbs_queue`(`email`, `subject`, `body`) VALUES('" . $aProfile['Email'] . "', '" . process_db_input($aMessage['subject'], BX_TAGS_NO_ACTION, BX_SLASHES_NO_ACTION) . "', '" . process_db_input($aMessage['body'], BX_TAGS_NO_ACTION, BX_SLASHES_NO_ACTION) . "')");
}
$aSend[(int) $iProfId] = 0;
}
}
if (empty($aSendMails)) {
$oDb->query("INSERT INTO `sys_profiles_match_mails`(`profile_id`, `profiles_match`) VALUES({$iProfileId}, '" . serialize($aSend) . "')");
} else {
$oDb->query("UPDATE `sys_profiles_match_mails` SET `profiles_match` = '" . serialize($aSend) . "' WHERE `profile_id` = {$iProfileId}");
}
}
}
示例2: getMatchProfiles
function getMatchProfiles($iProfileId, $bForce = false, $sSort = 'none')
{
$aResult = array();
if (!getParam('enable_match')) {
return $aResult;
}
$oDb = new BxDolDb();
if (!(int) $iProfileId) {
return $aResult;
}
if (!$bForce) {
$aMatch = $oDb->getRow("SELECT `profiles_match` FROM `sys_profiles_match` WHERE `profile_id` = {$iProfileId} AND `sort` = '{$sSort}'");
if (!empty($aMatch)) {
return unserialize($aMatch['profiles_match']);
}
} else {
$oDb->query("DELETE FROM `sys_profiles_match` WHERE `profile_id` = {$iProfileId}");
}
$aProf = getProfileInfo($iProfileId);
if (empty($aProf)) {
return $aResult;
}
$aMathFields = getMatchFields();
$iAge = (int) $oDb->getOne("SELECT DATE_FORMAT(FROM_DAYS(DATEDIFF(NOW(), '{$aProf['DateOfBirth']}')), '%Y') + 0 AS age");
foreach ($aMathFields as $sKey => $aFields) {
$aMathFields[$sKey]['profiles'] = array();
if ($aProf[$aFields['Name']]) {
if ($aMathFields[$aFields['MatchField']]['Name'] == 'DateOfBirth') {
if ($iAge) {
$sCond = "(DATE_FORMAT(FROM_DAYS(DATEDIFF(NOW(), `DateOfBirth`)), '%Y') + 0) = {$iAge}";
}
} else {
if ($aMathFields[$aFields['MatchField']]['Name']) {
$sCond = "`{$aMathFields[$aFields['MatchField']]['Name']}` = '" . process_db_input($aProf[$aFields['Name']], BX_TAGS_NO_ACTION, BX_SLASHES_NO_ACTION) . "'";
$aMathFields[$sKey]['profiles'] = $oDb->getAllWithKey("SELECT `ID` FROM `Profiles` WHERE `Status` = 'Active' AND `ID` != {$iProfileId} AND {$sCond}", 'ID');
}
}
}
}
$sCondSort = '';
if ($sSort == 'activity') {
$sCondSort = 'ORDER BY `DateLastNav` DESC';
} else {
if ($sSort == 'date_reg') {
$sCondSort = 'ORDER BY `DateReg` DESC';
}
}
$iPercentThreshold = getParam('match_percent');
$aProfiles = $oDb->getColumn("SELECT `ID` FROM `Profiles` WHERE `Status` = 'Active' AND `ID` != {$iProfileId} {$sCondSort}");
foreach ($aProfiles as $iProfId) {
$iPercent = 0;
foreach ($aMathFields as $sKey => $aFields) {
if (isset($aFields['profiles'][$iProfId])) {
$iPercent += (int) $aFields['MatchPercent'];
}
}
if ($iPercent >= $iPercentThreshold) {
$aResult[] = $iProfId;
}
}
$oDb->query("INSERT INTO `sys_profiles_match`(`profile_id`, `sort`, `profiles_match`) VALUES({$iProfileId}, '{$sSort}', '" . serialize($aResult) . "')");
return $aResult;
}