当前位置: 首页>>代码示例>>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;未经允许,请勿转载。