Pārlūkot izejas kodu

fix #965 修复后台开启页面缓存时,模板json请求解析问题

magicblack 2 gadi atpakaļ
vecāks
revīzija
edaabf0395

+ 3 - 1
application/common/controller/All.php

@@ -27,7 +27,9 @@ class All extends Controller
             $cach_name = $_SERVER['HTTP_HOST']. '_'. MAC_MOB . '_'. $GLOBALS['config']['app']['cache_flag']. '_' .$tpl .'_'. http_build_query(mac_param_url());
             $res = Cache::get($cach_name);
             if ($res) {
-                if($type=='json'){
+                // 修复后台开启页面缓存时,模板json请求解析问题
+                // https://github.com/magicblack/maccms10/issues/965
+                if($type=='json' || str_contains(request()->header('accept'), 'application/json')){
                     $res = json_encode($res);
                 }
                 echo $res;

+ 1 - 1
application/common/model/Vod.php

@@ -497,7 +497,7 @@ class Vod extends Base {
                 }
             }
         }
-        // 随机视频排序rnd的性能问题
+        // 优化随机视频排序rnd的性能问题
         // https://github.com/magicblack/maccms10/issues/967
         $use_rand = false;
         if($by=='rnd'){