當前位置: 首頁>>代碼示例>>PHP>>正文


PHP SearchHelper::preGetThreads方法代碼示例

本文整理匯總了PHP中SearchHelper::preGetThreads方法的典型用法代碼示例。如果您正苦於以下問題:PHP SearchHelper::preGetThreads方法的具體用法?PHP SearchHelper::preGetThreads怎麽用?PHP SearchHelper::preGetThreads使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在SearchHelper的用法示例。


在下文中一共展示了SearchHelper::preGetThreads方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getThreads

 function getThreads($tIds, $isReturnPostId = true)
 {
     global $_G;
     $tables = array();
     $infos = unserialize($_G['setting']['threadtable_info']);
     if ($infos) {
         foreach ($infos as $id => $row) {
             $suffix = $id ? "_{$id}" : '';
             $tables[] = 'forum_thread' . $suffix;
         }
     } else {
         $tables = array('forum_thread');
     }
     $tableNum = count($tables);
     $res = $data = $_tableInfo = array();
     for ($i = 0; $i < $tableNum; $i++) {
         $_threads = SearchHelper::preGetThreads(DB::table($tables[$i]), $tIds);
         if ($_threads) {
             if (!$data) {
                 $data = $_threads;
             } else {
                 $data = $data + $_threads;
             }
             if (count($data) == count($tIds)) {
                 break;
             }
         }
     }
     if ($isReturnPostId) {
         $threadIds = array();
         foreach ($data as $tId => $thread) {
             $postTableId = $thread['postTableId'];
             $threadIds[$postTableId][] = $tId;
         }
         $threadPosts = SearchHelper::getThreadPosts($threadIds);
         foreach ($data as $tId => $thread) {
             $data[$tId]['pId'] = $threadPosts[$tId]['pId'];
         }
     }
     return $data;
 }
開發者ID:pan289091315,項目名稱:Discuz,代碼行數:41,代碼來源:Manyou.php

示例2: _removeThreads

 function _removeThreads($tIds)
 {
     global $_G;
     $tables = array();
     $infos = unserialize($_G['setting']['threadtable_info']);
     if ($infos) {
         foreach ($infos as $id => $row) {
             $suffix = $id ? "_{$id}" : '';
             $tables[] = 'forum_thread' . $suffix;
         }
     } else {
         $tables = array('forum_thread');
     }
     $tableThreads = array();
     foreach ($tables as $table) {
         $_threads = SearchHelper::preGetThreads(DB::table($table), $tIds);
         $tableThreads[$table] = $_threads;
     }
     foreach ($tableThreads as $table => $threads) {
         $_tids = $_threadIds = array();
         foreach ($threads as $thread) {
             $_tids[] = $thread['tId'];
             $postTable = $thread['postTableId'] ? '-' . $thread['postTableId'] : '';
             $_threadIds[$postTable][] = $thread['tId'];
         }
         if ($_tids) {
             $sql = sprintf('DELETE FROM %s WHERE tid IN (%s)', DB::table($table), implode(',', $_tids));
             DB::query($sql);
         }
         if ($_threadIds) {
             foreach ($_threadIds as $postTable => $_tIds) {
                 if ($_tIds) {
                     $sql = sprintf('DELETE FROM %s WHERE tid IN (%s)', DB::table('forum_post' . $postTable), implode(',', $_tIds));
                     DB::query($sql);
                 }
             }
         }
     }
     return true;
 }
開發者ID:Kingson4Wu,項目名稱:php_demo,代碼行數:40,代碼來源:my.php

示例3: _removeThreads

 function _removeThreads($tIds, $isRecycle = false)
 {
     $tables = SearchHelper::getTables('thread');
     $tableThreads = array();
     foreach ($tables as $table) {
         $_threads = SearchHelper::preGetThreads(DB::table($table), $tIds);
         $tableThreads[$table] = $_threads;
     }
     foreach ($tableThreads as $table => $threads) {
         $_tids = $_threadIds = array();
         foreach ($threads as $thread) {
             $_tids[] = $thread['tId'];
             $postTable = $thread['postTableId'] ? '_' . $thread['postTableId'] : '';
             $_threadIds[$postTable][] = $thread['tId'];
         }
         if ($_tids) {
             if ($isRecycle) {
                 $sql = sprintf('UPDATE %s SET displayorder = -1 WHERE tid IN (%s)', DB::table($table), implode(',', $_tids));
                 DB::query($sql);
                 continue;
             }
             $sql = sprintf('DELETE FROM %s WHERE tid IN (%s)', DB::table($table), implode(',', $_tids));
             DB::query($sql);
             foreach ($_threadIds as $postTable => $_tIds) {
                 if ($_tIds) {
                     $sql = sprintf('DELETE FROM %s WHERE tid IN (%s)', DB::table('forum_post' . $postTable), implode(',', $_tIds));
                     DB::query($sql);
                 }
             }
         }
     }
     return true;
 }
開發者ID:pan289091315,項目名稱:Discuz,代碼行數:33,代碼來源:my.php


注:本文中的SearchHelper::preGetThreads方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。