|
|
<?php
|
|
|
|
|
|
use Action\AbstractAction;
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -12,33 +13,49 @@ use Action\AbstractAction; |
|
|
*/
|
|
|
class RssController extends AbstractAction
|
|
|
{
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 订阅逛最新的资讯
|
|
|
*/
|
|
|
public function indexAction()
|
|
|
{
|
|
|
headers_sent() || header('Content-Type: text/xml; charset=utf-8');
|
|
|
|
|
|
|
|
|
$time = date('D, d M Y H:i:s O');
|
|
|
|
|
|
$gender = $this->get('gender', '1,2,3');
|
|
|
|
|
|
// 输出顶部公共的信息
|
|
|
echo <<<RSS
|
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
|
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
|
|
<channel>
|
|
|
<title>有货逛</title>
|
|
|
<link>http://guang.m.yohobuy.com</link>
|
|
|
<description>Yoho!Buy有货 | 年轻人潮流购物中心</description>
|
|
|
<atom:link href="http://guang.m.yohobuy.com/rss" rel="self"></atom:link>
|
|
|
<atom:link rel="hub" href="http://pubsubhubbub.appspot.com"/>
|
|
|
<language>zh-cn</language>
|
|
|
<copyright>2015 yoho.inc</copyright>
|
|
|
<lastBuildDate>{$time}</lastBuildDate>
|
|
|
<ttl>30</ttl>
|
|
|
RSS;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<title>有货逛</title>
|
|
|
<link>http://yohobuy.com</link>
|
|
|
<generator>http://m.yohobuy.com</generator>
|
|
|
<description>Yoho!Buy有货 | 年轻人潮流购物中心</description>
|
|
|
<atom:link href="http://guang.m.yohobuy.com/rss" rel="self"></atom:link>
|
|
|
<atom:link rel="hub" href="http://pubsubhubbub.appspot.com"/>
|
|
|
<language>zh-cn</language>
|
|
|
<copyright>2015 yoho.inc</copyright>
|
|
|
<lastBuildDate>{$time}</lastBuildDate>
|
|
|
<ttl>50</ttl>
|
|
|
|
|
|
RSS;
|
|
|
|
|
|
$items = \Guang\IndexModel::getRssArticle($gender);
|
|
|
foreach ($items as $item) {
|
|
|
echo '<item>', "\n",
|
|
|
'<title><![CDATA[', $item['title'], ']]></title>', "\n",
|
|
|
'<link><![CDATA[', $item['url'], '&ref=rss]]></link>', "\n",
|
|
|
'<description><![CDATA[', $item['intro'], ']]></description>', "\n",
|
|
|
'<pubDate>', $item['publishTime'], '</pubDate>', "\n",
|
|
|
'<author><![CDATA[', $item['author']['name'], ']]></author>', "\n",
|
|
|
'<guid><![CDATA[', $item['url'], '&ref=rss]]></guid>', "\n",
|
|
|
'<source>有货</source>',
|
|
|
'</item>', "\n";
|
|
|
}
|
|
|
|
|
|
echo "</channel>\n</rss>";
|
|
|
}
|
|
|
|
|
|
|
|
|
} |
...
|
...
|
|