回精華區
作者itoc.bbs@cpu.tfcis.org (核心動力) 看板: plan
標題Re: [問題] 熱門看板 以及 看板人氣
時間動力核心 (2006/03/26 Sun 12:25:45) Updated: 2006/03/27
※ 引述《guessi.bbs@bbs.wretch.cc (沒)》之銘言:
> 現在的人數計次 有時甚至會出現隱藏看板 明明只有一個人進得了看板 卻有人氣 > 1
> 若以計算板友的方式應該可以解決吧 ? 請問該怎麼做呢 ?
> 真的不能即時bmate數量嗎? 還是說那樣很耗I/O
> 抱歉對於這部分不太了解 還請指教

: cache.c:utmp_brdmate() 新增此函式在 utmp_find() 後面

int
utmp_brdmate(bname)
  char *bname;
{
  UTMP *uentp, *uceil;
  int num;

  num = 0;
  uentp = ushm->uslot;
  uceil = (void *) uentp + ushm->offset;
  do
  {
    if ((uentp->mode == M_READA) && !strcmp(uentp->reading, bname))
      num++;
  } while (++uentp <= uceil);

  return num;
}

: post.c:post_head()

- prints(NECKER_POST, d_cols, "", currbattr & BRD_NOSCORE ? "╳" : "○",
-   bshm->mantime[currbno]);
+ prints(NECKER_POST, d_cols, "", currbattr & BRD_NOSCORE ? "╳" : "○",
+   utmp_brdmate(currboard));

: board.c:class_item()

  /* 處理 人氣 */
- bno = bshm->mantime[bno];
+ bno = utmp_brdmate(brd->brdname);

  這樣就是即時的了,不過要付出一些代價

> ─────────────────────────────────── <

  若有做 [功能] board.c 分組討論集新增熱門看板
  那麼還要改

: cache.c:utmp_brdmate()

  int num;
+ int bno;

+ if ((bno = brd_bno(bname)) < 0)
+   return -1;

  ...
  ...

+ bshm->mantime[bno] = num;

  return num;

--
=[:摃�◣�:Origin ]|[  Ocpu.tfcis.org  ]|[�搟說:]=
=[:摃�╱�:Author ]|[ itoc.Dorm11.NCTU.edu.tw  ]|[�:]=
精華選讀←離開[主題上]主題下(k)上篇(j)下篇S/a搜尋 G串列 TAB精華 ↑↓捲 Pg/Space翻