CacheController.php 720 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. namespace app\backend\modules\setting\controllers;
  3. use app\common\components\BaseController;
  4. use app\common\facades\Setting;
  5. use app\common\helpers\Url;
  6. class CacheController extends BaseController
  7. {
  8. public function index()
  9. {
  10. $set = Setting::get('cache');
  11. $requestModel = request()->cache;
  12. if ($requestModel) {
  13. if (Setting::set('cache', $requestModel)) {
  14. return $this->successJson('缓存设置成功', Url::absoluteWeb('setting.cache.index'));
  15. } else {
  16. $this->errorJson('缓存设置失败');
  17. }
  18. }
  19. return view('setting.cache.index', [
  20. 'set' => $set,
  21. ])->render();
  22. }
  23. }