Forum and topic API calls.

このコミットが含まれているのは:
テクニカル諏訪子 2018-02-06 17:24:16 +09:00
コミット 4b30273bb3
2個のファイルの変更81行の追加1行の削除

ファイルの表示

@ -21,17 +21,87 @@ class BoardController extends Controller {
->get(); ->get();
} }
public function getForums() { // /api/rpc/board/forum/getforums/ public function getCategoryName($id) { // /api/rpc/board/category/getcategoryname/id
return DB::table('for_category')
->select('title')
->where('id', $id)
->get();
}
public function getForums() { // /api/rpc/board/forum/getforums
return DB::table('for_forums') return DB::table('for_forums')
->select('*') ->select('*')
->orderBy('order', 'asc') ->orderBy('order', 'asc')
->get(); ->get();
} }
public function getForum($id) { // /api/rpc/board/forum/getforum/id
return DB::table('for_forums')
->select('*')
->where('id', $id)
->orderBy('order', 'asc')
->get();
}
public function getForumName($id) { // /api/rpc/board/forum/getforumname/id
return DB::table('for_forums')
->select('cat_id', 'title')
->where('id', $id)
->orderBy('order', 'asc')
->get();
}
public function getForumsInCategory($cat_id) { // /api/rpc/board/forum/getforumsincategory/cat_id public function getForumsInCategory($cat_id) { // /api/rpc/board/forum/getforumsincategory/cat_id
return DB::table('for_forums') return DB::table('for_forums')
->select('*') ->select('*')
->where('cat_id', $cat_id) ->where('cat_id', $cat_id)
->get(); ->get();
} }
public function getTopics($for, $from, $to) { // /api/rpc/board/topic/gettopics/for/from/to
return DB::table('for_threads')
->select('*')
->where('for_id', $id)
->offset($from)
->limit($to)
->orderBy('last_date', 'desc')
->get();
}
public function getTopicsUnpinned($for_id, $from, $to) { // /api/rpc/board/topic/gettopicsunpinned/for_id
return DB::table('for_threads')
->select('*')
->where('for_id', $for_id)
->where('sticky', 0)
->offset($from)
->limit($to)
->orderBy('last_date', 'desc')
->get();
}
public function getTopicsPinned($for_id) { // /api/rpc/board/topic/gettopicspinned/for_id
return DB::table('for_threads')
->select('*')
->where('for_id', $for_id)
->where('sticky', 1)
->orderBy('last_date', 'desc')
->get();
}
public function countUnpinnedTopicsInForum($for_id) { // /api/rpc/board/topic/countunpinnedtopicsinforum/for_id
return DB::table('for_threads')
->where('for_id', $for_id)
->where('sticky', 0)
->count();
}
public function getTopic($id, $from, $to) { // /api/rpc/board/forum/gettopics/id/from/to
return DB::table('for_threads')
->select('*')
->where('id', $id)
->offset($from)
->limit($to)
->orderBy('last_date', 'desc')
->get();
}
} }

ファイルの表示

@ -12,7 +12,17 @@
// Category // Category
Route::get('/api/rpc/board/category/getcategories', 'BoardController@getCategories'); Route::get('/api/rpc/board/category/getcategories', 'BoardController@getCategories');
Route::get('/api/rpc/board/category/getcategory/{id}', 'BoardController@getCategory'); Route::get('/api/rpc/board/category/getcategory/{id}', 'BoardController@getCategory');
Route::get('/api/rpc/board/category/getcategoryname/{id}', 'BoardController@getCategoryName');
// Forum // Forum
Route::get('/api/rpc/board/forum/getforumsincategory/{cat_id}', 'BoardController@getForumsInCategory'); Route::get('/api/rpc/board/forum/getforumsincategory/{cat_id}', 'BoardController@getForumsInCategory');
Route::get('/api/rpc/board/forum/getforums', 'BoardController@getForums'); Route::get('/api/rpc/board/forum/getforums', 'BoardController@getForums');
Route::get('/api/rpc/board/forum/getforum/{id}', 'BoardController@getForum');
Route::get('/api/rpc/board/forum/getforumname/{id}', 'BoardController@getForumName');
// Topic
Route::get('/api/rpc/board/topic/gettopics/{cat}/{from}/{to}', 'BoardController@getTopics');
Route::get('/api/rpc/board/topic/gettopicsunpinned/{cat}/{from}/{to}', 'BoardController@getTopicsUnpinned');
Route::get('/api/rpc/board/topic/gettopicspinned/{cat}', 'BoardController@getTopicsPinned');
Route::get('/api/rpc/board/topic/countunpinnedtopicsinforum/{for_id}', 'BoardController@countUnpinnedTopicsInForum');
Route::get('/api/rpc/board/topic/gettopic/{cat}/{from}/{to}', 'BoardController@getTopic');