久久久久av_欧美日韩一区二区在线_国产精品三区四区_日韩中字在线

Discuz! 官方交流社區(qū)

標(biāo)題: 主題分類數(shù)量統(tǒng)計(jì)在刪帖后不更新 [打印本頁]

作者: zamapara    時(shí)間: 2022-1-17 17:35
標(biāo)題: 主題分類數(shù)量統(tǒng)計(jì)在刪帖后不更新
本帖最后由 zamapara 于 2022-1-18 08:56 編輯

過程:
1. 新建 分類1
2. 分類1 下發(fā)帖,點(diǎn)分類1,數(shù)量更新為 1 (正確的)
3. 刪除這個(gè)帖子, 再選中分類1,數(shù)量還是顯示為1,是錯(cuò)誤的,正確的應(yīng)該是0

經(jīng)檢查,估計(jì)是discuzx34\source\module\forum\forum_forumdisplay.php 中l(wèi)ine543的判斷問題,

刪帖后,帖子數(shù)為0,沒有調(diào)用更新代碼

    if($threadclasscount) {
        threadclasscount($_G['fid'], $threadclasscount['id'], $threadclasscount['idtype'], $_G['forum_threadcount']);
    }



作者: dashen    時(shí)間: 2022-1-17 20:37
$threadclasscount是個(gè)數(shù)組,并不是記錄的帖子0
實(shí)際是 $_G['forum_threadcount'] 為 0 ,導(dǎo)致無法進(jìn)入更新流程

function threadclasscount($fid, $id = 0, $idtype = '', $count = 0) {
        if(!$fid) {
                return false;
        }
        $typeflag = ($id && $idtype && in_array($idtype, array('typeid', 'sortid')));
        $threadclasscount = C::t('common_cache')->fetch('threadclasscount_'.$fid);
        $threadclasscount = dunserialize($threadclasscount['cachevalue']);
        if($count) {
                if($typeflag) {
                        $threadclasscount[$idtype][$id] = $count;
                        C::t('common_cache')->insert(array(
                                'cachekey' => 'threadclasscount_'.$fid,
                                'cachevalue' => serialize($threadclasscount),
                        ), false, true);
                        return true;
                } else {
                        return false;
                }
        } else {
                if($typeflag) {
                        return $threadclasscount[$idtype][$id];
                } else {
                        return $threadclasscount;
                }
        }

}



作者: zamapara    時(shí)間: 2022-1-18 08:56
哈哈,昨天沒仔細(xì)看,你說的對(duì)
作者: 老周部落    時(shí)間: 2022-1-29 16:44
試試 https://gitee.com/laozhoubuluo/D ... /threadclasscount_0 補(bǔ)丁能否解決?
作者: zamapara    時(shí)間: 2022-1-29 17:03
老周部落 發(fā)表于 2022-1-29 16:44
試試 https://gitee.com/laozhoubuluo/DiscuzX/commits/fix/v3.4/threadclasscount_0 補(bǔ)丁能否解決? ...

已測(cè)試,可以解決




歡迎光臨 Discuz! 官方交流社區(qū) (http://www.9999xn.com/) Powered by Discuz! W1.0