本文整理汇总了PHP中memBuff::getSql方法的典型用法代码示例。如果您正苦于以下问题:PHP memBuff::getSql方法的具体用法?PHP memBuff::getSql怎么用?PHP memBuff::getSql使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类memBuff
的用法示例。
在下文中一共展示了memBuff::getSql方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getListByUids
/**
* Выбрать ТУ для списка пользователей
* по указанному количеству на каждого
*
* @param type $uids
* @param type $limit
* @param type $expire
* @param type $group
* @return type
*/
public function getListByUids($uids, $limit = 3, $expire = 0, $group = false)
{
$sql = $this->db()->parse("\n SELECT \n DISTINCT ON (q.id) \n q.*,\n f.fname AS file\n FROM (\n SELECT \n s.id AS id, \n s.user_id,\n s.title AS title, \n s.price AS price,\n s.videos AS videos,\n s.total_feedbacks AS total_feedbacks,\n row_number() OVER(PARTITION BY s.user_id ORDER BY s.id DESC) AS rownum\n FROM {$this->TABLE} AS s \n LEFT JOIN {$this->TABLE_DEBT} AS od ON od.user_id = s.user_id \n LEFT JOIN {$this->TABLE_BLOCKED} AS sb ON sb.src_id = s.id \n WHERE \n s.user_id IN(?l) \n AND s.deleted = FALSE \n AND s.active = TRUE \n AND sb.src_id IS NULL\n AND (od.id IS NULL OR od.date >= NOW())\n ) AS q\n LEFT JOIN {$this->TABLE_FILES} AS f ON f.src_id = q.id AND f.small = 4\n WHERE q.rownum <= ?i\n ORDER BY q.id DESC, f.preview DESC, f.id \n ", $uids, $limit);
$memBuff = new memBuff();
$result = $memBuff->getSql($error, $sql, $expire, true, $group);
return $result;
}
示例2: GetLastNews
/**
* Взять последнюю новость
*
* @return array Новость
*/
function GetLastNews()
{
$sql = "SELECT post_date, header FROM news ORDER BY post_date DESC, id DESC LIMIT 1";
$memBuff = new memBuff();
$headers = $memBuff->getSql($error, $sql, 1800);
if ($error) {
$error = parse_db_error($error);
} else {
$ret = $headers[0];
}
return $ret;
}
示例3: getProjectsCount
/**
* Подсчитывает и возвращает количество проектов по закладкам для постранички в ленте,
* записыавет в memcache на 30 минут.
* Если $uid != null также на последних страницах проверяется количество
* забаненных проектов пользователя и суммируется с общим.
*
* @param integer $kind Тип проектов (-1=5=Все проекты; 2=Конкурсы; 4=В офис; 6=Только для про)
* @param integer $page Номер текущей страницы
* @param integer $uid ИД работодателя, если есть.
* @return integer
*/
function getProjectsCount($kind = 0, $page = 1, $uid = null, $is_moder = null)
{
//$_uid = intval($uid);
$_where = '';
//$_where = !$is_moder?" AND (p.status = ".self::STATE_PUBLIC." OR e.uid = {$_uid})":'';
//$_where = !$is_moder?"AND NOT(p.payed = 0 AND p.kind = ".self::KIND_VACANCY." AND p.state = ".self::STATE_MOVED_TO_VACANCY.")":'';
$sql = "SELECT\n SUM(pro_only::int) as pro_only,\n SUM((kind = 1)::int) as prj_fl,\n SUM((kind IN (2,7))::int) as prj_kon,\n SUM((kind = 4)::int) as prj_off\n FROM projects p\n LEFT JOIN projects_blocked pb ON pb.project_id = p.id\n INNER JOIN employer e ON e.uid = p.user_id AND e.is_banned = '0'\n WHERE \n " . (get_uid(false) ? '' : 'COALESCE(p.hide, false) = false AND ') . "p.closed = false AND pb.project_id IS NULL AND p.kind <> 9 {$_where}";
$memBuff = new memBuff();
$a_num_prjs = $memBuff->getSql($error, $sql, 1800);
if (!$a_num_prjs) {
return 0;
}
$res = $a_num_prjs[0];
$cnt = 0;
switch ($kind) {
case 6:
//только про
$cnt = $res['pro_only'];
$where_kind = ' AND pro_only = true AND kind <> 9';
break;
case 1:
//фриланс
$cnt = $res['prj_fl'];
$where_kind = ' AND kind = 1 ';
break;
case 2:
//конкурсы
$cnt = $res['prj_kon'];
$where_kind = ' AND kind IN (2,7) ';
break;
case 4:
//офис
$cnt = $res['prj_off'];
$where_kind = ' AND kind = 4 ';
break;
default:
//все
$cnt = $res['prj_fl'] + $res['prj_kon'] + $res['prj_off'];
$where_kind = ' AND kind <> 9';
}
//нужно уточнить счетчик на последних страницах, и добавить
//к общему кол-во забаненных проектов работодателя
if ($uid && $page + 10 >= ceil($cnt / projects::PAGE_SIZE)) {
$sql = "SELECT COUNT(*) as cnt FROM projects_blocked pb\n INNER JOIN projects p ON p.id = pb.project_id\n WHERE p.user_id = {$uid} {$where_kind}";
$res_cnt = $memBuff->getSql($error, $sql, 300);
if ($res_cnt) {
$ban = $res_cnt[0];
$cnt += (int) $ban['cnt'];
}
}
return $cnt;
}
示例4: GetBannedStat
/**
* Статистика по забаненым пользователям.
*
* @return array статистика
*/
public function GetBannedStat()
{
$sql = "SELECT COUNT(*) AS cnt FROM users WHERE is_banned = B'1' AND ban_where = 0";
$memBuff = new memBuff();
$row = $memBuff->getSql($error, $sql, 180);
$site = $row[0]['cnt'];
$sql = 'SELECT COUNT(*) AS cnt FROM users WHERE ban_where = 1';
$memBuff = new memBuff();
$row = $memBuff->getSql($error, $sql, 180);
$blogs = $row[0]['cnt'];
$sql = "SELECT COUNT(*) AS cnt FROM users WHERE warn > 0 AND is_banned = B'0' AND ban_where = 0";
$memBuff = new memBuff();
$row = $memBuff->getSql($error, $sql, 180);
$warns = $row[0]['cnt'];
return array('all' => $site + $blogs + $warns, 'site' => $site, 'blogs' => $blogs, 'warns' => $warns);
}
示例5: GetAll
/**
* Получает обменные курсы
*
* @param boolean $cache получить из базы или из кэша
* @return array массив курсов валют
*/
function GetAll($cache = true)
{
$sql = "SELECT * FROM project_exrates";
if ($cache) {
$memBuff = new memBuff();
$ret = $memBuff->getSql($error, $sql, 600);
} else {
global $DB;
$res = $DB->squery($sql);
$ret = pg_fetch_all($res);
}
if ($ret) {
foreach ($ret as $ikey => $val) {
$out[$val['id']] = $val['val'];
}
}
return $out;
}
示例6: setTypeByPage
/**
* Выборка записи из таблицы ban_promo_types по типу страницы
* setTypeByPage.
*
* @param type $target
*/
public function setTypeByPage($target = '0|0')
{
global $DB;
$sql = "SELECT * FROM ban_promo_types\n WHERE now()::date BETWEEN from_date AND to_date AND deleted = 'f'\n AND (is_pro & B'{$this->is_pro}' = '{$this->is_pro}') AND (is_role & B'{$this->is_role}' = '{$this->is_role}')\n ORDER BY (page_target = ?) DESC, is_activity DESC, advertising DESC, from_date ASC \n LIMIT 1\n ";
$query = $DB->parse($sql, $target);
$memBuff = new memBuff();
$result = $memBuff->getSql($error, $query, 600, true, 'banner_promo');
if ($result) {
$this->info = $result[0];
if (strpos($this->info['name_img'], '/users') === 0) {
$this->info['name_img'] = WDCPREFIX . $this->info['name_img'];
} else {
$this->info['name_img'] = $this->info['name_img'];
}
$this->type_banner = $this->info['id'];
}
return $this->type_banner;
}
示例7: NumsBlockedCommunes
/**
* Возвращает кол-во заблокированных проектов
*
* @return integer
*/
function NumsBlockedCommunes()
{
$sql = "SELECT COUNT(*) AS cnt FROM commune_blocked JOIN commune ON commune.id = commune_blocked.commune_id";
$memBuff = new memBuff();
$row = $memBuff->getSql($error, $sql, 180);
return (int) $row[0]['cnt'];
}
示例8: getHHCurrency
/**
* Возвращает информацию по заданной HH-валюте
*
* @param string $code код валюты (USD, UAH и т.д.).
* @return array
*/
function getHHCurrency($code)
{
global $DB;
$sql = "SELECT * FROM hh_currency WHERE code ILIKE '{$code}'";
$memBuff = new memBuff();
if ($rows = $memBuff->getSql($error, $sql, self::MEM_LIFE)) {
$ret = $rows[0];
}
return $ret;
}
示例9: GetCatalogPositionsTable
/**
* Возвращает имя актуальной таблицы с позициями фрилансеров
* в общем каталоге
*
* @param boolean $clear_cache Удалить или нет запись из кеша
* @return string Имя актуальной таблицы
*/
function GetCatalogPositionsTable($clear_cache = false)
{
$memBuff = new memBuff();
$sql = "SELECT value FROM settings WHERE module = 'professions' AND variable = 'pos_table' LIMIT 1";
if ($clear_cache) {
$memBuff->delete(md5($sql));
}
if (!($pos_table = $memBuff->getSql($error, $sql, 3600))) {
return NULL;
}
$pos_table = $pos_table[0]['value'];
return $pos_table;
}
示例10: getAllOpCodes
/**
* Загрузить весь список опкодов.
*
* @return bool
*/
public static function getAllOpCodes($refresh = false)
{
if (!empty(self::$_cache_data) && !$refresh) {
return self::$_cache_data;
}
$error = null;
$memBuff = new memBuff();
$data = $memBuff->getSql($error, '
SELECT * FROM ' . get_class($this) . '
', self::OP_CODES_MEMCACHE_LIFE, true, self::OP_CODES_MEMCACHE_TAG);
if ($data && !$error) {
foreach ($data as $el) {
self::$_cache_data[$el['id']] = $el;
}
return self::$_cache_data;
}
return false;
}
示例11: getReqvFields
/**
* Возвращает реквизиты физ. и юр. лица
*
* @return array
*/
function getReqvFields()
{
if (!sbr_meta::$reqv_fields) {
$memBuff = new memBuff();
$mlife = 1800;
$rows = $memBuff->getSql($err, 'SELECT * FROM sbr_reqv_fields ORDER BY pos, name ', $mlife);
$ro = $memBuff->getSql($err, 'SELECT * FROM reqv_ordered LIMIT 1', $mlife);
$bp = $memBuff->getSql($err, 'SELECT * FROM bank_payments LIMIT 1', $mlife);
$fre = '/^_(\\d)_(.*)$/';
// $1:тип лица (физ. или юр.), $2:имя поля
if ($rows) {
foreach ($rows as $row) {
if (!preg_match($fre, $row['idname'], $m)) {
continue;
}
$ft = $m[1];
$nm = $m[2];
$row['bill_bound'] = $ft == sbr::FT_JURI && @array_key_exists($nm, $ro[0]) || $ft == sbr::FT_PHYS && @array_key_exists($nm, $bp[0]);
//Переводим битарный тип в массив форм резиденства
//которые поддреживает данное поле
$rez_type_new = $row['rez_type_new'];
$row['rez_type_new'] = array();
if (bindec($rez_type_new) > 0) {
for ($idx = 0; $idx < strlen($rez_type_new); $idx++) {
if (substr($rez_type_new, $idx, 1) == 1) {
$row['rez_type_new'][] = $idx + 1;
//сопостовление sbr::RT_ ...
}
}
}
sbr_meta::$reqv_fields[$ft][$nm] = $row;
}
}
}
return sbr_meta::$reqv_fields;
}
示例12: Calculate
//.........这里部分代码省略.........
$profs[] = $v[1];
}
}
}
}
// если указаны только группы разделов
if ($op) {
$res = $DB->query('SELECT prof_group, id, main_prof FROM professions LEFT JOIN mirrored_professions ON mirror_prof = id WHERE prof_group IN (?l)', $op);
$tmp = array();
while ($row = pg_fetch_assoc($res)) {
$profsgr[] = $row['id'];
$tmp[$row['prof_group']] = 1;
if ($row['main_prof']) {
$profsgr[] = $row['main_prof'];
}
}
$op = array_keys($tmp);
}
$in_ids = implode(array_unique(array_merge($profs, $profsgr)), ',');
//@todo: здесь лучше бы избавится от подзапроса, но походу никак
//JOIN не быстрее да и другие результаты выдает
$whc = " AND (u.spec_orig IN ({$in_ids})\n OR (u.is_pro = TRUE AND EXISTS(\n SELECT 1 FROM\n spec_add_choise\n WHERE user_id = u.uid AND prof_id IN ({$in_ids})\n\t\t\t)))";
} else {
$whc = " AND u.spec_orig IS NOT NULL AND u.spec_orig > 0";
}
//----------------------------------------------------------------------
// если указано меторасположение, то оно обробатывается своими запросами
if (($cw || $ow) && !$commit && $this->isCalcMethond('locations')) {
$locations = array();
$haveTheir = array();
// страны без городов
if ($ow) {
$sql = "SELECT country, is_pro, COUNT(*) AS cnt FROM freelancer u {$jn} WHERE is_banned = '0' {$whc}{$wh} AND (" . substr($ow, 4) . ") GROUP BY country, is_pro";
if (!($rows = $memBuff->getSql($error, $sql, 600, false, $memBuffGroup))) {
$rows = array();
}
foreach ($rows as $row) {
$c = "{$row['country']}:0";
if (empty($locations[$c])) {
$locations[$c] = array('country' => $row['country'], 'city' => 0, 'cost' => 0, 'cost' => 0, 'pro' => array('cost' => 0, 'count' => 0));
}
$locations[$c]['count'] += $row['cnt'];
if ($row['is_pro'] == 't') {
$locations[$c]['cost'] += $row['cnt'] * $cost['pro'];
$locations[$c]['pro']['count'] += $row['cnt'];
$locations[$c]['pro']['cost'] += $row['cnt'] * $cost['pro'];
} else {
$locations[$c]['cost'] += $row['cnt'] * $cost['no_pro'];
}
$haveTheir[$row['country']] = TRUE;
}
}
// страны с городами
if ($cw) {
$sql = "SELECT country, city, is_pro, COUNT(*) AS cnt FROM freelancer u {$jn} WHERE is_banned = '0' {$whc}{$wh} AND (" . substr($cw, 4) . ") GROUP BY country, city, is_pro";
if (!($rows = $memBuff->getSql($error, $sql, 600, false, $memBuffGroup))) {
$rows = array();
}
foreach ($rows as $row) {
$c = "{$row['country']}:{$row['city']}";
if (empty($locations[$c])) {
$locations[$c] = array('country' => $row['country'], 'city' => $row['city'], 'cost' => 0, 'cost' => 0, 'pro' => array('cost' => 0, 'count' => 0));
}
if (!empty($haveTheir[$row['country']])) {
$locations[$c]['no'] = 1;
}
示例13: getRankCount
/**
* Считаем количество фрилансеров различных разрядов СБР
*
* @return array Данные подсчета
*/
function getRankCount($prof_id = 0)
{
$memBuff = new memBuff();
if ($prof_id) {
$or_prof = professions::GetProfessionOrigin($prof_id);
$tbl_s = "\n ( SELECT * FROM fu WHERE spec_orig = '{$or_prof}' UNION ALL\n SELECT fu.* FROM fu INNER JOIN spec_add_choise sp ON sp.user_id = fu.uid AND sp.prof_id = '{$or_prof}' WHERE fu.is_pro = true\n UNION ALL\n SELECT fu.* FROM fu INNER JOIN spec_paid_choise spc ON spc.user_id = fu.uid AND spc.prof_id = '{$or_prof}' AND spc.paid_to > now()\n ) as s\n ";
} else {
$tbl_s = "fu s";
$join_pc = "\n INNER JOIN\n portf_choise pc\n ON pc.prof_id = s.spec_orig\n AND pc.user_id = s.uid\n ";
}
$sql = "\n SELECT SUM((r.rank=3)::int) as rank3, SUM((r.rank=2)::int) as rank2, SUM((r.rank=1)::int) as rank1\n FROM rating r\n INNER JOIN\n {$tbl_s}\n ON s.uid = r.user_id\n AND s.is_banned = '0'\n {$join_pc}\n WHERE r.rank > 0\n ";
$rank = $memBuff->getSql($error, $sql, 3600);
if ($error || !$rank) {
return NULL;
}
return $rank[0];
}
示例14: getDocsFlow
//.........这里部分代码省略.........
// документы, после загрузки которых выводим работодателя в док-те.
$frl_upload_docs_cond = sbr::DOCS_TYPE_ACT;
if ($scheme) {
if ($scheme != -1) {
$where[] = "ss.arch_closed_time > NOW()::date - interval '6 months'";
$scheme_cond = "AND s.scheme_type = {$scheme}";
if ($scheme == sbr::SCHEME_PDRD || $scheme == sbr::SCHEME_PDRD2) {
$scheme_cond = "AND ( s.scheme_type = {$scheme} OR s.scheme_type = " . sbr::SCHEME_PDRD2 . ')';
}
}
$docs_cond = 'AND su.docs_received = false AND su.is_removed = false';
} else {
if ($filter['archive'] == 't') {
$where[] = "ss.arch_closed_time < NOW()::date - interval '6 months'";
}
if ($filter['archive'] == 'f') {
$where[] = "ss.arch_closed_time >= NOW()::date - interval '6 months'";
}
}
if ($fv = pg_escape_string(trim($filter['contract_num']))) {
$where[] = "'СБР-'||ss.sbr_id||'-'||ss.num ILIKE '%{$fv}%'";
}
if ($fv = pg_escape_string(trim($filter['user']))) {
$where[] = "(u.login ILIKE '%{$fv}%' OR u.uname ILIKE '%{$fv}%' OR u.usurname ILIKE '%{$fv}%')";
}
if ($fv = pg_escape_string(trim($filter['name']))) {
$where[] = "ss.name ILIKE '%{$fv}%'";
}
if ($fv = round((double) str_replace(array(' ', ','), array('', '.'), $filter['act_sum']), 2)) {
$where[] = "round(su.act_lcomm+su.act_lintr, 2) = {$fv}";
}
if ($fv = (int) $filter['act_sys']) {
$where[] = "ss.act_sys = {$fv}";
}
if ($fv = $filter['has_docs']) {
$where[] = "su.docs_received = '{$fv}'";
}
if ($fv = $filter['has_act']) {
$where[] = '((su.uploaded_docs & ' . sbr::DOCS_TYPE_COPY_ACT . ") <> 0) = '{$fv}'";
}
if ($fv = $filter['has_fct']) {
$where[] = '((su.uploaded_docs & ' . sbr::DOCS_TYPE_COPY_FACTURA . ") <> 0) = '{$fv}'";
}
if ($fv = $filter['has_reqv']) {
$where[] = "COALESCE(sr.is_filled[sr.form_type], false) = '{$fv}'";
}
if ($fv = $filter['is_removed']) {
$where[] = "su.is_removed = '{$fv}'";
}
if ($scheme == 0) {
$where[] = ' ( ss.scheme_type <> ' . sbr::SCHEME_LC . ' ) ';
// исключаем Аккредитив
}
if ($where) {
$where = 'WHERE ' . implode(' AND ', $where);
}
$leftPdrd = 'WHERE sp.completed IS NOT NULL OR su.user_id IS NOT NULL';
if ($scheme == SBR::SCHEME_PDRD || $scheme == sbr::SCHEME_PDRD2) {
$leftPdrd = "LEFT JOIN \n sbr_stages_users su1 \n ON su1.stage_id = wss.id \n AND su1.user_id = wss.frl_id \n AND (su1.uploaded_docs & {$frl_upload_docs_cond}) <> 0 \n WHERE su1.user_id IS NOT NULL OR su.user_id IS NOT NULL\n ";
}
$from = "\n FROM (\n WITH w_sbr_stages AS (\n SELECT ss.*, s.emp_id, s.frl_id, s.scheme_id, s.scheme_type, s.cost_sys, \n arb.resolved, arb.frl_percent\n FROM sbr s\n INNER JOIN\n sbr_stages ss\n ON ss.sbr_id = s.id\n LEFT JOIN sbr_stages_arbitrage arb\n ON arb.stage_id = ss.id\n WHERE s.reserved_id IS NOT NULL\n AND s.norisk_id IS NULL\n {$scheme_cond}\n )\n SELECT wss.*, wss.emp_id as user_id, wss.cost_sys as act_sys,\n wss.closed_time as arch_closed_time\n FROM w_sbr_stages wss \n LEFT JOIN\n sbr_stages_payouts sp\n ON sp.stage_id = wss.id\n AND sp.user_id = wss.frl_id\n LEFT JOIN\n sbr_stages_users su\n ON su.stage_id = wss.id\n AND su.user_id = wss.emp_id\n AND (su.uploaded_docs & {$emp_upload_docs_cond}) <> 0\n {$leftPdrd} \n UNION ALL\n SELECT wss.*, wss.frl_id, sp.credit_sys,\n sp.requested as arch_closed_time\n FROM w_sbr_stages wss\n INNER JOIN\n sbr_stages_payouts sp\n ON sp.stage_id = wss.id\n AND sp.user_id = wss.frl_id\n ) as ss\n INNER JOIN\n sbr_stages_users su\n ON su.stage_id = ss.id\n AND su.user_id = ss.user_id\n {$docs_cond}\n INNER JOIN\n users u\n ON u.uid = ss.user_id\n LEFT JOIN\n sbr_reqv sr\n ON sr.user_id = ss.user_id\n ";
$sql = "\n SELECT ss.*, sr.*, ss.id as stage_id,\n su.uploaded_docs, su.docs_received, su.act_lcomm, su.act_lintr, su.act_lndfl, su.act_lnp, su.act_lcomm + su.act_lintr as act_sum, su.act_notnp, su.is_removed,\n sp.credit_sys, sp.credit_sum,\n u.login, u.uname, u.usurname, u.role,\n COALESCE(docs.publ_time, ss.arch_closed_time) as act_upload_time\n {$from}\n LEFT JOIN\n sbr_stages_payouts sp\n\n ON sp.stage_id = ss.id\n AND sp.user_id = ss.user_id\n \n --LEFT JOIN sbr_docs docs ON docs.stage_id = ss.id AND docs.access_role IN (1,2) AND docs.type IN (1,8) AND docs.is_deleted = false AND docs.owner_role = 0\n LEFT JOIN (\n SELECT DISTINCT ON (stage_id, access_role) stage_id, d.publ_time, f.modified, d.access_role FROM sbr_docs d\n INNER JOIN file_sbr f ON f.id = d.file_id\n WHERE \n is_deleted = false AND access_role IN (1,2)\n AND owner_role = 0\n ORDER BY stage_id, access_role, publ_time DESC\n ) docs ON docs.stage_id = ss.id AND (docs.access_role = substring(u.role, 1, 1)::integer + 1)\n \n {$where}\n ORDER BY {$this->form_cols['docsflow'][$dir_col][1][$dir]}\n LIMIT {$limit} OFFSET {$offset}\n ";
/*
LEFT JOIN (
SELECT DISTINCT ON (stage_id) stage_id, d.publ_time, f.modified FROM sbr_docs d
INNER JOIN sbr s ON s.id = d.sbr_id
INNER JOIN file_sbr f ON f.id = d.file_id
WHERE type IN (1,8)
--AND status = 4
AND is_deleted = false AND access_role IN (1,2)
AND owner_role = 0
ORDER BY stage_id, publ_time DESC
) docs ON docs.stage_id = ss.id
*/
if ($res = pg_query(self::connect(), $sql)) {
if ($ret = pg_fetch_all($res)) {
$account = new account();
foreach ($ret as &$row) {
if ($row['uploaded_docs']) {
$access_role = is_emp($row['role']) ? self::DOCS_ACCESS_EMP : self::DOCS_ACCESS_FRL;
if ($docs = sbr_meta::getDocs("WHERE sd.stage_id = '{$row['id']}' AND (sd.access_role & {$access_role}) = {$access_role} AND sd.is_deleted = false", null, true)) {
$row['uploaded_docs_a'] = array();
foreach ($docs as $doc) {
$row['uploaded_docs_a'][$doc['type']] = $doc;
}
}
}
// это потом переделать
$account->GetInfo($row['user_id']);
$row['attaches'] = $account->getAllAttach();
}
$sql = "SELECT COUNT(1) as cnt {$from} {$where}";
$mem = new memBuff();
if ($rows = $mem->getSql($err, $sql, 60)) {
$page_count = $rows[0]['cnt'];
}
}
}
return $ret;
}
示例15: getProfiLanding
/**
* Список PROFI пользлвателей для лендинга
*
* @param type $limit
* @return null
*/
function getProfiLanding($limit = 39)
{
$fu_table = self::$fu_table;
$error = null;
$sql = "\n SELECT \n p.name as profname,\n s.*\n FROM {$fu_table} AS s \n INNER JOIN orders AS o ON o.from_id = s.uid AND o.from_date < NOW() AND (o.from_date + o.to_date) > NOW()\n LEFT JOIN professions AS p ON p.id = s.spec\n WHERE \n s.is_profi = 't' AND s.is_banned = '0'\n ORDER BY o.from_date DESC\n LIMIT {$limit}\n ";
$memBuff = new memBuff();
$frls = $memBuff->getSql($error, $sql, self::CATALOG_PROFI_MEM_LIFE, true, self::CATALOG_PROFI_MEM_TAG);
if ($error || !$frls) {
return null;
}
return $frls;
}