mirror of
https://gitee.com/ulthon/ulthon_information.git
synced 2026-03-03 16:24:28 +08:00
增加ATOM订阅
This commit is contained in:
@@ -92,5 +92,31 @@ Route::rule('/rss2.xml', function (Request $request) {
|
||||
|
||||
Cache::set($cache_key, $last_etag);
|
||||
|
||||
return xml($content)->eTag($last_etag);
|
||||
});
|
||||
|
||||
Route::rule('/atom.xml', function (Request $request) {
|
||||
|
||||
$cache_key = 'atom_cache_key';
|
||||
|
||||
$last_etag = Cache::get($cache_key);
|
||||
|
||||
if (!empty($cache_key)) {
|
||||
|
||||
$if_not_match = $request->header('If-None-Match');
|
||||
|
||||
if (!empty($if_not_match)) {
|
||||
if ($if_not_match == $last_etag) {
|
||||
return xml('', 304)->eTag($last_etag);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$content = Rss::initAtom();
|
||||
|
||||
$last_etag = md5($content);
|
||||
|
||||
Cache::set($cache_key, $last_etag);
|
||||
|
||||
return xml($content)->eTag($last_etag);
|
||||
});
|
||||
Reference in New Issue
Block a user