You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
91 lines
2.6 KiB
91 lines
2.6 KiB
<?php
|
|
// +----------------------------------------------------------------------
|
|
// | 天诚科技 [ 刘海东 17600099397赋能开发者,助力企业发展 ]
|
|
// +----------------------------------------------------------------------
|
|
// | Copyright (c) 2016~2020 https://www.tczxkj.com All rights reserved.
|
|
// +----------------------------------------------------------------------
|
|
// | Licensed 该系统并不是自由软件,未经许可不能去掉相关版权
|
|
// +----------------------------------------------------------------------
|
|
// | Author:甘肃天诚志信电子商务有限公司 刘海东 联系电话维系17600099397
|
|
// +----------------------------------------------------------------------
|
|
|
|
namespace app\admin\controller\system;
|
|
|
|
use app\admin\controller\AuthController;
|
|
use service\CacheService;
|
|
use service\JsonService as Json;
|
|
use think\Log;
|
|
use think\Cache;
|
|
|
|
/**
|
|
* 首页控制器
|
|
* Class Clear
|
|
*/
|
|
class Clear extends AuthController
|
|
{
|
|
public function index()
|
|
{
|
|
return $this->fetch();
|
|
}
|
|
|
|
/**
|
|
* 刷新数据缓存
|
|
*/
|
|
public function refresh_cache()
|
|
{
|
|
`php think optimize:schema`;
|
|
`php think optimize:autoload`;
|
|
`php think optimize:route`;
|
|
`php think optimize:config`;
|
|
return Json::successful('数据缓存刷新成功!');
|
|
}
|
|
|
|
/**
|
|
* 清除首页缓存
|
|
*/
|
|
public function del_home_redis()
|
|
{
|
|
$subjectUrl = getUrlToDomain();
|
|
del_redis_hash($subjectUrl . "wap_index_has", "recommend_list");
|
|
del_redis_hash($subjectUrl . "web_index_has", "recommend_list");
|
|
return Json::successful('清除首页缓存成功!');
|
|
}
|
|
|
|
/**
|
|
* 删除缓存
|
|
*/
|
|
public function delete_cache()
|
|
{
|
|
Cache::clear();
|
|
array_map('unlink', glob(TEMP_PATH . '/*.php'));
|
|
return Json::successful('清除缓存成功!');
|
|
}
|
|
|
|
/**
|
|
* 删除日志
|
|
*/
|
|
public function delete_log()
|
|
{
|
|
array_map('unlink', glob(LOG_PATH . '/*.log'));
|
|
$this->delDirAndFile(LOG_PATH);
|
|
return Json::successful('清除日志成功!');
|
|
}
|
|
|
|
function delDirAndFile($dirName, $subdir = true)
|
|
{
|
|
if ($handle = opendir("$dirName")) {
|
|
while (false !== ($item = readdir($handle))) {
|
|
if ($item != "." && $item != "..") {
|
|
if (is_dir("$dirName/$item"))
|
|
$this->delDirAndFile("$dirName/$item", false);
|
|
else
|
|
@unlink("$dirName/$item");
|
|
}
|
|
}
|
|
closedir($handle);
|
|
if (!$subdir) @rmdir($dirName);
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|