后台添加和修改内容成功时自动清除缓存,不必再每次手动清缓存

pull/131/head
loong 2019-06-13 22:44:35 +08:00
parent f914920078
commit a836d2a18f
1 changed files with 5 additions and 0 deletions

View File

@ -8,6 +8,7 @@ use PhpOffice\PhpSpreadsheet\Reader\Xlsx;
use PhpOffice\PhpSpreadsheet\Reader\Xls;
use PhpOffice\PhpSpreadsheet\Reader\Csv;
use think\Exception;
use think\Cache;
trait Backend
{
@ -117,6 +118,8 @@ trait Backend
}
$result = $this->model->allowField(true)->save($params);
if ($result !== false) {
rmdirs(CACHE_PATH, false);
Cache::clear();
$this->success();
} else {
$this->error($this->model->getError());
@ -161,6 +164,8 @@ trait Backend
}
$result = $row->allowField(true)->save($params);
if ($result !== false) {
rmdirs(CACHE_PATH, false);
Cache::clear();
$this->success();
} else {
$this->error($row->getError());