Correct forum and topic details.
このコミットが含まれているのは:
コミット
578cf25cd6
|
@ -395,6 +395,26 @@ class BoardController extends Controller {
|
|||
);
|
||||
}
|
||||
|
||||
public function getLastPostOfForum($for_id) {
|
||||
setlocale(LC_ALL, 'ja_JP.utf8');
|
||||
|
||||
$tid = DB::table('for_threads')
|
||||
->join('for_posts', 'for_posts.top_id', 'for_threads.id')
|
||||
->where('for_id', $for_id)
|
||||
->orderBy('for_posts.post_date', 'desc')
|
||||
->first(array(
|
||||
'for_threads.id as tid',
|
||||
'for_posts.user_id as uid',
|
||||
'for_posts.post_date as date'
|
||||
));
|
||||
|
||||
return array(
|
||||
'tid' => $tid->tid,
|
||||
'uid' => $tid->uid,
|
||||
'date' => strftime('%Y/%m/%d(%a) %H:%M:%S %Z', date($tid->date))
|
||||
);
|
||||
}
|
||||
|
||||
public function getFirstAndLastPosts($top_id) { // /api/rpc/board/post/getfirstandlastposts/top_id
|
||||
$first = $this->getTopicStart($top_id);
|
||||
$last = $this->getLastPost($top_id);
|
||||
|
@ -992,6 +1012,13 @@ class BoardController extends Controller {
|
|||
}
|
||||
}
|
||||
|
||||
public function countPostsInForum($id) {
|
||||
return DB::table('for_threads')
|
||||
->join('for_posts', 'for_posts.top_id', 'for_threads.id')
|
||||
->where('for_threads.for_id', $id)
|
||||
->count();
|
||||
}
|
||||
|
||||
public function browseCategories(Request $request) { // /api/rpc/board/browse/browsecategories
|
||||
$cats = $this->getCategories()->toArray();
|
||||
$cols = $this->objUser->getGroupColours()->toArray();
|
||||
|
@ -1008,8 +1035,12 @@ class BoardController extends Controller {
|
|||
$resF = array();
|
||||
|
||||
foreach($fors as $f) {
|
||||
$ldet = $this->getLastPostOfForum($f['id']);
|
||||
$topicsuu = DB::table('for_threads')->where('for_id', $f['id'])->count();
|
||||
$replysuu = $this->countPostsInForum($f['id']);
|
||||
|
||||
if ($f['last_uid'] != 0) {
|
||||
$user = $this->objUser->getUser($f['last_uid'], $request)->toArray();
|
||||
$user = $this->objUser->getUser($ldet['uid'], $request)->toArray();
|
||||
$showName = "";
|
||||
$showCol = "";
|
||||
|
||||
|
@ -1046,12 +1077,12 @@ class BoardController extends Controller {
|
|||
'u_name' => $showName,
|
||||
'u_col' => $showCol,
|
||||
'f_cat' => $f['cat_id'],
|
||||
'f_last_uid' => $f['last_uid'],
|
||||
'f_last_uid' => $ldet['uid'],
|
||||
'f_name' => $f['title'],
|
||||
'f_desc' => $f['description'],
|
||||
'f_topics' => $f['threads'],
|
||||
'f_posts' => $f['posts'],
|
||||
'f_last' => $f['last_date']
|
||||
'f_topics' => $topicsuu,
|
||||
'f_posts' => $replysuu,
|
||||
'f_last' => $ldet['date']
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -1156,6 +1187,8 @@ class BoardController extends Controller {
|
|||
$res = array();
|
||||
|
||||
foreach($tops as $t) {
|
||||
$replysuu = DB::table('for_posts')->where('top_id', $t->id)->count();
|
||||
|
||||
$fplp = $this->getFirstAndLastPosts($t->id);
|
||||
$userFD = $fplp['first']['date'];
|
||||
$userLD = $fplp['last']['date'];
|
||||
|
@ -1206,6 +1239,8 @@ class BoardController extends Controller {
|
|||
}
|
||||
}
|
||||
|
||||
setlocale(LC_ALL, 'ja_JP.utf8');
|
||||
|
||||
$catname = $this->getCategoryName($id);
|
||||
|
||||
// Compile.
|
||||
|
@ -1213,7 +1248,7 @@ class BoardController extends Controller {
|
|||
't_id' => $t->id,
|
||||
't_for_id' => $t->for_id,
|
||||
't_title' => $t->title,
|
||||
't_replies' => $t->replies,
|
||||
't_replies' => $replysuu,
|
||||
't_views' => $t->views,
|
||||
't_first_date' => strftime('%Y/%m/%d(%a) %H:%M:%S %Z', date($userFD)),
|
||||
't_last_date' => strftime('%Y/%m/%d(%a) %H:%M:%S %Z', date($userLD)),
|
||||
|
|
新しいイシューから参照