增加 固钉

This commit is contained in:
iVampireSP.com 2022-09-18 16:21:24 +08:00
parent 74ea16ed29
commit fb0510ada9
No known key found for this signature in database
GPG Key ID: 2F7B001CA27A8132
2 changed files with 15 additions and 1 deletions

View File

@ -36,6 +36,15 @@ public function announcements()
return $this->resp($resp); return $this->resp($resp);
} }
public function pinned()
{
$resp = $this->cache(function () {
return $this->get('discussions?filter[tag]=pinned&page[offset]=0&sort=-commentCount');
});
return $this->resp($resp);
}
public function cache(Closure $callback) public function cache(Closure $callback)
{ {
@ -48,7 +57,8 @@ public function cache(Closure $callback)
} }
public function resp($data) { public function resp($data)
{
$data['base_url'] = $this->baseUrl; $data['base_url'] = $this->baseUrl;
return $this->success($data); return $this->success($data);

View File

@ -89,6 +89,10 @@
$router->get('/announcements', [ $router->get('/announcements', [
'uses' => 'ForumController@announcements' 'uses' => 'ForumController@announcements'
]); ]);
$router->get('/pinned', [
'uses' => 'ForumController@pinned'
]);
}); });
$router->group(['prefix' => 'modules/{module}'], function () use ($router) { $router->group(['prefix' => 'modules/{module}'], function () use ($router) {