|
|
|
@ -9,6 +9,7 @@ require_once __DIR__ . '/../../../plugins/Html.php';
@@ -9,6 +9,7 @@ require_once __DIR__ . '/../../../plugins/Html.php';
|
|
|
|
|
|
|
|
|
|
Class ListController extends Controller { |
|
|
|
|
protected $dateIndexCacheKey = 'MainBotDateIndex'; //索引数据的key单独缓存,缓存key为此{cacheKey}_keys |
|
|
|
|
protected $allFilesCacheKey = 'MainBotAllFiles'; |
|
|
|
|
protected $noOriginalCtimeFilesCacheKey = 'MainBotNoOriginalCtimeFiles'; |
|
|
|
|
|
|
|
|
|
public function actionIndex() { |
|
|
|
@ -391,4 +392,42 @@ Class ListController extends Controller {
@@ -391,4 +392,42 @@ Class ListController extends Controller {
|
|
|
|
|
return $breads; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//按年份、月份展示 |
|
|
|
|
public function actionBydate() { |
|
|
|
|
$para_year = $this->get('year', ''); |
|
|
|
|
$para_month = $this->get('month', ''); |
|
|
|
|
if (empty($para_year) && empty($para_month)) { |
|
|
|
|
throw new Exception("参数缺失!", 403); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$intYear = str_replace('y', '', $para_year); |
|
|
|
|
$intMonth = str_replace('m', '', $para_month); |
|
|
|
|
|
|
|
|
|
//先获取keys文件,以快速检查年份和月份数据是否存在,并用于展示月份导航栏 |
|
|
|
|
$cacheKey = $this->dateIndexCacheKey . "_keys"; |
|
|
|
|
$expireSeconds = 86400 * 30; //缓存 30 天 |
|
|
|
|
$cacheSubDir = 'index'; |
|
|
|
|
$cacheData_keys = Common::getCacheFromFile($cacheKey, $expireSeconds, $cacheSubDir); |
|
|
|
|
if (empty($cacheData_keys)) { |
|
|
|
|
throw new Exception("索引数据已失效,请重新扫描所有文件以生成索引数据!", 404); |
|
|
|
|
}else if ( !empty($para_month) && !in_array($para_month, $cacheData_keys[$para_year]) ) { |
|
|
|
|
throw new Exception("{$intYear} 年没有 {$intMonth} 月的数据!", 404); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$cacheKey = $this->dateIndexCacheKey . "_{$para_year}"; |
|
|
|
|
$expireSeconds = 86400 * 30; //缓存 30 天 |
|
|
|
|
$cacheSubDir = 'index'; |
|
|
|
|
$cacheData = Common::getCacheFromFile($cacheKey, $expireSeconds, $cacheSubDir); |
|
|
|
|
if (empty($cacheData)) { |
|
|
|
|
throw new Exception("索引数据已失效,请重新扫描所有文件以生成索引数据!", 404); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!empty($para_month)) { |
|
|
|
|
print_r($cacheData[$para_month]); |
|
|
|
|
}else { |
|
|
|
|
print_r($cacheData); |
|
|
|
|
} |
|
|
|
|
exit; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|