Browse Source

add cache clean function

master
filesite 5 months ago
parent
commit
e5adb55ce6
  1. 14
      themes/beauty/controller/SiteController.php
  2. 15
      www/js/beauty.js

14
themes/beauty/controller/SiteController.php

@ -107,4 +107,18 @@ Class SiteController extends Controller {
return $this->render($viewName, $params, $pageTitle); return $this->render($viewName, $params, $pageTitle);
} }
//清空缓存
public function actionCleancache() {
$prefix = FSC::$app['config']['theme'];
$cacheKey = "{$prefix}_allFilesTree";
Common::cleanFileCache($cacheKey);
$cacheKey = "{$prefix}_allFilesData";
Common::cleanFileCache($cacheKey);
$code = 1;
$msg = 'OK';
return $this->renderJson(compact('code', 'msg'));
}
} }

15
www/js/beauty.js

@ -109,6 +109,21 @@ if ($('#image_site').get(0)) {
saveLanpnumToLocalstorage(lanpnum); saveLanpnumToLocalstorage(lanpnum);
}); });
//刷新缓存
$('.cleanCacheJS').click(function () {
$.ajax({
url: '/site/cleancache',
dataType: 'json',
method: 'POST'
}).done(function(data) {
if (data.code == 1) {
location.reload();
}
}).fail(function(jqXHR, textStatus, errorThrown) {
alert('请求失败,请稍后重试,错误信息:' + errorThrown);
});
});
// 音乐播放 // 音乐播放
if ($('#music_main').length > 0) { if ($('#music_main').length > 0) {
var musicState = 0; var musicState = 0;

Loading…
Cancel
Save