liugc 1 gadu atpakaļ
vecāks
revīzija
92fe9c673b
1 mainītis faili ar 4 papildinājumiem un 4 dzēšanām
  1. 4 4
      app/adminapi/logic/auth/MenuLogic.php

+ 4 - 4
app/adminapi/logic/auth/MenuLogic.php

@@ -44,8 +44,8 @@ class MenuLogic extends BaseLogic
     public static function getMenuByAdminId($adminId)
     {
         // 缓存优化
-        //$data = cache('MenuLogic:getMenuByAdminId:'.$adminId);
-        //if(empty($data)){
+        $data = cache('MenuLogic:getMenuByAdminId:'.$adminId);
+        if(empty($data)){
             $admin = Admin::findOrEmpty($adminId);
             $where = [];
             $where[] = ['type', 'in', ['M', 'C']];
@@ -58,8 +58,8 @@ class MenuLogic extends BaseLogic
                 ->order(['sort' => 'desc', 'id' => 'asc'])
                 ->select();
             $data = linear_to_tree($menu, 'children');
-            //cache('MenuLogic:getMenuByAdminId:'.$adminId,$data);
-        //}
+            cache('MenuLogic:getMenuByAdminId:'.$adminId,$data);
+        }
         return $data;
     }