|
|
发布供应,求购信息后,出现相对应得首页分类后的 统计数量没有变化问题,只需在相应模块下分类管理更新统计。不过得一个模块一个模块更新统计。下面我在我的面板中加了一项 更新所有统计,顺便更新了下首页
首先在我的面板中-》自定义面板 添加一项 见图2 链接地址为 ?action=category
修改admin/index.inc.php
在switch 中添加一项
case 'category':
require DT_ROOT.'/include/module.func.php';
$mids = array(4,5,6,13,21); //此处对应的是运行的模块
$table = $DT_PRE."category";
$total = 0;
foreach($mids as $mid){
$tb = get_table($mid);
$CATEGORY = cache_read('category-'.$mid.'.php');
$result = $db->query("SELECT catid FROM {$table} WHERE moduleid=$mid");
while($r = $db->fetch_array($result)) {
$catid = $r['catid'];
if($mid == 4) {
$condition = "groupid>5 and catids like '%,".$catid.",%'";
} else {
$condition = 'status=3';
$condition .= $CATEGORY[$catid]['child'] ? " AND catid IN (".$CATEGORY[$catid]['arrchildid'].")" : " AND catid=$catid";
}
$item = $db->count($tb, $condition);
$db->query("UPDATE {$table} SET item=$item WHERE catid=$catid");
}
cache_item($mid);
}
cache_clear_count();
$db->expires = $CFG['db_expires'] = $CFG['tag_expires'] = 0;
tohtml('index');
$filename = $CFG['com_dir'] ? DT_ROOT.'/'.$DT['index'].'.'.$DT['file_ext'] : DT_CACHE.'/index.inc.html';
msg('分类统计更新成功');
break;
[ 本帖最后由 jerrymsj 于 2011-8-23 16:51 编辑 ] |
|