This commit is contained in:
net909
2023-10-09 21:51:39 +08:00
parent ba7be004c0
commit 3df2bc15e2
+3 -3
View File
@@ -75,7 +75,7 @@ class Index extends Base
$stars = request()->user['stars']; $stars = request()->user['stars'];
if(strlen($stars)>0){ if(strlen($stars)>0){
$stars = explode(',',$stars); $stars = explode(',',$stars);
$tool = Db::name('plugin')->cache('plugins', self::CACHE_TIME)->field('id,title,alias,keyword,request_count,category_id')->where('enable', 1)->order('weight','desc')->select(); $tool = Db::name('plugin')->cache('plugins', self::CACHE_TIME)->field('id,title,alias,keyword,request_count,category_id,level')->where('enable', 1)->order('weight','desc')->select();
$list = []; $list = [];
foreach($category as $item){ foreach($category as $item){
foreach($tool as $row){ foreach($tool as $row){
@@ -110,15 +110,15 @@ class Index extends Base
$history = cookie('tools'); $history = cookie('tools');
if(strlen($history)>0){ if(strlen($history)>0){
$history = array_reverse(array_unique(explode(',',$history))); $history = array_reverse(array_unique(explode(',',$history)));
$tool = Db::name('plugin')->cache('plugins', self::CACHE_TIME)->field('id,title,alias,keyword,request_count,category_id')->where('enable', 1)->order('weight','desc')->select(); $tool = Db::name('plugin')->cache('plugins', self::CACHE_TIME)->field('id,title,alias,keyword,request_count,category_id,level')->where('enable', 1)->order('weight','desc')->select();
$newtool = []; $newtool = [];
foreach($tool as $row){ foreach($tool as $row){
$newtool[$row['id']] = $row; $newtool[$row['id']] = $row;
} }
$list = []; $list = [];
foreach($history as $id){ foreach($history as $id){
if(!isset($newtool[$id])) continue;
$row = $newtool[$id]; $row = $newtool[$id];
if(!$row) continue;
if(!plugin_userlevel($row['level'])) continue; if(!plugin_userlevel($row['level'])) continue;
$row['url'] = get_plugin_url($row['alias']); $row['url'] = get_plugin_url($row['alias']);
$row['out'] = substr($row['alias'],0,1) == '/' || substr($row['alias'],0,7) == 'http://' || substr($row['alias'],0,8) == 'https://'; $row['out'] = substr($row['alias'],0,1) == '/' || substr($row['alias'],0,7) == 'http://' || substr($row['alias'],0,8) == 'https://';