addons
This commit is contained in:
parent
78b3697dea
commit
1bb5c995cf
@ -5,6 +5,7 @@ use app\common\controller\AdminController;
|
||||
use think\facade\View;
|
||||
use think\facade\Db;
|
||||
use think\facade\Request;
|
||||
use think\facade\Cache;
|
||||
use think\facade\Config;
|
||||
use app\admin\model\Addons as AddonsModel;
|
||||
use taoler\com\Files;
|
||||
@ -31,6 +32,7 @@ class Addons extends AdminController
|
||||
{
|
||||
|
||||
$type = input('type');
|
||||
$data = Request::only(['page', 'limit']);
|
||||
$res = [];
|
||||
switch($type){
|
||||
//已安装
|
||||
@ -64,7 +66,10 @@ class Addons extends AdminController
|
||||
//在线
|
||||
case 'onlineAddons':
|
||||
$url = $this->getSystem()['api_url'].'/v1/addons';
|
||||
$addons = Api::urlPost($url,[]);
|
||||
$res = Cache::get('addons');
|
||||
if(empty($res)){
|
||||
|
||||
$addons = Api::urlGet($url,[]);
|
||||
if( $addons->code !== -1){
|
||||
$res['code'] = 0;
|
||||
$res['msg'] = '';
|
||||
@ -82,9 +87,13 @@ class Addons extends AdminController
|
||||
['field' => 'ctime','title'=> '时间', 'width'=> 150],
|
||||
['title' => '操作', 'width'=> 150, 'align'=>'center', 'toolbar'=> '#addons-tool']
|
||||
];
|
||||
|
||||
Cache::set('addons', $res, 600);
|
||||
} else {
|
||||
$res = ['code'=>-1,'msg'=>''];
|
||||
$res = ['code'=>-1,'msg'=>'未获取到服务器信息'];
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
return json($res);
|
||||
|
Loading…
x
Reference in New Issue
Block a user