This commit is contained in:
tao 2021-12-21 17:56:07 +08:00
parent 78b3697dea
commit 1bb5c995cf

View File

@ -5,6 +5,7 @@ use app\common\controller\AdminController;
use think\facade\View; use think\facade\View;
use think\facade\Db; use think\facade\Db;
use think\facade\Request; use think\facade\Request;
use think\facade\Cache;
use think\facade\Config; use think\facade\Config;
use app\admin\model\Addons as AddonsModel; use app\admin\model\Addons as AddonsModel;
use taoler\com\Files; use taoler\com\Files;
@ -31,6 +32,7 @@ class Addons extends AdminController
{ {
$type = input('type'); $type = input('type');
$data = Request::only(['page', 'limit']);
$res = []; $res = [];
switch($type){ switch($type){
//已安装 //已安装
@ -64,27 +66,34 @@ class Addons extends AdminController
//在线 //在线
case 'onlineAddons': case 'onlineAddons':
$url = $this->getSystem()['api_url'].'/v1/addons'; $url = $this->getSystem()['api_url'].'/v1/addons';
$addons = Api::urlPost($url,[]); $res = Cache::get('addons');
if( $addons->code !== -1){ if(empty($res)){
$res['code'] = 0;
$res['msg'] = ''; $addons = Api::urlGet($url,[]);
$res['data'] = $addons->data; if( $addons->code !== -1){
$res['col'] = [ $res['code'] = 0;
['type' => 'numbers'], $res['msg'] = '';
['field' => 'name','title'=> '插件', 'width'=> 150], $res['data'] = $addons->data;
['field'=> 'title','title'=> '标题', 'width'=> 100], $res['col'] = [
['field'=> 'version','title'=> '版本', 'width'=> 100], ['type' => 'numbers'],
['field' => 'author','title'=> '作者', 'width'=> 100], ['field' => 'name','title'=> '插件', 'width'=> 150],
['field' => 'description','title'=> '简介', 'minWidth'=> 200], ['field'=> 'title','title'=> '标题', 'width'=> 100],
['field' => 'price','title'=> '价格(元)'], ['field'=> 'version','title'=> '版本', 'width'=> 100],
['field' => 'status','title'=> '状态', 'width'=> 100], ['field' => 'author','title'=> '作者', 'width'=> 100],
['field' => 'install','title'=> '安装', 'width'=> 100], ['field' => 'description','title'=> '简介', 'minWidth'=> 200],
['field' => 'ctime','title'=> '时间', 'width'=> 150], ['field' => 'price','title'=> '价格(元)'],
['title' => '操作', 'width'=> 150, 'align'=>'center', 'toolbar'=> '#addons-tool'] ['field' => 'status','title'=> '状态', 'width'=> 100],
]; ['field' => 'install','title'=> '安装', 'width'=> 100],
} else { ['field' => 'ctime','title'=> '时间', 'width'=> 150],
$res = ['code'=>-1,'msg'=>'']; ['title' => '操作', 'width'=> 150, 'align'=>'center', 'toolbar'=> '#addons-tool']
];
Cache::set('addons', $res, 600);
} else {
$res = ['code'=>-1,'msg'=>'未获取到服务器信息'];
}
} }
break; break;
} }
return json($res); return json($res);