mirror of https://gitee.com/karson/fastadmin.git
修复无法清除缓存的BUG
parent
5e7a598a19
commit
e4131eb2e6
|
|
@ -6,10 +6,12 @@ use app\common\controller\Backend;
|
|||
use fast\Http;
|
||||
use fast\Random;
|
||||
use fast\Tree;
|
||||
use RecursiveDirectoryIterator;
|
||||
use RecursiveIteratorIterator;
|
||||
use think\Cache;
|
||||
use think\Config;
|
||||
use think\Db;
|
||||
use think\Lang;
|
||||
use think\Cache;
|
||||
|
||||
/**
|
||||
* Ajax异步请求接口
|
||||
|
|
@ -353,19 +355,20 @@ class Ajax extends Backend
|
|||
$wipe_cache_type = ['TEMP_PATH', 'LOG_PATH', 'CACHE_PATH'];
|
||||
foreach ($wipe_cache_type as $item)
|
||||
{
|
||||
if ($item == 'LOG_PATH')
|
||||
$dir = constant($item);
|
||||
if (!is_dir($dir))
|
||||
continue;
|
||||
$files = new RecursiveIteratorIterator(
|
||||
new RecursiveDirectoryIterator($dir, RecursiveDirectoryIterator::SKIP_DOTS), RecursiveIteratorIterator::CHILD_FIRST
|
||||
);
|
||||
|
||||
foreach ($files as $fileinfo)
|
||||
{
|
||||
$dirs = (array) glob(constant($item) . '*');
|
||||
foreach ($dirs as $dir)
|
||||
{
|
||||
array_map('unlink', (array) glob($dir . DIRECTORY_SEPARATOR . '*.*'));
|
||||
}
|
||||
array_map('rmdir', $dirs);
|
||||
}
|
||||
else
|
||||
{
|
||||
array_map('unlink', (array) glob(constant($item) . DIRECTORY_SEPARATOR . '*.*'));
|
||||
$todo = ($fileinfo->isDir() ? 'rmdir' : 'unlink');
|
||||
$todo($fileinfo->getRealPath());
|
||||
}
|
||||
|
||||
//rmdir($dir);
|
||||
}
|
||||
Cache::clear();
|
||||
$this->code = 1;
|
||||
|
|
|
|||
|
|
@ -7001,8 +7001,24 @@ define("bootstrap-table-export", ["bootstrap-table","tableexport"], (function (g
|
|||
htmlForm.push(sprintf('<select class="form-control" name="field-%s" data-name="%s">%s</select>', vObjCol.field, vObjCol.field, selectHtml));
|
||||
htmlForm.push('</div>');
|
||||
}
|
||||
|
||||
htmlForm.push('<div class="col-sm-6">');
|
||||
htmlForm.push(sprintf('<input type="text" class="form-control input-md" name="%s" placeholder="%s" id="%s">', vObjCol.field, vObjCol.title, vObjCol.field));
|
||||
if (vObjCol.searchList) {
|
||||
if (typeof vObjCol.searchList == 'function') {
|
||||
htmlForm.push(vObjCol.searchList.call(this, vObjCol));
|
||||
} else {
|
||||
var isArray = vObjCol.searchList.constructor === Array;
|
||||
var searchList = [];
|
||||
searchList.push(sprintf('<option value="">%s</option>', $.fn.bootstrapTable.locales.formatAdvancedChoose()));
|
||||
$.each(vObjCol.searchList, function (key, value) {
|
||||
searchList.push("<option value='" + (isArray ? value : key) + "'>" + value + "</option>");
|
||||
});
|
||||
htmlForm.push(sprintf('<select class="form-control" name="%s">%s</select>', vObjCol.field, searchList.join('')));
|
||||
}
|
||||
} else {
|
||||
htmlForm.push(sprintf('<input type="text" class="form-control input-md" name="%s" placeholder="%s" id="%s">', vObjCol.field, vObjCol.title, vObjCol.field));
|
||||
}
|
||||
|
||||
htmlForm.push('</div>');
|
||||
htmlForm.push('</div>');
|
||||
}
|
||||
|
|
@ -7060,6 +7076,9 @@ define("bootstrap-table-export", ["bootstrap-table","tableexport"], (function (g
|
|||
},
|
||||
formatAdvancedCloseButton: function () {
|
||||
return "Close";
|
||||
},
|
||||
formatAdvancedChoose: function () {
|
||||
return "Choose";
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -7154,7 +7173,10 @@ define("bootstrap-table-export", ["bootstrap-table","tableexport"], (function (g
|
|||
$("#avdSearchModalContent_" + this.options.idTable + " select").each(function () {
|
||||
var name = $(this).data("name");
|
||||
var sym = $(this).val();
|
||||
var value = $("input[name='" + name + "']").val();
|
||||
var obj = $("[name='" + name + "']");
|
||||
if (obj.size() == 0)
|
||||
return true;
|
||||
var value = obj.size() > 1 ? $("[name='" + name + "']:checked").val() : obj.val();
|
||||
if (value == '' && sym.indexOf("NULL") == -1) {
|
||||
return true;
|
||||
}
|
||||
|
|
@ -7204,9 +7226,14 @@ define('table',['jquery', 'bootstrap', 'backend', 'config', 'toastr', 'moment',
|
|||
method: 'get',
|
||||
toolbar: "#toolbar",
|
||||
search: true,
|
||||
cache: false,
|
||||
advancedSearch: true,
|
||||
idTable: 'advancedTable',
|
||||
showExport: true,
|
||||
exportDataType: "all",
|
||||
exportTypes: ['json', 'xml', 'csv', 'txt', 'doc', 'excel'],
|
||||
pageSize: 10,
|
||||
pageList: [10, 25, 50, 'All'],
|
||||
pagination: true,
|
||||
clickToSelect: true,
|
||||
showRefresh: false,
|
||||
|
|
@ -7571,6 +7598,7 @@ define('upload',['jquery', 'bootstrap', 'backend', 'config', 'plupload'], functi
|
|||
plupload: function (element, onAfterUpload) {
|
||||
element = typeof element == 'undefined' ? Upload.config.classname : element;
|
||||
$(element, Upload.config.container).each(function () {
|
||||
var that = this;
|
||||
var id = $(this).prop("id");
|
||||
var url = $(this).data("url");
|
||||
var maxsize = $(this).data("maxsize");
|
||||
|
|
@ -7579,6 +7607,7 @@ define('upload',['jquery', 'bootstrap', 'backend', 'config', 'plupload'], functi
|
|||
var multiple = $(this).data("multiple");
|
||||
//上传URL
|
||||
url = url ? url : Config.upload.uploadurl;
|
||||
url = Backend.api.fixurl(url);
|
||||
//最大可上传
|
||||
maxsize = maxsize ? maxsize : Config.upload.maxsize;
|
||||
//文件类型
|
||||
|
|
@ -7610,7 +7639,7 @@ define('upload',['jquery', 'bootstrap', 'backend', 'config', 'plupload'], functi
|
|||
//这里可以改成其它的表现形式
|
||||
//document.getElementById('filelist').innerHTML += '<div id="' + file.id + '">' + file.name + ' (' + plupload.formatSize(file.size) + ') <b></b></div>';
|
||||
});
|
||||
$("#" + id).data("bakup-html", $("#" + id).html());
|
||||
$(that).data("bakup-html", $(that).html());
|
||||
//添加后立即上传
|
||||
setTimeout(function () {
|
||||
Upload.list[id].start();
|
||||
|
|
@ -7619,11 +7648,11 @@ define('upload',['jquery', 'bootstrap', 'backend', 'config', 'plupload'], functi
|
|||
UploadProgress: function (up, file) {
|
||||
//这里可以改成其它的表现形式
|
||||
//document.getElementById(file.id).getElementsByTagName('b')[0].innerHTML = '<span>' + file.percent + "%</span>";
|
||||
$("#" + id).prop("disabled", true).html("<i class='fa fa-upload'></i> 上传" + file.percent + "%");
|
||||
$(that).prop("disabled", true).html("<i class='fa fa-upload'></i> 上传" + file.percent + "%");
|
||||
},
|
||||
FileUploaded: function (up, file, info) {
|
||||
//还原按钮文字及状态
|
||||
$("#" + id).prop("disabled", false).html($("#" + id).data("bakup-html"));
|
||||
$(that).prop("disabled", false).html($(that).data("bakup-html"));
|
||||
//这里可以改成其它的表现形式
|
||||
//document.getElementById(file.id).getElementsByTagName('b')[0].innerHTML += (' [Url]: ' + '<a href="' + url + '" target="_blank">' + url + '</a>');
|
||||
//这里建议不修改
|
||||
|
|
@ -7634,13 +7663,20 @@ define('upload',['jquery', 'bootstrap', 'backend', 'config', 'plupload'], functi
|
|||
ret.code = ret.code == 200 ? 1 : ret.code;
|
||||
var data = ret.hasOwnProperty("data") && ret.data != "" ? ret.data : null;
|
||||
var msg = ret.hasOwnProperty("msg") && ret.msg != "" ? ret.msg : "";
|
||||
$("input[data-plupload-id='" + id + "-text']").val(data.url);
|
||||
var afterUpload = $("#" + id).data("after-upload");
|
||||
if (afterUpload && typeof Upload.api.custom[afterUpload] == 'function') {
|
||||
Upload.api.custom[afterUpload].call(info, id, data);
|
||||
}
|
||||
if (typeof onAfterUpload == 'function') {
|
||||
onAfterUpload.call(info, id, data);
|
||||
if (ret.code === 1) {
|
||||
//$("input[data-plupload-id='" + id + "-text']").val(data.url);
|
||||
if ($(that).data("input-id")) {
|
||||
$("input#" + $(that).data("input-id")).val(data.url);
|
||||
}
|
||||
var afterUpload = $("#" + id).data("after-upload");
|
||||
if (afterUpload && typeof Upload.api.custom[afterUpload] == 'function') {
|
||||
Upload.api.custom[afterUpload].call(that, data);
|
||||
}
|
||||
if (typeof onAfterUpload == 'function') {
|
||||
onAfterUpload.call(that, data);
|
||||
}
|
||||
} else {
|
||||
Toastr.error(msg ? msg : __('Operation failed'));
|
||||
}
|
||||
} else {
|
||||
Toastr.error(e.message + "(code:-2)");
|
||||
|
|
@ -7698,8 +7734,8 @@ define('upload',['jquery', 'bootstrap', 'backend', 'config', 'plupload'], functi
|
|||
},
|
||||
custom: {
|
||||
//自定义上传完成回调
|
||||
afteruploadcallback: function (id, response) {
|
||||
console.log(this, id, response);
|
||||
afteruploadcallback: function (response) {
|
||||
console.log(this, response);
|
||||
alert("Custom Callback,Response URL:" + response.url);
|
||||
},
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in New Issue