mirror of https://gitee.com/zorlan/skycaiji
2.2
parent
6ae73277dc
commit
4214dc2899
|
@ -1,233 +1,233 @@
|
|||
<?php
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| SkyCaiji (蓝天采集器)
|
||||
|--------------------------------------------------------------------------
|
||||
| Copyright (c) 2018 https://www.skycaiji.com All rights reserved.
|
||||
|--------------------------------------------------------------------------
|
||||
| 使用协议 https://www.skycaiji.com/licenses
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
namespace skycaiji\admin\controller;
|
||||
|
||||
class App extends BaseController {
|
||||
public function manageAction(){
|
||||
$app=input('app');
|
||||
$navid=input('navid',null);
|
||||
if(empty($app)){
|
||||
$this->error('app标识错误');
|
||||
}
|
||||
$mapp=model('App');
|
||||
$appData=$mapp->getByApp($app);
|
||||
if(empty($appData)){
|
||||
$this->error('应用未安装');
|
||||
}
|
||||
$appUrl=config('root_website').'/app/'.$app.'/';
|
||||
|
||||
$navPacks=array();
|
||||
if(is_array($appData['config']['packs'])){
|
||||
$manageUrl=url('App/manage?app='.$app);
|
||||
$manageUrl.=strpos($manageUrl,'?')===false?'?':'&';
|
||||
foreach ($appData['config']['packs'] as $k=>$v){
|
||||
if($v['type']=='nav'){
|
||||
$v['nav_link']=str_replace(array('{app}','{apps}'), array(config('root_website').'/app/'.$app.'/',config('root_website').'/app/'),$v['nav_link']);
|
||||
if(!preg_match('/^\w+\:\/\//', $v['nav_link'])){
|
||||
|
||||
$v['nav_link']=$appUrl.$v['nav_link'];
|
||||
}
|
||||
|
||||
if(isset($navid)&&$navid==$k){
|
||||
|
||||
$v['is_current']=true;
|
||||
}
|
||||
$navPacks[$k]=$v;
|
||||
}
|
||||
}
|
||||
}
|
||||
$provData=null;
|
||||
$mprov=model('Provider');
|
||||
if($appData['provider_id']>0){
|
||||
$provData=$mprov->where('id',$appData['provider_id'])->find();
|
||||
}
|
||||
|
||||
$appClass=$mapp->app_class($app);
|
||||
if(is_object($appClass)){
|
||||
if(version_compare($appClass->config['version'], $appData['config']['version'],'>')===true){
|
||||
|
||||
$this->assign('newest_version',$appClass->config['version']);
|
||||
}
|
||||
|
||||
$appData['app_class']=$mapp->get_class_vars($appClass);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
$this->assign('app',$app);
|
||||
$this->assign('appUrl',$appUrl);
|
||||
$this->assign('navid',$navid);
|
||||
$this->assign('navPacks',$navPacks);
|
||||
$this->assign('appData',$appData);
|
||||
$this->assign('provData',$provData);
|
||||
return $this->fetch();
|
||||
}
|
||||
/*协议*/
|
||||
public function agreementAction(){
|
||||
$app=input('app');
|
||||
$appClass=model('App')->app_class($app);
|
||||
$this->assign('app',$app);
|
||||
$this->assign('name',$appClass->config['name']);
|
||||
$this->assign('agreement',$appClass->config['agreement']);
|
||||
|
||||
return $this->fetch('agreement');
|
||||
}
|
||||
/*安装*/
|
||||
public function installAction(){
|
||||
$app=input('app');
|
||||
$success=input('success');
|
||||
if(empty($app)){
|
||||
$this->error('app标识错误');
|
||||
}
|
||||
$mapp=model('App');
|
||||
|
||||
if(!$mapp->right_app($app)){
|
||||
$this->error('抱歉,app标识不规范!');
|
||||
}
|
||||
if($mapp->where('app',$app)->count()>0){
|
||||
$this->success('该应用已安装!','Mystore/app');
|
||||
}
|
||||
$appClass=$mapp->app_class($app);
|
||||
if(!is_object($appClass)||empty($appClass->install)){
|
||||
$this->error('不存在安装接口!');
|
||||
}
|
||||
if(!empty($appClass->config['phpv'])){
|
||||
|
||||
if(version_compare(PHP_VERSION, $appClass->config['phpv'],'<')){
|
||||
$this->error('抱歉,该应用要求PHP版本最低'.$appClass->config['phpv']);
|
||||
}
|
||||
}
|
||||
|
||||
if($appClass->install!='1'){
|
||||
|
||||
if(!$success){
|
||||
|
||||
$apiUrl=config('root_url').'/app/'.$app.'/'.$appClass->install;
|
||||
$this->assign('app',$app);
|
||||
$this->assign('op','install');
|
||||
$this->assign('apiUrl',$apiUrl);
|
||||
return $this->fetch('apiop');
|
||||
}
|
||||
}
|
||||
$newData=array(
|
||||
'app'=>$app,
|
||||
'addtime'=>time(),
|
||||
'uptime'=>time(),
|
||||
'provider_id'=>model('Provider')->getIdByUrl($appClass->config['website'])
|
||||
);
|
||||
$mapp->isUpdate(false)->allowField(true)->save($newData);
|
||||
if($mapp->id>0){
|
||||
$mapp->set_config($app,$appClass->config);
|
||||
$this->success('恭喜!安装成功','Mystore/app');
|
||||
}else{
|
||||
$this->error('安装失败!');
|
||||
}
|
||||
}
|
||||
/*卸载应用*/
|
||||
public function uninstallAction(){
|
||||
$app=input('app');
|
||||
$success=input('success');
|
||||
if(empty($app)){
|
||||
$this->error('app标识错误');
|
||||
}
|
||||
$mapp=model('App');
|
||||
|
||||
if($mapp->where('app',$app)->count()<=0){
|
||||
$this->success('该应用已卸载!','Mystore/app');
|
||||
}
|
||||
$appClass=$mapp->app_class($app);
|
||||
if(!is_object($appClass)){
|
||||
|
||||
$mapp->deleteByApp($app);
|
||||
$this->success('卸载成功');
|
||||
}
|
||||
if(empty($appClass->uninstall)){
|
||||
$this->error('不存在卸载接口!');
|
||||
}
|
||||
|
||||
if($appClass->uninstall!='1'){
|
||||
|
||||
if(!$success){
|
||||
|
||||
$apiUrl=config('root_url').'/app/'.$app.'/'.$appClass->uninstall;
|
||||
$this->assign('app',$app);
|
||||
$this->assign('op','uninstall');
|
||||
$this->assign('apiUrl',$apiUrl);
|
||||
return $this->fetch('apiop');
|
||||
}
|
||||
}
|
||||
|
||||
$mapp->deleteByApp($app);
|
||||
|
||||
$this->success('卸载成功,您可以手动删除app/'.$app.'目录彻底清除应用');
|
||||
}
|
||||
/*升级应用*/
|
||||
public function upgradeAction(){
|
||||
$app=input('app');
|
||||
$success=input('success');
|
||||
if(empty($app)){
|
||||
$this->error('app标识错误');
|
||||
}
|
||||
$mapp=model('App');
|
||||
|
||||
$appData=$mapp->getByApp($app);
|
||||
if(empty($appData)){
|
||||
$this->success('请先安装应用!','Mystore/app');
|
||||
}
|
||||
$appClass=$mapp->app_class($app);
|
||||
if(!is_object($appClass)||empty($appClass->upgrade)){
|
||||
$this->error('不存在升级接口!');
|
||||
}
|
||||
$referer=\think\Request::instance()->server('HTTP_REFERER',null,null);
|
||||
if(version_compare($appClass->config['version'], $appData['config']['version'],'=')===true){
|
||||
|
||||
$this->success('已升级!',$referer);
|
||||
}
|
||||
|
||||
if($appClass->upgrade!='1'){
|
||||
|
||||
if(!$success){
|
||||
|
||||
$apiUrl=config('root_url').'/app/'.$app.'/'.$appClass->upgrade;
|
||||
$this->assign('app',$app);
|
||||
$this->assign('op','upgrade');
|
||||
$this->assign('apiUrl',$apiUrl);
|
||||
return $this->fetch('apiop');
|
||||
}
|
||||
}
|
||||
|
||||
$mapp->strict(false)->where('app',$app)->update(array(
|
||||
'uptime'=>time(),
|
||||
'provider_id'=>model('Provider')->getIdByUrl($appClass->config['website'])
|
||||
));
|
||||
$mapp->set_config($app,$appClass->config);
|
||||
|
||||
$this->success('恭喜!升级成功',$referer);
|
||||
}
|
||||
/*开启、关闭应用*/
|
||||
public function enableAction(){
|
||||
$app=input('app');
|
||||
$enable=input('enable/d',0);
|
||||
if(empty($app)){
|
||||
$this->error('app标识错误');
|
||||
}
|
||||
$mapp=model('App');
|
||||
|
||||
$enable=$enable?1:0;
|
||||
|
||||
$mapp->set_config($app,array('enable'=>$enable));
|
||||
|
||||
$referer=\think\Request::instance()->server('HTTP_REFERER',null,null);
|
||||
$this->success('应用已'.($enable?'开启':'关闭'),$referer);
|
||||
}
|
||||
<?php
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| SkyCaiji (蓝天采集器)
|
||||
|--------------------------------------------------------------------------
|
||||
| Copyright (c) 2018 https://www.skycaiji.com All rights reserved.
|
||||
|--------------------------------------------------------------------------
|
||||
| 使用协议 https://www.skycaiji.com/licenses
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
namespace skycaiji\admin\controller;
|
||||
|
||||
class App extends BaseController {
|
||||
public function manageAction(){
|
||||
$app=input('app');
|
||||
$navid=input('navid',null);
|
||||
if(empty($app)){
|
||||
$this->error('app标识错误');
|
||||
}
|
||||
$mapp=model('App');
|
||||
$appData=$mapp->getByApp($app);
|
||||
if(empty($appData)){
|
||||
$this->error('应用未安装');
|
||||
}
|
||||
$appUrl=config('root_website').'/app/'.$app.'/';
|
||||
|
||||
$navPacks=array();
|
||||
if(is_array($appData['config']['packs'])){
|
||||
$manageUrl=url('App/manage?app='.$app);
|
||||
$manageUrl.=strpos($manageUrl,'?')===false?'?':'&';
|
||||
foreach ($appData['config']['packs'] as $k=>$v){
|
||||
if($v['type']=='nav'){
|
||||
$v['nav_link']=str_replace(array('{app}','{apps}'), array(config('root_website').'/app/'.$app.'/',config('root_website').'/app/'),$v['nav_link']);
|
||||
if(!preg_match('/^\w+\:\/\//', $v['nav_link'])){
|
||||
|
||||
$v['nav_link']=$appUrl.$v['nav_link'];
|
||||
}
|
||||
|
||||
if(isset($navid)&&$navid==$k){
|
||||
|
||||
$v['is_current']=true;
|
||||
}
|
||||
$navPacks[$k]=$v;
|
||||
}
|
||||
}
|
||||
}
|
||||
$provData=null;
|
||||
$mprov=model('Provider');
|
||||
if($appData['provider_id']>0){
|
||||
$provData=$mprov->where('id',$appData['provider_id'])->find();
|
||||
}
|
||||
|
||||
$appClass=$mapp->app_class($app);
|
||||
if(is_object($appClass)){
|
||||
if(version_compare($appClass->config['version'], $appData['config']['version'],'>')===true){
|
||||
|
||||
$this->assign('newest_version',$appClass->config['version']);
|
||||
}
|
||||
|
||||
$appData['app_class']=$mapp->get_class_vars($appClass);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
$this->assign('app',$app);
|
||||
$this->assign('appUrl',$appUrl);
|
||||
$this->assign('navid',$navid);
|
||||
$this->assign('navPacks',$navPacks);
|
||||
$this->assign('appData',$appData);
|
||||
$this->assign('provData',$provData);
|
||||
return $this->fetch();
|
||||
}
|
||||
/*协议*/
|
||||
public function agreementAction(){
|
||||
$app=input('app');
|
||||
$appClass=model('App')->app_class($app);
|
||||
$this->assign('app',$app);
|
||||
$this->assign('name',$appClass->config['name']);
|
||||
$this->assign('agreement',$appClass->config['agreement']);
|
||||
|
||||
return $this->fetch('agreement');
|
||||
}
|
||||
/*安装*/
|
||||
public function installAction(){
|
||||
$app=input('app');
|
||||
$success=input('success');
|
||||
if(empty($app)){
|
||||
$this->error('app标识错误');
|
||||
}
|
||||
$mapp=model('App');
|
||||
|
||||
if(!$mapp->right_app($app)){
|
||||
$this->error('抱歉,app标识不规范!');
|
||||
}
|
||||
if($mapp->where('app',$app)->count()>0){
|
||||
$this->success('该应用已安装!','Mystore/app');
|
||||
}
|
||||
$appClass=$mapp->app_class($app);
|
||||
if(!is_object($appClass)||empty($appClass->install)){
|
||||
$this->error('不存在安装接口!');
|
||||
}
|
||||
if(!empty($appClass->config['phpv'])){
|
||||
|
||||
if(version_compare(PHP_VERSION, $appClass->config['phpv'],'<')){
|
||||
$this->error('抱歉,该应用要求PHP版本最低'.$appClass->config['phpv']);
|
||||
}
|
||||
}
|
||||
|
||||
if($appClass->install!='1'){
|
||||
|
||||
if(!$success){
|
||||
|
||||
$apiUrl=config('root_url').'/app/'.$app.'/'.$appClass->install;
|
||||
$this->assign('app',$app);
|
||||
$this->assign('op','install');
|
||||
$this->assign('apiUrl',$apiUrl);
|
||||
return $this->fetch('apiop');
|
||||
}
|
||||
}
|
||||
$newData=array(
|
||||
'app'=>$app,
|
||||
'addtime'=>time(),
|
||||
'uptime'=>time(),
|
||||
'provider_id'=>model('Provider')->getIdByUrl($appClass->config['website'])
|
||||
);
|
||||
$mapp->isUpdate(false)->allowField(true)->save($newData);
|
||||
if($mapp->id>0){
|
||||
$mapp->set_config($app,$appClass->config);
|
||||
$this->success('恭喜!安装成功','Mystore/app');
|
||||
}else{
|
||||
$this->error('安装失败!');
|
||||
}
|
||||
}
|
||||
/*卸载应用*/
|
||||
public function uninstallAction(){
|
||||
$app=input('app');
|
||||
$success=input('success');
|
||||
if(empty($app)){
|
||||
$this->error('app标识错误');
|
||||
}
|
||||
$mapp=model('App');
|
||||
|
||||
if($mapp->where('app',$app)->count()<=0){
|
||||
$this->success('该应用已卸载!','Mystore/app');
|
||||
}
|
||||
$appClass=$mapp->app_class($app);
|
||||
if(!is_object($appClass)){
|
||||
|
||||
$mapp->deleteByApp($app);
|
||||
$this->success('卸载成功');
|
||||
}
|
||||
if(empty($appClass->uninstall)){
|
||||
$this->error('不存在卸载接口!');
|
||||
}
|
||||
|
||||
if($appClass->uninstall!='1'){
|
||||
|
||||
if(!$success){
|
||||
|
||||
$apiUrl=config('root_url').'/app/'.$app.'/'.$appClass->uninstall;
|
||||
$this->assign('app',$app);
|
||||
$this->assign('op','uninstall');
|
||||
$this->assign('apiUrl',$apiUrl);
|
||||
return $this->fetch('apiop');
|
||||
}
|
||||
}
|
||||
|
||||
$mapp->deleteByApp($app);
|
||||
|
||||
$this->success('卸载成功,您可以手动删除app/'.$app.'目录彻底清除应用');
|
||||
}
|
||||
/*升级应用*/
|
||||
public function upgradeAction(){
|
||||
$app=input('app');
|
||||
$success=input('success');
|
||||
if(empty($app)){
|
||||
$this->error('app标识错误');
|
||||
}
|
||||
$mapp=model('App');
|
||||
|
||||
$appData=$mapp->getByApp($app);
|
||||
if(empty($appData)){
|
||||
$this->success('请先安装应用!','Mystore/app');
|
||||
}
|
||||
$appClass=$mapp->app_class($app);
|
||||
if(!is_object($appClass)||empty($appClass->upgrade)){
|
||||
$this->error('不存在升级接口!');
|
||||
}
|
||||
$referer=\think\Request::instance()->server('HTTP_REFERER',null,null);
|
||||
if(version_compare($appClass->config['version'], $appData['config']['version'],'=')===true){
|
||||
|
||||
$this->success('已升级!',$referer);
|
||||
}
|
||||
|
||||
if($appClass->upgrade!='1'){
|
||||
|
||||
if(!$success){
|
||||
|
||||
$apiUrl=config('root_url').'/app/'.$app.'/'.$appClass->upgrade;
|
||||
$this->assign('app',$app);
|
||||
$this->assign('op','upgrade');
|
||||
$this->assign('apiUrl',$apiUrl);
|
||||
return $this->fetch('apiop');
|
||||
}
|
||||
}
|
||||
|
||||
$mapp->strict(false)->where('app',$app)->update(array(
|
||||
'uptime'=>time(),
|
||||
'provider_id'=>model('Provider')->getIdByUrl($appClass->config['website'])
|
||||
));
|
||||
$mapp->set_config($app,$appClass->config);
|
||||
|
||||
$this->success('恭喜!升级成功',$referer);
|
||||
}
|
||||
/*开启、关闭应用*/
|
||||
public function enableAction(){
|
||||
$app=input('app');
|
||||
$enable=input('enable/d',0);
|
||||
if(empty($app)){
|
||||
$this->error('app标识错误');
|
||||
}
|
||||
$mapp=model('App');
|
||||
|
||||
$enable=$enable?1:0;
|
||||
|
||||
$mapp->set_config($app,array('enable'=>$enable));
|
||||
|
||||
$referer=\think\Request::instance()->server('HTTP_REFERER',null,null);
|
||||
$this->success('应用已'.($enable?'开启':'关闭'),$referer);
|
||||
}
|
||||
}
|
|
@ -1,143 +1,143 @@
|
|||
<?php
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| SkyCaiji (蓝天采集器)
|
||||
|--------------------------------------------------------------------------
|
||||
| Copyright (c) 2018 https://www.skycaiji.com All rights reserved.
|
||||
|--------------------------------------------------------------------------
|
||||
| 使用协议 https://www.skycaiji.com/licenses
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
namespace skycaiji\admin\controller;
|
||||
|
||||
class Provider extends BaseController {
|
||||
/*第三方平台*/
|
||||
public function listAction(){
|
||||
$url=input('url');
|
||||
$title=input('title');
|
||||
|
||||
$mprovider=model('Provider');
|
||||
|
||||
$cond=array();
|
||||
if(!empty($url)){
|
||||
$cond['url']=array('like','%'.$url.'%');
|
||||
}
|
||||
if(!empty($title)){
|
||||
$cond['title']=array('like','%'.$title.'%');
|
||||
}
|
||||
|
||||
$list=$mprovider->where($cond)->order('sort desc')->paginate(20,false,paginate_auto_config());
|
||||
$pagenav=$list->render();
|
||||
$list=$list->all();
|
||||
|
||||
$GLOBALS['content_header']='第三方平台';
|
||||
$GLOBALS['breadcrumb']=breadcrumb(array('第三方平台'));
|
||||
|
||||
$this->assign('list',$list);
|
||||
$this->assign('pagenav',$pagenav);
|
||||
|
||||
return $this->fetch();
|
||||
}
|
||||
public function deleteAction(){
|
||||
$id=input('id/d');
|
||||
if(empty($id)){
|
||||
$this->error('id不存在');
|
||||
}
|
||||
$mprovider=model('Provider');
|
||||
$mprovider->where('id',$id)->delete();
|
||||
|
||||
$this->success();
|
||||
}
|
||||
public function enableAction(){
|
||||
$id=input('id/d');
|
||||
$enable=input('enable/d');
|
||||
if(empty($id)){
|
||||
$this->error('id不存在');
|
||||
}
|
||||
$mprovider=model('Provider');
|
||||
$mprovider->strict(false)->where('id',$id)->update(array('enable'=>$enable));
|
||||
|
||||
$this->success();
|
||||
}
|
||||
public function saveAction(){
|
||||
$id=input('id/d');
|
||||
$mprovider=model('Provider');
|
||||
if($id>0){
|
||||
$proData=$mprovider->where('id',$id)->find();
|
||||
if(!empty($proData)){
|
||||
$proData=$proData->toArray();
|
||||
}
|
||||
$this->assign('proData',$proData);
|
||||
}
|
||||
if(request()->isPost()){
|
||||
$url=input('url','','strip_tags');
|
||||
$title=input('title');
|
||||
$sort=input('sort/d',0);
|
||||
$enable=input('enable/d',0);
|
||||
|
||||
$domain=\skycaiji\admin\model\Provider::matchDomain($url);
|
||||
if(empty($domain)){
|
||||
$this->error('网址格式错误');
|
||||
}
|
||||
|
||||
if(empty($proData)||strcasecmp($proData['url'], $url)!==0){
|
||||
|
||||
if($mprovider->where('url',$url)->count()>0){
|
||||
|
||||
$this->error('该网址已存在');
|
||||
}
|
||||
}
|
||||
|
||||
$domainCond=array(
|
||||
'domain'=>$domain
|
||||
);
|
||||
if(!empty($proData)){
|
||||
$domainCond['id']=array('<>',$proData['id']);
|
||||
}
|
||||
if($mprovider->where($domainCond)->count()>0){
|
||||
|
||||
$this->error($domain.' 域名已存在');
|
||||
}
|
||||
|
||||
if(empty($title)){
|
||||
$html=get_html($url,null,array('timeout'=>3));
|
||||
if(preg_match('/<title[^<>]*>(.*?)<\/title>/i', $html,$title)){
|
||||
$title=strip_tags($title[1]);
|
||||
}else{
|
||||
$title='';
|
||||
}
|
||||
}
|
||||
|
||||
$newData=array(
|
||||
'url'=>$url,
|
||||
'title'=>$title,
|
||||
'domain'=>$domain,
|
||||
'enable'=>$enable,
|
||||
'sort'=>$sort
|
||||
);
|
||||
if(empty($proData)){
|
||||
|
||||
$mprovider->isUpdate(false)->allowField(true)->save($newData);
|
||||
$this->success('添加成功','Provider/list');
|
||||
}else{
|
||||
|
||||
$mprovider->strict(false)->where('id',$id)->update($newData);
|
||||
$this->success('修改成功','Provider/list');
|
||||
}
|
||||
}else{
|
||||
return $this->fetch();
|
||||
}
|
||||
}
|
||||
|
||||
public function saveallAction(){
|
||||
$newsort=input('newsort/a');
|
||||
$mprovider=model('Provider');
|
||||
if(is_array($newsort)&&count($newsort)>0){
|
||||
foreach ($newsort as $key=>$val){
|
||||
$mprovider->strict(false)->where('id',intval($key))->update(array('sort'=>intval($val)));
|
||||
}
|
||||
}
|
||||
$this->success('保存成功','Provider/list');
|
||||
}
|
||||
<?php
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| SkyCaiji (蓝天采集器)
|
||||
|--------------------------------------------------------------------------
|
||||
| Copyright (c) 2018 https://www.skycaiji.com All rights reserved.
|
||||
|--------------------------------------------------------------------------
|
||||
| 使用协议 https://www.skycaiji.com/licenses
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
namespace skycaiji\admin\controller;
|
||||
|
||||
class Provider extends BaseController {
|
||||
/*第三方平台*/
|
||||
public function listAction(){
|
||||
$url=input('url');
|
||||
$title=input('title');
|
||||
|
||||
$mprovider=model('Provider');
|
||||
|
||||
$cond=array();
|
||||
if(!empty($url)){
|
||||
$cond['url']=array('like','%'.$url.'%');
|
||||
}
|
||||
if(!empty($title)){
|
||||
$cond['title']=array('like','%'.$title.'%');
|
||||
}
|
||||
|
||||
$list=$mprovider->where($cond)->order('sort desc')->paginate(20,false,paginate_auto_config());
|
||||
$pagenav=$list->render();
|
||||
$list=$list->all();
|
||||
|
||||
$GLOBALS['content_header']='第三方平台';
|
||||
$GLOBALS['breadcrumb']=breadcrumb(array('第三方平台'));
|
||||
|
||||
$this->assign('list',$list);
|
||||
$this->assign('pagenav',$pagenav);
|
||||
|
||||
return $this->fetch();
|
||||
}
|
||||
public function deleteAction(){
|
||||
$id=input('id/d');
|
||||
if(empty($id)){
|
||||
$this->error('id不存在');
|
||||
}
|
||||
$mprovider=model('Provider');
|
||||
$mprovider->where('id',$id)->delete();
|
||||
|
||||
$this->success();
|
||||
}
|
||||
public function enableAction(){
|
||||
$id=input('id/d');
|
||||
$enable=input('enable/d');
|
||||
if(empty($id)){
|
||||
$this->error('id不存在');
|
||||
}
|
||||
$mprovider=model('Provider');
|
||||
$mprovider->strict(false)->where('id',$id)->update(array('enable'=>$enable));
|
||||
|
||||
$this->success();
|
||||
}
|
||||
public function saveAction(){
|
||||
$id=input('id/d');
|
||||
$mprovider=model('Provider');
|
||||
if($id>0){
|
||||
$proData=$mprovider->where('id',$id)->find();
|
||||
if(!empty($proData)){
|
||||
$proData=$proData->toArray();
|
||||
}
|
||||
$this->assign('proData',$proData);
|
||||
}
|
||||
if(request()->isPost()){
|
||||
$url=input('url','','strip_tags');
|
||||
$title=input('title');
|
||||
$sort=input('sort/d',0);
|
||||
$enable=input('enable/d',0);
|
||||
|
||||
$domain=\skycaiji\admin\model\Provider::matchDomain($url);
|
||||
if(empty($domain)){
|
||||
$this->error('网址格式错误');
|
||||
}
|
||||
|
||||
if(empty($proData)||strcasecmp($proData['url'], $url)!==0){
|
||||
|
||||
if($mprovider->where('url',$url)->count()>0){
|
||||
|
||||
$this->error('该网址已存在');
|
||||
}
|
||||
}
|
||||
|
||||
$domainCond=array(
|
||||
'domain'=>$domain
|
||||
);
|
||||
if(!empty($proData)){
|
||||
$domainCond['id']=array('<>',$proData['id']);
|
||||
}
|
||||
if($mprovider->where($domainCond)->count()>0){
|
||||
|
||||
$this->error($domain.' 域名已存在');
|
||||
}
|
||||
|
||||
if(empty($title)){
|
||||
$html=get_html($url,null,array('timeout'=>3));
|
||||
if(preg_match('/<title[^<>]*>(.*?)<\/title>/i', $html,$title)){
|
||||
$title=strip_tags($title[1]);
|
||||
}else{
|
||||
$title='';
|
||||
}
|
||||
}
|
||||
|
||||
$newData=array(
|
||||
'url'=>$url,
|
||||
'title'=>$title,
|
||||
'domain'=>$domain,
|
||||
'enable'=>$enable,
|
||||
'sort'=>$sort
|
||||
);
|
||||
if(empty($proData)){
|
||||
|
||||
$mprovider->isUpdate(false)->allowField(true)->save($newData);
|
||||
$this->success('添加成功','Provider/list');
|
||||
}else{
|
||||
|
||||
$mprovider->strict(false)->where('id',$id)->update($newData);
|
||||
$this->success('修改成功','Provider/list');
|
||||
}
|
||||
}else{
|
||||
return $this->fetch();
|
||||
}
|
||||
}
|
||||
|
||||
public function saveallAction(){
|
||||
$newsort=input('newsort/a');
|
||||
$mprovider=model('Provider');
|
||||
if(is_array($newsort)&&count($newsort)>0){
|
||||
foreach ($newsort as $key=>$val){
|
||||
$mprovider->strict(false)->where('id',intval($key))->update(array('sort'=>intval($val)));
|
||||
}
|
||||
}
|
||||
$this->success('保存成功','Provider/list');
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -1,43 +1,43 @@
|
|||
<?php
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| SkyCaiji (蓝天采集器)
|
||||
|--------------------------------------------------------------------------
|
||||
| Copyright (c) 2018 https://www.skycaiji.com All rights reserved.
|
||||
|--------------------------------------------------------------------------
|
||||
| 使用协议 https://www.skycaiji.com/licenses
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
<?php
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| SkyCaiji (蓝天采集器)
|
||||
|--------------------------------------------------------------------------
|
||||
| Copyright (c) 2018 https://www.skycaiji.com All rights reserved.
|
||||
|--------------------------------------------------------------------------
|
||||
| 使用协议 https://www.skycaiji.com/licenses
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
namespace skycaiji\admin\model;
|
||||
|
||||
class App extends BaseModel{
|
||||
/*检测是否是应用并获取配置文件实例化*/
|
||||
public function app_class($app,$includeClass=true){
|
||||
static $passPaths=array('.','..','common','admin','skycaiji','vendor');
|
||||
static $passPaths=array('.','..','common','admin','skycaiji','vendor');
|
||||
if($this->right_app($app)){
|
||||
|
||||
$path=realpath(config('apps_path').'/'.$app);
|
||||
|
||||
$path=realpath(config('apps_path').'/'.$app);
|
||||
if(!empty($path)&&is_dir($path)){
|
||||
$appFilename=$this->app_class_file($app);
|
||||
if(!in_array($app,$passPaths)&&file_exists($appFilename)){
|
||||
|
||||
|
||||
if($includeClass){
|
||||
|
||||
|
||||
include $appFilename;
|
||||
$appClass=new $app();
|
||||
}else{
|
||||
|
||||
|
||||
$appFile=file_get_contents($appFilename);
|
||||
if(!empty($appFile)){
|
||||
$appClass=new \stdClass();
|
||||
if(preg_match('/public\s*\$config\s*=(\s*[\s\S]+?[\]\)]\s*\;)/i', $appFile,$config)){
|
||||
|
||||
set_error_handler(null);
|
||||
|
||||
set_error_handler(null);
|
||||
|
||||
$config=trim($config[1]);
|
||||
try {
|
||||
$config=@eval('return '.$config);
|
||||
$config=@eval('return '.$config);
|
||||
}catch(\Exception $e){
|
||||
$config=array();
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ class App extends BaseModel{
|
|||
}
|
||||
|
||||
if($appClass){
|
||||
$appClass->config=$this->clear_config($appClass->config);
|
||||
$appClass->config=$this->clear_config($appClass->config);
|
||||
return $appClass;
|
||||
}
|
||||
}
|
||||
|
@ -68,17 +68,17 @@ class App extends BaseModel{
|
|||
public function deleteByApp($app){
|
||||
if($app){
|
||||
$this->where('app',$app)->delete();
|
||||
$this->delete_config($app);
|
||||
$this->delete_config($app);
|
||||
}
|
||||
}
|
||||
/*应用配置文件名*/
|
||||
public function app_class_file($app){
|
||||
return realpath(config('apps_path')).DIRECTORY_SEPARATOR.$app.DIRECTORY_SEPARATOR.$app.'.php';
|
||||
return realpath(config('apps_path')).DIRECTORY_SEPARATOR.$app.DIRECTORY_SEPARATOR.$app.'.php';
|
||||
}
|
||||
|
||||
/*应用命名规范*/
|
||||
public function right_app($app){
|
||||
|
||||
|
||||
if(preg_match('/^[a-z]+[a-z\_0-9]*$/', $app)){
|
||||
return strlen($app)<3?false:true;
|
||||
}else{
|
||||
|
@ -104,9 +104,9 @@ class App extends BaseModel{
|
|||
}
|
||||
/*清理描述html*/
|
||||
public function clear_desc($desc){
|
||||
$desc=strip_tags($desc,'<p><br><b><i><a>');
|
||||
$desc=preg_replace('/<(p|br|b|i)\s+.*?>/i', "<$1>", $desc);
|
||||
$desc=preg_replace('/[\r\n]+/', ' ', $desc);
|
||||
$desc=strip_tags($desc,'<p><br><b><i><a>');
|
||||
$desc=preg_replace('/<(p|br|b|i)\s+.*?>/i', "<$1>", $desc);
|
||||
$desc=preg_replace('/[\r\n]+/', ' ', $desc);
|
||||
$desc=trim($desc);
|
||||
return $desc;
|
||||
}
|
||||
|
@ -117,7 +117,7 @@ class App extends BaseModel{
|
|||
$arr=$this->_array_map('strip_tags', $arr);
|
||||
$arr['desc']=$desc;
|
||||
if(!empty($arr['agreement'])){
|
||||
$arr['agreement']=preg_replace('/^[\s]+/m', '', $arr['agreement']);
|
||||
$arr['agreement']=preg_replace('/^[\s]+/m', '', $arr['agreement']);
|
||||
}
|
||||
return $arr;
|
||||
}
|
||||
|
@ -128,10 +128,10 @@ class App extends BaseModel{
|
|||
}
|
||||
$config=is_array($config)?$config:array();
|
||||
$filename=$this->config_filename($app);
|
||||
$oldConfig=$this->get_config($app);
|
||||
$oldConfig=$this->get_config($app);
|
||||
$oldConfig=is_array($oldConfig)?$oldConfig:array();
|
||||
|
||||
$config=array_merge($oldConfig,$config);
|
||||
$config=array_merge($oldConfig,$config);
|
||||
$config=$this->clear_config($config);
|
||||
|
||||
$config=var_export($config,true);
|
||||
|
@ -144,7 +144,7 @@ class App extends BaseModel{
|
|||
$filename=$this->config_filename($app);
|
||||
$config=array();
|
||||
if(file_exists($filename)){
|
||||
|
||||
|
||||
$config=include $filename;
|
||||
$config=is_array($config)?$config:array();
|
||||
}
|
||||
|
@ -170,7 +170,7 @@ class App extends BaseModel{
|
|||
return $arr;
|
||||
}
|
||||
public function config_filename($app){
|
||||
return config('apps_path').'/app/config/'.$app.'.php';
|
||||
return config('apps_path').'/app/config/'.$app.'.php';
|
||||
}
|
||||
/*获取应用类的变量*/
|
||||
public function get_class_vars($appClass){
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
<?php
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| SkyCaiji (蓝天采集器)
|
||||
|--------------------------------------------------------------------------
|
||||
| Copyright (c) 2018 https://www.skycaiji.com All rights reserved.
|
||||
|--------------------------------------------------------------------------
|
||||
| 使用协议 https://www.skycaiji.com/licenses
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
<?php
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| SkyCaiji (蓝天采集器)
|
||||
|--------------------------------------------------------------------------
|
||||
| Copyright (c) 2018 https://www.skycaiji.com All rights reserved.
|
||||
|--------------------------------------------------------------------------
|
||||
| 使用协议 https://www.skycaiji.com/licenses
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
namespace skycaiji\admin\model;
|
||||
/*第三方服务商*/
|
||||
|
@ -26,7 +26,7 @@ class Provider extends BaseModel{
|
|||
public function getIdByUrl($url){
|
||||
$url=self::matchDomain($url);
|
||||
if(is_official_url($url)){
|
||||
|
||||
|
||||
$url=null;
|
||||
}
|
||||
$id=0;
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
<textarea id="win_txt_agreement">{$agreement}</textarea>
|
||||
<script type="text/javascript">
|
||||
(function(){
|
||||
modal('“{$name}({$app})”使用协议','<pre style="max-height:400px;">'+$('#win_txt_agreement').val()+'</pre>',{lg:1});
|
||||
$('#myModal .modal-footer .close').addClass('btn btn-default').removeClass('close');
|
||||
$('#myModal .modal-footer').prepend('<button type="button" class="btn btn-success btn-agreement" data-dismiss="modal">同意</button>');
|
||||
$('#myModal .modal-footer .btn-agreement').bind('click',function(){
|
||||
windowModal('正在安装...',"{:url('Admin/App/install?app='.$app)}");
|
||||
});
|
||||
})();
|
||||
<textarea id="win_txt_agreement">{$agreement}</textarea>
|
||||
<script type="text/javascript">
|
||||
(function(){
|
||||
modal('“{$name}({$app})”使用协议','<pre style="max-height:400px;">'+$('#win_txt_agreement').val()+'</pre>',{lg:1});
|
||||
$('#myModal .modal-footer .close').addClass('btn btn-default').removeClass('close');
|
||||
$('#myModal .modal-footer').prepend('<button type="button" class="btn btn-success btn-agreement" data-dismiss="modal">同意</button>');
|
||||
$('#myModal .modal-footer .btn-agreement').bind('click',function(){
|
||||
windowModal('正在安装...',"{:url('Admin/App/install?app='.$app)}");
|
||||
});
|
||||
})();
|
||||
</script>
|
|
@ -1,59 +1,59 @@
|
|||
<script type="text/javascript">
|
||||
'use strict';
|
||||
function apiop_show_msg(msg,success){
|
||||
$('#myModal').modal('hide');//隐藏
|
||||
if(success){
|
||||
toastr.success(msg);
|
||||
}else{
|
||||
toastr.error(msg);
|
||||
}
|
||||
}
|
||||
(function(){
|
||||
var apiName={'install':'安装','uninstall':'卸载','upgrade':'升级'};
|
||||
var apiUrl='{$apiUrl}';
|
||||
var op='{$op}';
|
||||
$.ajax({
|
||||
type:'get',
|
||||
dataType:'json',
|
||||
url:apiUrl,
|
||||
success:function(data){
|
||||
if(typeof(data)=='object'){
|
||||
if(data.status==1){
|
||||
//接口执行成功
|
||||
$.ajax({
|
||||
type:'get',
|
||||
dataType:'json',
|
||||
url:"{:url('App/'.$op.'?success=1&app='.$app)}",
|
||||
success:function(data){
|
||||
if(data.code){
|
||||
//操作成功
|
||||
apiop_show_msg(data.msg,true);
|
||||
if(data.url){
|
||||
setTimeout("window.location.href='"+data.url+"';",2500);
|
||||
}else{
|
||||
setTimeout("window.location.reload()",2500);
|
||||
}
|
||||
}else{
|
||||
//失败
|
||||
apiop_show_msg(data.msg,false);
|
||||
}
|
||||
},
|
||||
error:function(){
|
||||
apiop_show_msg(apiName[op]+'操作失败,请重试!',false);
|
||||
}
|
||||
});
|
||||
}else{
|
||||
//失败
|
||||
var msg=data.info?data.info:(apiName[op]+'失败');
|
||||
apiop_show_msg(msg,false);
|
||||
}
|
||||
}else{
|
||||
apiop_show_msg('返回的不是JSON数据',false);
|
||||
}
|
||||
},
|
||||
error:function(){
|
||||
apiop_show_msg(apiName[op]+'接口运行失败!',false);
|
||||
}
|
||||
});
|
||||
})();
|
||||
<script type="text/javascript">
|
||||
'use strict';
|
||||
function apiop_show_msg(msg,success){
|
||||
$('#myModal').modal('hide');//隐藏
|
||||
if(success){
|
||||
toastr.success(msg);
|
||||
}else{
|
||||
toastr.error(msg);
|
||||
}
|
||||
}
|
||||
(function(){
|
||||
var apiName={'install':'安装','uninstall':'卸载','upgrade':'升级'};
|
||||
var apiUrl='{$apiUrl}';
|
||||
var op='{$op}';
|
||||
$.ajax({
|
||||
type:'get',
|
||||
dataType:'json',
|
||||
url:apiUrl,
|
||||
success:function(data){
|
||||
if(typeof(data)=='object'){
|
||||
if(data.status==1){
|
||||
//接口执行成功
|
||||
$.ajax({
|
||||
type:'get',
|
||||
dataType:'json',
|
||||
url:"{:url('App/'.$op.'?success=1&app='.$app)}",
|
||||
success:function(data){
|
||||
if(data.code){
|
||||
//操作成功
|
||||
apiop_show_msg(data.msg,true);
|
||||
if(data.url){
|
||||
setTimeout("window.location.href='"+data.url+"';",2500);
|
||||
}else{
|
||||
setTimeout("window.location.reload()",2500);
|
||||
}
|
||||
}else{
|
||||
//失败
|
||||
apiop_show_msg(data.msg,false);
|
||||
}
|
||||
},
|
||||
error:function(){
|
||||
apiop_show_msg(apiName[op]+'操作失败,请重试!',false);
|
||||
}
|
||||
});
|
||||
}else{
|
||||
//失败
|
||||
var msg=data.info?data.info:(apiName[op]+'失败');
|
||||
apiop_show_msg(msg,false);
|
||||
}
|
||||
}else{
|
||||
apiop_show_msg('返回的不是JSON数据',false);
|
||||
}
|
||||
},
|
||||
error:function(){
|
||||
apiop_show_msg(apiName[op]+'接口运行失败!',false);
|
||||
}
|
||||
});
|
||||
})();
|
||||
</script>
|
|
@ -1,68 +1,68 @@
|
|||
{extend name="common:main" /}
|
||||
{block name="cssjs"}
|
||||
<link rel="stylesheet" href="__PUBLIC__/static/css/app.css?{$Think.config.html_v}" />
|
||||
<script src="__PUBLIC__/static/js/admin/app.js?{$Think.config.html_v}"></script>
|
||||
{/block}
|
||||
{block name="content"}
|
||||
<ul class="manage-nav">
|
||||
<li><a href="{:url('Admin/Mystore/app')}" class="glyphicon glyphicon-list" title="应用列表"></a></li>
|
||||
<li{if !isset($navid)} class="active"{/if}><a href="{:url('App/manage?app='.$app)}">应用详细</a></li>
|
||||
{foreach $navPacks as $k=>$v}
|
||||
<li{$v['is_current']?' class="active"':''}><a href="{:url('App/manage?app='.$app.'&navid='.$k)}" data-url="{$v['nav_link']}"{if $v['target']} target="_blank"{/if}>{$v['name']}</a></li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
{if !isset($navid)}
|
||||
<dl class="dl-info" style="margin-left:20px;margin-top:5px;">
|
||||
<dt>启用</dt>
|
||||
<dd>
|
||||
<a href="javascript:;" id="enable" data-app="{$appData['app']}" data-enable="{$appData['config']['enable']}">{$appData['config']['enable']?'已开启':'已关闭'}</a>
|
||||
</dd>
|
||||
<dt>名称</dt>
|
||||
<dd>{$appData['config']['name']}</dd>
|
||||
<dt>标识</dt>
|
||||
<dd>{$appData['app']}</dd>
|
||||
<dt>版本</dt>
|
||||
<dd>
|
||||
{$appData['config']['version']}
|
||||
{if $newest_version}
|
||||
<a href="javascript:;" id="newest_version" data-app="{$appData['app']}">新版本{$newest_version}</a>
|
||||
{/if}
|
||||
</dd>
|
||||
<dt>框架</dt>
|
||||
<dd>{$appData['config']['framework']?($appData['config']['framework'].$appData['config']['framework_version']):'自定义'}</dd>
|
||||
{if !empty($appData['config']['phpv'])}
|
||||
<dt>PHP</dt>
|
||||
<dd>最低要求php{$appData['config']['phpv']}版本</dd>
|
||||
{/if}
|
||||
<dt>首页</dt>
|
||||
<dd>
|
||||
<a href="{$appUrl}" target="_blank">应用首页</a>
|
||||
</dd>
|
||||
{if !empty($appData['config']['author'])}
|
||||
<dt>作者</dt>
|
||||
<dd>{$appData['config']['author']}</dd>
|
||||
{/if}
|
||||
{if !empty($provData)}
|
||||
<dt>平台</dt>
|
||||
<dd><a href="{:url('admin/store/index?url='.urlencode($provData['url']))}">第三方平台</a></dd>
|
||||
{elseif !empty($appData['config']['website'])}
|
||||
<dt>网站</dt>
|
||||
<dd><a href="{$appData['config']['website']}" target="_blank">作者网站</a></dd>
|
||||
{/if}
|
||||
{if $appData['config']['desc']}
|
||||
<dt>描述</dt>
|
||||
<dd>{$appData['config']['desc']}</dd>
|
||||
{/if}
|
||||
<dt>开发</dt>
|
||||
<dd><a href="{:url('Develop/app?app='.$app)}" class="develop">开发应用</a></dd>
|
||||
</dl>
|
||||
{else /}
|
||||
<div class="manage-wrap">
|
||||
<div class="iframe-loading"><div class="loading"> </div>页面加载中...</div>
|
||||
<iframe src="{$navPacks[$navid]['nav_link']}" id="iframe_main" class="iframe-main" width="100%" height="100%" frameborder="0" scrolling="yes"></iframe>
|
||||
</div>
|
||||
{/if}
|
||||
<script type="text/javascript">
|
||||
appClass.init_manage();
|
||||
</script>
|
||||
{extend name="common:main" /}
|
||||
{block name="cssjs"}
|
||||
<link rel="stylesheet" href="__PUBLIC__/static/css/app.css?{$Think.config.html_v}" />
|
||||
<script src="__PUBLIC__/static/js/admin/app.js?{$Think.config.html_v}"></script>
|
||||
{/block}
|
||||
{block name="content"}
|
||||
<ul class="manage-nav">
|
||||
<li><a href="{:url('Admin/Mystore/app')}" class="glyphicon glyphicon-list" title="应用列表"></a></li>
|
||||
<li{if !isset($navid)} class="active"{/if}><a href="{:url('App/manage?app='.$app)}">应用详细</a></li>
|
||||
{foreach $navPacks as $k=>$v}
|
||||
<li{$v['is_current']?' class="active"':''}><a href="{:url('App/manage?app='.$app.'&navid='.$k)}" data-url="{$v['nav_link']}"{if $v['target']} target="_blank"{/if}>{$v['name']}</a></li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
{if !isset($navid)}
|
||||
<dl class="dl-info" style="margin-left:20px;margin-top:5px;">
|
||||
<dt>启用</dt>
|
||||
<dd>
|
||||
<a href="javascript:;" id="enable" data-app="{$appData['app']}" data-enable="{$appData['config']['enable']}">{$appData['config']['enable']?'已开启':'已关闭'}</a>
|
||||
</dd>
|
||||
<dt>名称</dt>
|
||||
<dd>{$appData['config']['name']}</dd>
|
||||
<dt>标识</dt>
|
||||
<dd>{$appData['app']}</dd>
|
||||
<dt>版本</dt>
|
||||
<dd>
|
||||
{$appData['config']['version']}
|
||||
{if $newest_version}
|
||||
<a href="javascript:;" id="newest_version" data-app="{$appData['app']}">新版本{$newest_version}</a>
|
||||
{/if}
|
||||
</dd>
|
||||
<dt>框架</dt>
|
||||
<dd>{$appData['config']['framework']?($appData['config']['framework'].$appData['config']['framework_version']):'自定义'}</dd>
|
||||
{if !empty($appData['config']['phpv'])}
|
||||
<dt>PHP</dt>
|
||||
<dd>最低要求php{$appData['config']['phpv']}版本</dd>
|
||||
{/if}
|
||||
<dt>首页</dt>
|
||||
<dd>
|
||||
<a href="{$appUrl}" target="_blank">应用首页</a>
|
||||
</dd>
|
||||
{if !empty($appData['config']['author'])}
|
||||
<dt>作者</dt>
|
||||
<dd>{$appData['config']['author']}</dd>
|
||||
{/if}
|
||||
{if !empty($provData)}
|
||||
<dt>平台</dt>
|
||||
<dd><a href="{:url('admin/store/index?url='.urlencode($provData['url']))}">第三方平台</a></dd>
|
||||
{elseif !empty($appData['config']['website'])}
|
||||
<dt>网站</dt>
|
||||
<dd><a href="{$appData['config']['website']}" target="_blank">作者网站</a></dd>
|
||||
{/if}
|
||||
{if $appData['config']['desc']}
|
||||
<dt>描述</dt>
|
||||
<dd>{$appData['config']['desc']}</dd>
|
||||
{/if}
|
||||
<dt>开发</dt>
|
||||
<dd><a href="{:url('Develop/app?app='.$app)}" class="develop">开发应用</a></dd>
|
||||
</dl>
|
||||
{else /}
|
||||
<div class="manage-wrap">
|
||||
<div class="iframe-loading"><div class="loading"> </div>页面加载中...</div>
|
||||
<iframe src="{$navPacks[$navid]['nav_link']}" id="iframe_main" class="iframe-main" width="100%" height="100%" frameborder="0" scrolling="yes"></iframe>
|
||||
</div>
|
||||
{/if}
|
||||
<script type="text/javascript">
|
||||
appClass.init_manage();
|
||||
</script>
|
||||
{/block}
|
|
@ -1,156 +1,156 @@
|
|||
{extend name="common:main" /}
|
||||
{block name="cssjs"}
|
||||
<script type="text/javascript" src="__PUBLIC__/static/js/admin/develop.js?{$Think.config.html_v}"></script>
|
||||
{/block}
|
||||
{block name="content"}
|
||||
<div class="box box-default">
|
||||
<div class="box-body">
|
||||
<form id="form_app" method="post" ajax-submit="true" action="{:url('Admin/Develop/app')}">
|
||||
{if !empty($appData)}
|
||||
<input type="hidden" name="edit" value="1" />
|
||||
<input type="hidden" name="app" value="{$appData['app']}" />
|
||||
{/if}
|
||||
|
||||
{if $newest_version}
|
||||
<div class="alert alert-warning" role="alert">
|
||||
检测到新版本{$newest_version},<a href="javascript:;" id="newest_version">点击升级</a>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<div class="form-group">
|
||||
<label>app标识</label>
|
||||
{if !empty($appData)}
|
||||
<input type="text" value="{$appData['app']}" class="form-control" disabled="disabled">
|
||||
{else /}
|
||||
<input type="text" name="app" class="form-control">
|
||||
{/if}
|
||||
<p class="help-block">标识可由小写字母、下划线、数字组成,长度3个字符以上且以字母开头,建议加入自己的版权以区别他人的应用</p>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>PHP框架</label>
|
||||
{if $appFrameworkPath}
|
||||
<input type="hidden" name="framework" value="{$appData['config']['framework']}" />
|
||||
<input type="hidden" name="framework_version[{$appData['config']['framework']}]" value="{$appData['config']['framework_version']}" />
|
||||
<input type="text" value="{$appData['config']['framework']}{$appData['config']['framework_version']}" class="form-control" disabled="disabled">
|
||||
<p class="help-block">如需修改框架,请先删除:{$appFrameworkPath}</p>
|
||||
{else /}
|
||||
<select name="framework" class="form-control">
|
||||
<option value="">自定义</option>
|
||||
{foreach $frameworks as $fmw=>$vers}
|
||||
<option value="{$fmw}">{$fmw}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
{foreach $frameworks as $fmw=>$vers}
|
||||
<div class="input-group" style="margin-top:5px;display:none;" id="framework_vers_{$fmw}">
|
||||
{foreach $vers as $ver}
|
||||
<label class="radio-inline"><input type="radio" name="framework_version[{$fmw}]" value="{$ver}"> {$ver}</label>
|
||||
{/foreach}
|
||||
</div>
|
||||
{/foreach}
|
||||
<div class="help-block">
|
||||
使用php框架开发该应用
|
||||
{if !empty($appData['config']['framework'])&&empty($appFrameworkPath)}
|
||||
<button id="install_framework" type="button" class="btn btn-xs btn-warning">安装框架{$appData['config']['framework']}{$appData['config']['framework_version']}</button> 注意安装框架将会初始化应用,如应用中存在项目文件请先备份以防丢失!
|
||||
<div id="install_framework_error"></div>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>名称</label>
|
||||
<input type="text" name="name" class="form-control">
|
||||
<p class="help-block">应用的中文名称</p>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>版本号</label>
|
||||
<input type="text" name="version" class="form-control">
|
||||
<p class="help-block">应用版本号标准格式:x.x或x.x.x(x为数字最多两位数)版本号高于旧版本时会提示升级</p>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>描述</label>
|
||||
<textarea name="desc" class="form-control"></textarea>
|
||||
<p class="help-block">可以使用<p><br><b><i><a>标签</p>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>作者</label>
|
||||
<input type="text" name="author" class="form-control" placeholder="选填">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>平台网址</label>
|
||||
<input type="text" name="website" class="form-control" placeholder="选填">
|
||||
<p class="help-block">第三方平台网址,必须包含前缀http://或https://</p>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>PHP版本</label>
|
||||
<input type="text" name="phpv" class="form-control" placeholder="选填">
|
||||
<p class="help-block">运行该应用要求最低PHP版本,留空则无要求</p>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>协议</label>
|
||||
<textarea name="agreement" class="form-control" placeholder="选填"></textarea>
|
||||
<p class="help-block">安装时提示协议</p>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<table class="table table-hover c-p-request-headers">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="col-xs-2" style="padding-left:0;">程序操作</th>
|
||||
<th class="col-xs-10">相对于应用的链接(开头不加/)</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>安装</td>
|
||||
<td>
|
||||
<input type="text" name="install" value="" class="form-control" placeholder="必填:安装应用接口,没有填1">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>卸载</td>
|
||||
<td>
|
||||
<input type="text" name="uninstall" value="" class="form-control" placeholder="必填:卸载应用接口,没有填1">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>升级</td>
|
||||
<td>
|
||||
<input type="text" name="upgrade" value="" class="form-control" placeholder="必填:升级应用接口,没有填1">
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="h-title">
|
||||
<label class="control-label">扩展</label>
|
||||
<a href="javascript:;" id="add_pack" class="glyphicon glyphicon-plus" title="添加"></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover" id="pack_list" style="margin-bottom:0;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="col-xs-2">名称</th>
|
||||
<th class="col-xs-2">类型</th>
|
||||
<th class="col-xs-2">链接</th>
|
||||
<th class="col-xs-2">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<button type="submit" class="btn btn-primary btn-block">{$Think.lang.save}</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
developClass.packTypes={$packTypes|json_encode};
|
||||
developClass.app({$appData|json_encode});
|
||||
</script>
|
||||
{extend name="common:main" /}
|
||||
{block name="cssjs"}
|
||||
<script type="text/javascript" src="__PUBLIC__/static/js/admin/develop.js?{$Think.config.html_v}"></script>
|
||||
{/block}
|
||||
{block name="content"}
|
||||
<div class="box box-default">
|
||||
<div class="box-body">
|
||||
<form id="form_app" method="post" ajax-submit="true" action="{:url('Admin/Develop/app')}">
|
||||
{if !empty($appData)}
|
||||
<input type="hidden" name="edit" value="1" />
|
||||
<input type="hidden" name="app" value="{$appData['app']}" />
|
||||
{/if}
|
||||
|
||||
{if $newest_version}
|
||||
<div class="alert alert-warning" role="alert">
|
||||
检测到新版本{$newest_version},<a href="javascript:;" id="newest_version">点击升级</a>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<div class="form-group">
|
||||
<label>app标识</label>
|
||||
{if !empty($appData)}
|
||||
<input type="text" value="{$appData['app']}" class="form-control" disabled="disabled">
|
||||
{else /}
|
||||
<input type="text" name="app" class="form-control">
|
||||
{/if}
|
||||
<p class="help-block">标识可由小写字母、下划线、数字组成,长度3个字符以上且以字母开头,建议加入自己的版权以区别他人的应用</p>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>PHP框架</label>
|
||||
{if $appFrameworkPath}
|
||||
<input type="hidden" name="framework" value="{$appData['config']['framework']}" />
|
||||
<input type="hidden" name="framework_version[{$appData['config']['framework']}]" value="{$appData['config']['framework_version']}" />
|
||||
<input type="text" value="{$appData['config']['framework']}{$appData['config']['framework_version']}" class="form-control" disabled="disabled">
|
||||
<p class="help-block">如需修改框架,请先删除:{$appFrameworkPath}</p>
|
||||
{else /}
|
||||
<select name="framework" class="form-control">
|
||||
<option value="">自定义</option>
|
||||
{foreach $frameworks as $fmw=>$vers}
|
||||
<option value="{$fmw}">{$fmw}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
{foreach $frameworks as $fmw=>$vers}
|
||||
<div class="input-group" style="margin-top:5px;display:none;" id="framework_vers_{$fmw}">
|
||||
{foreach $vers as $ver}
|
||||
<label class="radio-inline"><input type="radio" name="framework_version[{$fmw}]" value="{$ver}"> {$ver}</label>
|
||||
{/foreach}
|
||||
</div>
|
||||
{/foreach}
|
||||
<div class="help-block">
|
||||
使用php框架开发该应用
|
||||
{if !empty($appData['config']['framework'])&&empty($appFrameworkPath)}
|
||||
<button id="install_framework" type="button" class="btn btn-xs btn-warning">安装框架{$appData['config']['framework']}{$appData['config']['framework_version']}</button> 注意安装框架将会初始化应用,如应用中存在项目文件请先备份以防丢失!
|
||||
<div id="install_framework_error"></div>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>名称</label>
|
||||
<input type="text" name="name" class="form-control">
|
||||
<p class="help-block">应用的中文名称</p>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>版本号</label>
|
||||
<input type="text" name="version" class="form-control">
|
||||
<p class="help-block">应用版本号标准格式:x.x或x.x.x(x为数字最多两位数)版本号高于旧版本时会提示升级</p>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>描述</label>
|
||||
<textarea name="desc" class="form-control"></textarea>
|
||||
<p class="help-block">可以使用<p><br><b><i><a>标签</p>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>作者</label>
|
||||
<input type="text" name="author" class="form-control" placeholder="选填">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>平台网址</label>
|
||||
<input type="text" name="website" class="form-control" placeholder="选填">
|
||||
<p class="help-block">第三方平台网址,必须包含前缀http://或https://</p>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>PHP版本</label>
|
||||
<input type="text" name="phpv" class="form-control" placeholder="选填">
|
||||
<p class="help-block">运行该应用要求最低PHP版本,留空则无要求</p>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>协议</label>
|
||||
<textarea name="agreement" class="form-control" placeholder="选填"></textarea>
|
||||
<p class="help-block">安装时提示协议</p>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<table class="table table-hover c-p-request-headers">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="col-xs-2" style="padding-left:0;">程序操作</th>
|
||||
<th class="col-xs-10">相对于应用的链接(开头不加/)</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>安装</td>
|
||||
<td>
|
||||
<input type="text" name="install" value="" class="form-control" placeholder="必填:安装应用接口,没有填1">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>卸载</td>
|
||||
<td>
|
||||
<input type="text" name="uninstall" value="" class="form-control" placeholder="必填:卸载应用接口,没有填1">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>升级</td>
|
||||
<td>
|
||||
<input type="text" name="upgrade" value="" class="form-control" placeholder="必填:升级应用接口,没有填1">
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="h-title">
|
||||
<label class="control-label">扩展</label>
|
||||
<a href="javascript:;" id="add_pack" class="glyphicon glyphicon-plus" title="添加"></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover" id="pack_list" style="margin-bottom:0;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="col-xs-2">名称</th>
|
||||
<th class="col-xs-2">类型</th>
|
||||
<th class="col-xs-2">链接</th>
|
||||
<th class="col-xs-2">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<button type="submit" class="btn btn-primary btn-block">{$Think.lang.save}</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
developClass.packTypes={$packTypes|json_encode};
|
||||
developClass.app({$appData|json_encode});
|
||||
</script>
|
||||
{/block}
|
|
@ -1,42 +1,42 @@
|
|||
<form id="win_form_pack" method="post" action="{:url('Develop/appAddPack')}">
|
||||
<input type="hidden" name="objid" value="{$objid}" />
|
||||
<div class="form-group">
|
||||
<label>名称</label>
|
||||
<input type="text" name="pack[name]" class="form-control" autocomplete="off" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>类型</label>
|
||||
<select name="pack[type]" class="form-control">
|
||||
<option value="">请选择</option>
|
||||
{foreach $packTypes as $k=>$v}
|
||||
<option value="{$k}">{$v}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
<p class="help-block type-nav" style="display:none;">显示在应用的管理界面中</p>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>新窗口</label>
|
||||
<div class="input-group">
|
||||
<label class="radio-inline"><input type="radio" name="pack[target]" value="1">是</label>
|
||||
<label class="radio-inline"><input type="radio" name="pack[target]" value="0">否</label>
|
||||
</div>
|
||||
<p class="help-block">是否在新窗口打开连接</p>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>链接</label>
|
||||
<input type="text" name="pack[nav_link]" class="form-control" autocomplete="off" placeholder="默认补全为应用绝对链接" />
|
||||
<div class="help-block">
|
||||
可使用参数:{app}当前应用的根网址,{apps}所有应用的根网址<br>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group form-group-sm">
|
||||
<button type="submit" class="btn btn-primary btn-block">确定</button>
|
||||
</div>
|
||||
</form>
|
||||
<script type="text/javascript">
|
||||
developClass.init_app_pack();
|
||||
|
||||
{if condition="!empty($pack)"}
|
||||
developClass.load_app_pack({$pack|json_encode});
|
||||
{/if}
|
||||
<form id="win_form_pack" method="post" action="{:url('Develop/appAddPack')}">
|
||||
<input type="hidden" name="objid" value="{$objid}" />
|
||||
<div class="form-group">
|
||||
<label>名称</label>
|
||||
<input type="text" name="pack[name]" class="form-control" autocomplete="off" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>类型</label>
|
||||
<select name="pack[type]" class="form-control">
|
||||
<option value="">请选择</option>
|
||||
{foreach $packTypes as $k=>$v}
|
||||
<option value="{$k}">{$v}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
<p class="help-block type-nav" style="display:none;">显示在应用的管理界面中</p>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>新窗口</label>
|
||||
<div class="input-group">
|
||||
<label class="radio-inline"><input type="radio" name="pack[target]" value="1">是</label>
|
||||
<label class="radio-inline"><input type="radio" name="pack[target]" value="0">否</label>
|
||||
</div>
|
||||
<p class="help-block">是否在新窗口打开连接</p>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>链接</label>
|
||||
<input type="text" name="pack[nav_link]" class="form-control" autocomplete="off" placeholder="默认补全为应用绝对链接" />
|
||||
<div class="help-block">
|
||||
可使用参数:{app}当前应用的根网址,{apps}所有应用的根网址<br>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group form-group-sm">
|
||||
<button type="submit" class="btn btn-primary btn-block">确定</button>
|
||||
</div>
|
||||
</form>
|
||||
<script type="text/javascript">
|
||||
developClass.init_app_pack();
|
||||
|
||||
{if condition="!empty($pack)"}
|
||||
developClass.load_app_pack({$pack|json_encode});
|
||||
{/if}
|
||||
</script>
|
|
@ -1,102 +1,102 @@
|
|||
{extend name="common:main" /}
|
||||
{block name="cssjs"}
|
||||
<script src="__PUBLIC__/static/js/admin/store.js?{$Think.config.html_v}"></script>
|
||||
<script src="__PUBLIC__/static/js/admin/app.js?{$Think.config.html_v}"></script>
|
||||
{/block}
|
||||
{block name="content"}
|
||||
<div class="nav-tabs-custom">
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active">
|
||||
<div class="table-responsive">
|
||||
<table id="app_list" class="table table-striped datatable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>应用</th>
|
||||
<th>作者</th>
|
||||
<th>
|
||||
操作
|
||||
<span class="sep">|</span>
|
||||
<div class="checkbox-inline">
|
||||
<input type="checkbox" id="auto_check" {:empty($GLOBALS['config']['store_auto_check_app'])?'':'checked="checked"'} value="1" title="刷新页面时自动检测" style="margin-left:-17px;" />
|
||||
<a href="javascript:;" id="btn_check" style="color:#333;">检测更新</a>
|
||||
</div>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{foreach name="dbApps" item="item" key="app"}
|
||||
<tr data-app="{$app}">
|
||||
<td>
|
||||
<div style="display:inline;" data-toggle="popover" data-content="{$item['config']['desc']|htmlspecialchars}" data-html="true" data-trigger="hover" data-placement="right">
|
||||
{$item['config']['name']} {$item['config']['version']} <span style="color:#aaa;">({$app})</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
{$item['config']['author']}
|
||||
</td>
|
||||
<td>
|
||||
<a href="{:url('App/manage?app='.$app)}" class="manager">管理</a>
|
||||
<span class="sep">|</span>
|
||||
{if $item['newest_version']}
|
||||
<a href="javascript:;" class="upgrade" title="最新版本:{$item['newest_version']}"><b>升级</b></a>
|
||||
<span class="sep">|</span>
|
||||
{/if}
|
||||
{if empty($item['config']['enable'])}
|
||||
<a href="javascript:;" class="enable" data-enable="{$item['config']['enable']}">{$item['config']['enable']?'关闭':'<b>开启</b>'}</a>
|
||||
<span class="sep">|</span>
|
||||
{/if}
|
||||
<a href="javascript:;" class="uninstall">卸载</a>
|
||||
<span class="sep">|</span>
|
||||
{if !empty($provList[$item['provider_id']])}
|
||||
<a href="{$provList[$item['provider_id']]['url']}/client/app/detail?app={$app|urlencode}" data-is-store-url="1" class="store-detail" title="第三方平台">第三方</a>
|
||||
{else/}
|
||||
<a href="https://www.skycaiji.com/client/app/detail?app={$app|urlencode}" data-is-store-url="1" class="store-detail">平台</a>
|
||||
{/if}
|
||||
<div class="app-store-info"></div>
|
||||
</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
{if $pathApps}
|
||||
<tr><td colspan="4"><b style="color:#666;">未安装的应用</b></td></tr>
|
||||
{foreach name="pathApps" item="item" key="app"}
|
||||
<tr data-app="{$app}" data-agreement="{$item['config']['agreement']?'1':''}">
|
||||
<td>
|
||||
<div style="display:inline;" data-toggle="popover" data-content="{$item['config']['desc']|htmlspecialchars}" data-html="true" data-trigger="hover" data-placement="right">
|
||||
{$item['config']['name']} v{$item['config']['version']} <span style="color:#aaa;">({$app})</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
{$item['config']['author']}
|
||||
</td>
|
||||
<td>
|
||||
<a href="javascript:;" class="install">安装</a>
|
||||
<span class="sep">|</span>
|
||||
{if !empty($provList[$item['provider_id']])}
|
||||
<a href="{$provList[$item['provider_id']]['url']}/client/app/detail?app={$app|urlencode}" data-is-store-url="1" class="store-detail" title="第三方平台">第三方</a>
|
||||
{else/}
|
||||
<a href="https://www.skycaiji.com/client/app/detail?app={$app|urlencode}" data-is-store-url="1" class="store-detail">平台</a>
|
||||
{/if}
|
||||
<div class="app-store-info"></div>
|
||||
</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
{/if}
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
</tr>
|
||||
{if condition="!empty($pagenav)"}
|
||||
<tr>
|
||||
<td colspan="5">{$pagenav}</td>
|
||||
</tr>
|
||||
{/if}
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
appClass.init_list();
|
||||
</script>
|
||||
{extend name="common:main" /}
|
||||
{block name="cssjs"}
|
||||
<script src="__PUBLIC__/static/js/admin/store.js?{$Think.config.html_v}"></script>
|
||||
<script src="__PUBLIC__/static/js/admin/app.js?{$Think.config.html_v}"></script>
|
||||
{/block}
|
||||
{block name="content"}
|
||||
<div class="nav-tabs-custom">
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active">
|
||||
<div class="table-responsive">
|
||||
<table id="app_list" class="table table-striped datatable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>应用</th>
|
||||
<th>作者</th>
|
||||
<th>
|
||||
操作
|
||||
<span class="sep">|</span>
|
||||
<div class="checkbox-inline">
|
||||
<input type="checkbox" id="auto_check" {:empty($GLOBALS['config']['store_auto_check_app'])?'':'checked="checked"'} value="1" title="刷新页面时自动检测" style="margin-left:-17px;" />
|
||||
<a href="javascript:;" id="btn_check" style="color:#333;">检测更新</a>
|
||||
</div>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{foreach name="dbApps" item="item" key="app"}
|
||||
<tr data-app="{$app}">
|
||||
<td>
|
||||
<div style="display:inline;" data-toggle="popover" data-content="{$item['config']['desc']|htmlspecialchars}" data-html="true" data-trigger="hover" data-placement="right">
|
||||
{$item['config']['name']} {$item['config']['version']} <span style="color:#aaa;">({$app})</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
{$item['config']['author']}
|
||||
</td>
|
||||
<td>
|
||||
<a href="{:url('App/manage?app='.$app)}" class="manager">管理</a>
|
||||
<span class="sep">|</span>
|
||||
{if $item['newest_version']}
|
||||
<a href="javascript:;" class="upgrade" title="最新版本:{$item['newest_version']}"><b>升级</b></a>
|
||||
<span class="sep">|</span>
|
||||
{/if}
|
||||
{if empty($item['config']['enable'])}
|
||||
<a href="javascript:;" class="enable" data-enable="{$item['config']['enable']}">{$item['config']['enable']?'关闭':'<b>开启</b>'}</a>
|
||||
<span class="sep">|</span>
|
||||
{/if}
|
||||
<a href="javascript:;" class="uninstall">卸载</a>
|
||||
<span class="sep">|</span>
|
||||
{if !empty($provList[$item['provider_id']])}
|
||||
<a href="{$provList[$item['provider_id']]['url']}/client/app/detail?app={$app|urlencode}" data-is-store-url="1" class="store-detail" title="第三方平台">第三方</a>
|
||||
{else/}
|
||||
<a href="https://www.skycaiji.com/client/app/detail?app={$app|urlencode}" data-is-store-url="1" class="store-detail">平台</a>
|
||||
{/if}
|
||||
<div class="app-store-info"></div>
|
||||
</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
{if $pathApps}
|
||||
<tr><td colspan="4"><b style="color:#666;">未安装的应用</b></td></tr>
|
||||
{foreach name="pathApps" item="item" key="app"}
|
||||
<tr data-app="{$app}" data-agreement="{$item['config']['agreement']?'1':''}">
|
||||
<td>
|
||||
<div style="display:inline;" data-toggle="popover" data-content="{$item['config']['desc']|htmlspecialchars}" data-html="true" data-trigger="hover" data-placement="right">
|
||||
{$item['config']['name']} v{$item['config']['version']} <span style="color:#aaa;">({$app})</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
{$item['config']['author']}
|
||||
</td>
|
||||
<td>
|
||||
<a href="javascript:;" class="install">安装</a>
|
||||
<span class="sep">|</span>
|
||||
{if !empty($provList[$item['provider_id']])}
|
||||
<a href="{$provList[$item['provider_id']]['url']}/client/app/detail?app={$app|urlencode}" data-is-store-url="1" class="store-detail" title="第三方平台">第三方</a>
|
||||
{else/}
|
||||
<a href="https://www.skycaiji.com/client/app/detail?app={$app|urlencode}" data-is-store-url="1" class="store-detail">平台</a>
|
||||
{/if}
|
||||
<div class="app-store-info"></div>
|
||||
</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
{/if}
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
</tr>
|
||||
{if condition="!empty($pagenav)"}
|
||||
<tr>
|
||||
<td colspan="5">{$pagenav}</td>
|
||||
</tr>
|
||||
{/if}
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
appClass.init_list();
|
||||
</script>
|
||||
{/block}
|
|
@ -1,69 +1,69 @@
|
|||
{extend name="common:main" /}
|
||||
{block name="cssjs"}
|
||||
<script type="text/javascript" src="__PUBLIC__/static/js/admin/provider.js?{$Think.config.html_v}"></script>
|
||||
{/block}
|
||||
{block name="content"}
|
||||
<div class="alert alert-warning alert-dismissible" style="padding-top:7px;padding-bottom:7px;line-height:20px;margin-bottom:10px;">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-hidden="true" style="top:0px;">×</button>
|
||||
允许通过下列第三方平台下载规则、插件等,注意:任何第三方平台都可能存在安全隐患,请谨慎下载!
|
||||
</div>
|
||||
<div class="box box-default">
|
||||
<div class="box-body">
|
||||
<form id="form_list" method="post" ajax-submit="true" action="{:url('Provider/saveall')}">
|
||||
<table id="list_table" class="table table-hover datatable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="80">排序</th>
|
||||
<th>网址</th>
|
||||
<th>标题</th>
|
||||
<th>访问</th>
|
||||
<th>操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{foreach name="list" item="item"}
|
||||
<tr data-id="{$item['id']}" data-url="{$item['url']}">
|
||||
<td class="sort"><input type="text" name="newsort[{$item['id']}]" class="form-control" value="{$item['sort']}" autocomplete="off" /></td>
|
||||
<td><a href="javascript:;" class="store">{$item['url']}</a></td>
|
||||
<td>{$item['title']}</td>
|
||||
<td><a href="javascript:;" class="enable" style="color:{$item['enable']?'green':'red'}">{$item['enable']?'允许':'拒绝'}</a></td>
|
||||
<td>
|
||||
<a href="javascript:;" class="comment">评价</a>
|
||||
<span class="sep">|</span>
|
||||
<a href="javascript:;" class="edit">编辑</a>
|
||||
<span class="sep">|</span>
|
||||
<a href="javascript:;" class="delete">删除</a>
|
||||
</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="3">
|
||||
<button type="submit" class="btn btn-default" id="btn_save">保存</button>
|
||||
<a href="javascript:;" class="btn btn-primary" id="btn_add">添加</a>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</form>
|
||||
{$pagenav}
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<form id="form_search" method="post" action="{:url('Provider/list')}" class="form-inline">
|
||||
<div class="form-group form-group-sm">
|
||||
<label>网址</label>
|
||||
<input type="text" name="url" class="form-control" placeholder="模糊搜索" />
|
||||
</div>
|
||||
<div class="form-group form-group-sm">
|
||||
<label>标题</label>
|
||||
<input type="text" name="title" class="form-control" placeholder="模糊搜索" />
|
||||
</div>
|
||||
<button type="submit" class="btn btn-default btn-sm">搜索</button>
|
||||
</form>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
providerClass.list_init();
|
||||
</script>
|
||||
{extend name="common:main" /}
|
||||
{block name="cssjs"}
|
||||
<script type="text/javascript" src="__PUBLIC__/static/js/admin/provider.js?{$Think.config.html_v}"></script>
|
||||
{/block}
|
||||
{block name="content"}
|
||||
<div class="alert alert-warning alert-dismissible" style="padding-top:7px;padding-bottom:7px;line-height:20px;margin-bottom:10px;">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-hidden="true" style="top:0px;">×</button>
|
||||
允许通过下列第三方平台下载规则、插件等,注意:任何第三方平台都可能存在安全隐患,请谨慎下载!
|
||||
</div>
|
||||
<div class="box box-default">
|
||||
<div class="box-body">
|
||||
<form id="form_list" method="post" ajax-submit="true" action="{:url('Provider/saveall')}">
|
||||
<table id="list_table" class="table table-hover datatable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="80">排序</th>
|
||||
<th>网址</th>
|
||||
<th>标题</th>
|
||||
<th>访问</th>
|
||||
<th>操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{foreach name="list" item="item"}
|
||||
<tr data-id="{$item['id']}" data-url="{$item['url']}">
|
||||
<td class="sort"><input type="text" name="newsort[{$item['id']}]" class="form-control" value="{$item['sort']}" autocomplete="off" /></td>
|
||||
<td><a href="javascript:;" class="store">{$item['url']}</a></td>
|
||||
<td>{$item['title']}</td>
|
||||
<td><a href="javascript:;" class="enable" style="color:{$item['enable']?'green':'red'}">{$item['enable']?'允许':'拒绝'}</a></td>
|
||||
<td>
|
||||
<a href="javascript:;" class="comment">评价</a>
|
||||
<span class="sep">|</span>
|
||||
<a href="javascript:;" class="edit">编辑</a>
|
||||
<span class="sep">|</span>
|
||||
<a href="javascript:;" class="delete">删除</a>
|
||||
</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="3">
|
||||
<button type="submit" class="btn btn-default" id="btn_save">保存</button>
|
||||
<a href="javascript:;" class="btn btn-primary" id="btn_add">添加</a>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</form>
|
||||
{$pagenav}
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<form id="form_search" method="post" action="{:url('Provider/list')}" class="form-inline">
|
||||
<div class="form-group form-group-sm">
|
||||
<label>网址</label>
|
||||
<input type="text" name="url" class="form-control" placeholder="模糊搜索" />
|
||||
</div>
|
||||
<div class="form-group form-group-sm">
|
||||
<label>标题</label>
|
||||
<input type="text" name="title" class="form-control" placeholder="模糊搜索" />
|
||||
</div>
|
||||
<button type="submit" class="btn btn-default btn-sm">搜索</button>
|
||||
</form>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
providerClass.list_init();
|
||||
</script>
|
||||
{/block}
|
|
@ -1,37 +1,37 @@
|
|||
<form id="win_form_provider" method="post" ajax-submit="true" role="form" action="{:url('Provider/save')}">
|
||||
{if !empty($proData)}
|
||||
<input type="hidden" name="id" value="{$proData['id']}" />
|
||||
{/if}
|
||||
<div class="form-group">
|
||||
<label>网址</label>
|
||||
<input type="text" class="form-control" name="url" value="">
|
||||
<p class="help-block">必须输入前缀http://或https://</p>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>标题</label>
|
||||
<input type="text" class="form-control" name="title" value="" placeholder="默认自动获取网页标题">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>访问</label>
|
||||
<div class="input-group">
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="enable" value="1"> 允许
|
||||
</label>
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="enable" value="0"> 拒绝
|
||||
</label>
|
||||
</div>
|
||||
<p class="help-block">允许从该网站中下载规则、插件等</p>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>排序</label>
|
||||
<input type="text" class="form-control" name="sort" value="0">
|
||||
<p class="help-block">数字越大越靠前</p>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">{$Think.lang.submit}</button>
|
||||
</form>
|
||||
{if !empty($proData)}
|
||||
<script type="text/javascript">
|
||||
providerClass.load({$proData|json_encode});
|
||||
</script>
|
||||
<form id="win_form_provider" method="post" ajax-submit="true" role="form" action="{:url('Provider/save')}">
|
||||
{if !empty($proData)}
|
||||
<input type="hidden" name="id" value="{$proData['id']}" />
|
||||
{/if}
|
||||
<div class="form-group">
|
||||
<label>网址</label>
|
||||
<input type="text" class="form-control" name="url" value="">
|
||||
<p class="help-block">必须输入前缀http://或https://</p>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>标题</label>
|
||||
<input type="text" class="form-control" name="title" value="" placeholder="默认自动获取网页标题">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>访问</label>
|
||||
<div class="input-group">
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="enable" value="1"> 允许
|
||||
</label>
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="enable" value="0"> 拒绝
|
||||
</label>
|
||||
</div>
|
||||
<p class="help-block">允许从该网站中下载规则、插件等</p>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>排序</label>
|
||||
<input type="text" class="form-control" name="sort" value="0">
|
||||
<p class="help-block">数字越大越靠前</p>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">{$Think.lang.submit}</button>
|
||||
</form>
|
||||
{if !empty($proData)}
|
||||
<script type="text/javascript">
|
||||
providerClass.load({$proData|json_encode});
|
||||
</script>
|
||||
{/if}
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
//运行应用
|
||||
$skyApp=explode(DIRECTORY_SEPARATOR, trim(__DIR__,'\/\\'));
|
||||
$skyApp=end($skyApp);
|
||||
require_once $skyApp.'.php';
|
||||
$skyApp=new $skyApp();
|
||||
$skyApp->app()->run();
|
||||
<?php
|
||||
//运行应用
|
||||
$skyApp=explode(DIRECTORY_SEPARATOR, trim(__DIR__,'\/\\'));
|
||||
$skyApp=end($skyApp);
|
||||
require_once $skyApp.'.php';
|
||||
$skyApp=new $skyApp();
|
||||
$skyApp->app()->run();
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
<?php
|
||||
/*应用配置类文件*/
|
||||
include dirname(__DIR__).'/app/skycaiji.php';
|
||||
class {$app} extends skycaiji{
|
||||
/*应用配置*/
|
||||
public $config=array(
|
||||
'framework'=>'{$framework}', //框架名称
|
||||
'framework_version'=>'{$framework_version}', //框架版本
|
||||
'name'=>'{$name}', //应用名称
|
||||
'desc'=>'{$desc}', //描述
|
||||
'version'=>'{$version}', //版本号
|
||||
'author'=>'{$author}', //作者
|
||||
'website'=>'{$website}', //站点
|
||||
'packs'=>{$packs}, //扩展
|
||||
);
|
||||
|
||||
public $install='{$install}'; //安装接口
|
||||
public $uninstall='{$uninstall}'; //卸载接口
|
||||
public $upgrade='{$upgrade}'; //升级接口
|
||||
}
|
||||
<?php
|
||||
/*应用配置类文件*/
|
||||
include dirname(__DIR__).'/app/skycaiji.php';
|
||||
class {$app} extends skycaiji{
|
||||
/*应用配置*/
|
||||
public $config=array(
|
||||
'framework'=>'{$framework}', //框架名称
|
||||
'framework_version'=>'{$framework_version}', //框架版本
|
||||
'name'=>'{$name}', //应用名称
|
||||
'desc'=>'{$desc}', //描述
|
||||
'version'=>'{$version}', //版本号
|
||||
'author'=>'{$author}', //作者
|
||||
'website'=>'{$website}', //站点
|
||||
'packs'=>{$packs}, //扩展
|
||||
);
|
||||
|
||||
public $install='{$install}'; //安装接口
|
||||
public $uninstall='{$uninstall}'; //卸载接口
|
||||
public $upgrade='{$upgrade}'; //升级接口
|
||||
}
|
||||
|
|
|
@ -1,269 +1,269 @@
|
|||
<?php
|
||||
/*应用程序核心类*/
|
||||
abstract class skycaiji{
|
||||
private static $appInstance=null;//应用实例
|
||||
public $app=''; //当前应用app标识
|
||||
public $appUrl=''; //当前应用的根网址
|
||||
public $appPath=''; //当前应用的根目录
|
||||
public $config=array(); //当前应用配置
|
||||
public $system=array(); //蓝天采集器配置
|
||||
public $systemUrl=''; //蓝天采集器根网址
|
||||
public $systemPath=''; //蓝天采集器根目录
|
||||
|
||||
public $install=''; //安装链接
|
||||
public $uninstall=''; //卸载链接
|
||||
public $upgrade=''; //升级链接
|
||||
|
||||
public function __construct(){
|
||||
$ds=DIRECTORY_SEPARATOR;
|
||||
$this->app=get_class($this);
|
||||
$this->systemPath=dirname(dirname(__DIR__));
|
||||
$this->appPath=$this->systemPath.$ds.'app'.$ds.$this->app;
|
||||
$this->appUrl=$this->root();
|
||||
$this->systemUrl=preg_replace('/[\/\\\]app[\/\\\]'.$this->app.'[\/\\\]*$/i', '', $this->appUrl);
|
||||
|
||||
$this->install=ltrim($this->install,'/');
|
||||
$this->uninstall=ltrim($this->uninstall,'/');
|
||||
$this->upgrade=ltrim($this->upgrade,'/');
|
||||
}
|
||||
|
||||
/*当前应用的实例*/
|
||||
public static function app(){
|
||||
if(!isset(self::$appInstance)){
|
||||
$appInstance=new static;//实例化
|
||||
//跳过检测的链接
|
||||
$passUrls=array('install'=>$appInstance->install,'uninstall'=>$appInstance->uninstall,'upgrade'=>$appInstance->upgrade);
|
||||
foreach ($passUrls as $k=>$v){
|
||||
if(empty($v)||$v=='1'){
|
||||
//1表示跳过操作
|
||||
unset($passUrls[$k]);
|
||||
}else{
|
||||
$v=$appInstance->appUrl.'/'.$v;
|
||||
$passUrls[$k]=strtolower($v);//必须小写
|
||||
}
|
||||
}
|
||||
$curUrl=$appInstance->url();//当前网址
|
||||
$curUrl=strtolower($curUrl);//必须小写
|
||||
|
||||
$config=array();//已安装配置
|
||||
if(!in_array($curUrl,$passUrls)){
|
||||
//应用必须安装后才能操作
|
||||
$config=__DIR__.'/config/'.$appInstance->app.'.php';//已安装的配置文件
|
||||
if(!file_exists($config)){
|
||||
exit('未安装应用');
|
||||
}
|
||||
$config=include $config;
|
||||
$config=is_array($config)?$config:array();
|
||||
if(empty($config['enable'])){
|
||||
exit('未开启应用');
|
||||
}
|
||||
}
|
||||
//应用配置
|
||||
$appInstance->config=is_array($appInstance->config)?$appInstance->config:array();
|
||||
$appInstance->config=array_merge($appInstance->config,$config);//配置合并
|
||||
|
||||
//蓝天采集系统配置
|
||||
$systemConfig=$appInstance->systemPath.'/data/config.php';
|
||||
if(file_exists($systemConfig)){
|
||||
$systemConfig=include $systemConfig;
|
||||
}
|
||||
$appInstance->system=is_array($systemConfig)?$systemConfig:array();
|
||||
|
||||
self::$appInstance=$appInstance;
|
||||
}
|
||||
return self::$appInstance;
|
||||
}
|
||||
/**
|
||||
* 运行框架
|
||||
* 如果应用使用了其他框架,请在应用文件中重写run方法加载框架
|
||||
*/
|
||||
public function run(){
|
||||
if(!empty($this->config['framework'])){
|
||||
//使用框架
|
||||
|
||||
if(empty($this->config['framework_path'])){
|
||||
$frameworkPath=$this->appFrameworkPath();
|
||||
if(is_dir($frameworkPath)){
|
||||
$this->config['framework_path']=$frameworkPath;
|
||||
}
|
||||
}
|
||||
if(empty($this->config['framework_path'])){
|
||||
exit('框架路径错误');
|
||||
}
|
||||
|
||||
$frameworkPath=$this->config['framework_path'];
|
||||
|
||||
if('thinkphp'==$this->config['framework']){
|
||||
$version='';
|
||||
if(file_exists($frameworkPath.'/base.php')&&preg_match('/\bdefine\s*\([\'\"]THINK_VERSION[\'\"],\s*[\'\"](.*?)[\'\"]\);/i', file_get_contents($frameworkPath.'/base.php'),$version)){
|
||||
$version=$version[1];
|
||||
}elseif(file_exists($frameworkPath.'/library/think/App.php')&&preg_match('/\bconst\s+VERSION\s*=\s*[\'\"](.*?)[\'\"]/i', file_get_contents($frameworkPath.'/library/think/App.php'),$version)){
|
||||
$version=$version[1];
|
||||
}elseif(file_exists($frameworkPath.'/src/think/App.php')&&preg_match('/\bconst\s+VERSION\s*=\s*[\'\"](.*?)[\'\"]/i', file_get_contents($frameworkPath.'/src/think/App.php'),$version)){
|
||||
$version=$version[1];
|
||||
}
|
||||
|
||||
if(preg_match('/^5\.0\./', $version)){
|
||||
//5.0
|
||||
define('APP_PATH', $this->appPath . '/application/');
|
||||
require $frameworkPath . '/base.php';
|
||||
\think\App::run()->send();
|
||||
}elseif(preg_match('/^5\.1\./', $version)){
|
||||
//5.1
|
||||
define('APP_PATH', $this->appPath . '/application/');
|
||||
require $frameworkPath . '/base.php';
|
||||
\think\Container::get('app')->path(APP_PATH)->run()->send();
|
||||
}elseif(preg_match('/^6\.0\./', $version)){
|
||||
//6.0
|
||||
require $this->appPath . '/vendor/autoload.php';
|
||||
$http = (new \think\App())->http;
|
||||
$response = $http->run();
|
||||
$response->send();
|
||||
$http->end($response);
|
||||
}
|
||||
}elseif('laravel'==$this->config['framework']){
|
||||
$version='';
|
||||
$frameworkPath.='/src/Illuminate';
|
||||
if(preg_match('/\bconst\s+VERSION\s*=\s*[\'\"](.*?)[\'\"]/i', file_get_contents($frameworkPath.'/Foundation/Application.php'),$version)){
|
||||
$version=$version[1];
|
||||
}else{
|
||||
$version='';
|
||||
}
|
||||
if(preg_match('/^5\.1\./', $version)){
|
||||
//5.1.x
|
||||
require $this->appPath.'/bootstrap/autoload.php';
|
||||
$app = require_once $this->appPath.'/bootstrap/app.php';
|
||||
$kernel = $app->make('Illuminate\Contracts\Http\Kernel');
|
||||
$response = $kernel->handle(
|
||||
$request = \Illuminate\Http\Request::capture()
|
||||
);
|
||||
$response->send();
|
||||
$kernel->terminate($request, $response);
|
||||
}elseif(preg_match('/^5\.5\./', $version)){
|
||||
//5.5.x
|
||||
define('LARAVEL_START', microtime(true));
|
||||
require $this->appPath.'/vendor/autoload.php';
|
||||
$app = require_once $this->appPath.'/bootstrap/app.php';
|
||||
$kernel = $app->make('Illuminate\Contracts\Http\Kernel');
|
||||
$response = $kernel->handle(
|
||||
$request = \Illuminate\Http\Request::capture()
|
||||
);
|
||||
$response->send();
|
||||
$kernel->terminate($request, $response);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 获取内置的框架路径
|
||||
*/
|
||||
public function appFrameworkPath(){
|
||||
$frameworkPath='';
|
||||
if(empty($this->config['framework_path'])){
|
||||
//检测框架是否存在
|
||||
switch ($this->config['framework']){
|
||||
case 'thinkphp':
|
||||
$frameworkPath=$this->appPath.'/vendor/topthink/framework';
|
||||
if(!file_exists($frameworkPath)){
|
||||
//不存在目录
|
||||
$frameworkPath=$this->appPath.'/thinkphp';//使用旧形式的框架目录
|
||||
}
|
||||
break;
|
||||
case 'laravel':$frameworkPath=$this->appPath.'/vendor/laravel/framework';break;
|
||||
}
|
||||
}
|
||||
return $frameworkPath;
|
||||
}
|
||||
/**
|
||||
* 获取当前执行的文件
|
||||
*/
|
||||
public function baseFile(){
|
||||
$url='';
|
||||
$script_name = basename($_SERVER['SCRIPT_FILENAME']);
|
||||
if (basename($_SERVER['SCRIPT_NAME']) === $script_name) {
|
||||
$url = $_SERVER['SCRIPT_NAME'];
|
||||
} elseif (basename($_SERVER['PHP_SELF']) === $script_name) {
|
||||
$url = $_SERVER['PHP_SELF'];
|
||||
} elseif (isset($_SERVER['ORIG_SCRIPT_NAME']) && basename($_SERVER['ORIG_SCRIPT_NAME']) === $script_name) {
|
||||
$url = $_SERVER['ORIG_SCRIPT_NAME'];
|
||||
} elseif (($pos = strpos($_SERVER['PHP_SELF'], '/' . $script_name)) !== false) {
|
||||
$url = substr($_SERVER['SCRIPT_NAME'], 0, $pos) . '/' . $script_name;
|
||||
} elseif (isset($_SERVER['DOCUMENT_ROOT']) && strpos($_SERVER['SCRIPT_FILENAME'], $_SERVER['DOCUMENT_ROOT']) === 0) {
|
||||
$url = str_replace('\\', '/', str_replace($_SERVER['DOCUMENT_ROOT'], '', $_SERVER['SCRIPT_FILENAME']));
|
||||
}
|
||||
return $url;
|
||||
}
|
||||
/**
|
||||
* 获取当前完整URL
|
||||
*/
|
||||
public function url(){
|
||||
$url='';
|
||||
if (isset($_SERVER['HTTP_X_REWRITE_URL'])) {
|
||||
$url = $_SERVER['HTTP_X_REWRITE_URL'];
|
||||
} elseif (isset($_SERVER['REQUEST_URI'])) {
|
||||
$url = $_SERVER['REQUEST_URI'];
|
||||
} elseif (isset($_SERVER['ORIG_PATH_INFO'])) {
|
||||
$url = $_SERVER['ORIG_PATH_INFO'] . (!empty($_SERVER['QUERY_STRING']) ? '?' . $_SERVER['QUERY_STRING'] : '');
|
||||
} else {
|
||||
$url = '';
|
||||
}
|
||||
return $url;
|
||||
}
|
||||
/**
|
||||
* 获取应用根目录
|
||||
* @return string
|
||||
*/
|
||||
public function root(){
|
||||
$file = $this->baseFile();
|
||||
if ($file && 0 !== strpos($this->url(), $file)) {
|
||||
$file = str_replace('\\', '/', dirname($file));
|
||||
}
|
||||
return rtrim($file, '/');
|
||||
}
|
||||
/**
|
||||
* 判断蓝天采集器是否管理员登录
|
||||
* @param string $jump 是否跳转至登录界面
|
||||
* @return boolean
|
||||
*/
|
||||
public function isAdmin($jump=false){
|
||||
if(session_status()!==2){
|
||||
session_start();
|
||||
}
|
||||
if(isset($_SESSION['skycaiji'])&&!empty($_SESSION['skycaiji']['is_admin'])){
|
||||
return true;
|
||||
}else{
|
||||
if($jump){
|
||||
//跳转至登录页面
|
||||
$url=$this->url();
|
||||
$url=$this->systemUrl.'/index.php?s=admin&_referer='.rawurlencode($url);
|
||||
|
||||
$html='<meta http-equiv="refresh" content="1;url='.$url.'">请登录管理员账号';
|
||||
exit($html);
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 输出json格式状态信息
|
||||
* @param init $status 状态 1:成功 ,0:失败
|
||||
* @param string $info 提示内容
|
||||
* @param string $url 跳转网址
|
||||
*/
|
||||
public function status($status=0,$info='',$url=''){
|
||||
$data=array('status'=>$status,'info'=>$info,'url'=>$url);
|
||||
$data=json_encode($data);
|
||||
header('content-type:application/json;charset=utf-8');
|
||||
exit($data);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前app实例化对象
|
||||
* 所有skycaiji类及子类中的方法都应该通过该函数来调用
|
||||
*/
|
||||
if(!defined('skycaiji_app')){
|
||||
function skycaiji_app(){
|
||||
return \skycaiji::app();
|
||||
}
|
||||
}
|
||||
<?php
|
||||
/*应用程序核心类*/
|
||||
abstract class skycaiji{
|
||||
private static $appInstance=null;//应用实例
|
||||
public $app=''; //当前应用app标识
|
||||
public $appUrl=''; //当前应用的根网址
|
||||
public $appPath=''; //当前应用的根目录
|
||||
public $config=array(); //当前应用配置
|
||||
public $system=array(); //蓝天采集器配置
|
||||
public $systemUrl=''; //蓝天采集器根网址
|
||||
public $systemPath=''; //蓝天采集器根目录
|
||||
|
||||
public $install=''; //安装链接
|
||||
public $uninstall=''; //卸载链接
|
||||
public $upgrade=''; //升级链接
|
||||
|
||||
public function __construct(){
|
||||
$ds=DIRECTORY_SEPARATOR;
|
||||
$this->app=get_class($this);
|
||||
$this->systemPath=dirname(dirname(__DIR__));
|
||||
$this->appPath=$this->systemPath.$ds.'app'.$ds.$this->app;
|
||||
$this->appUrl=$this->root();
|
||||
$this->systemUrl=preg_replace('/[\/\\\]app[\/\\\]'.$this->app.'[\/\\\]*$/i', '', $this->appUrl);
|
||||
|
||||
$this->install=ltrim($this->install,'/');
|
||||
$this->uninstall=ltrim($this->uninstall,'/');
|
||||
$this->upgrade=ltrim($this->upgrade,'/');
|
||||
}
|
||||
|
||||
/*当前应用的实例*/
|
||||
public static function app(){
|
||||
if(!isset(self::$appInstance)){
|
||||
$appInstance=new static;//实例化
|
||||
//跳过检测的链接
|
||||
$passUrls=array('install'=>$appInstance->install,'uninstall'=>$appInstance->uninstall,'upgrade'=>$appInstance->upgrade);
|
||||
foreach ($passUrls as $k=>$v){
|
||||
if(empty($v)||$v=='1'){
|
||||
//1表示跳过操作
|
||||
unset($passUrls[$k]);
|
||||
}else{
|
||||
$v=$appInstance->appUrl.'/'.$v;
|
||||
$passUrls[$k]=strtolower($v);//必须小写
|
||||
}
|
||||
}
|
||||
$curUrl=$appInstance->url();//当前网址
|
||||
$curUrl=strtolower($curUrl);//必须小写
|
||||
|
||||
$config=array();//已安装配置
|
||||
if(!in_array($curUrl,$passUrls)){
|
||||
//应用必须安装后才能操作
|
||||
$config=__DIR__.'/config/'.$appInstance->app.'.php';//已安装的配置文件
|
||||
if(!file_exists($config)){
|
||||
exit('未安装应用');
|
||||
}
|
||||
$config=include $config;
|
||||
$config=is_array($config)?$config:array();
|
||||
if(empty($config['enable'])){
|
||||
exit('未开启应用');
|
||||
}
|
||||
}
|
||||
//应用配置
|
||||
$appInstance->config=is_array($appInstance->config)?$appInstance->config:array();
|
||||
$appInstance->config=array_merge($appInstance->config,$config);//配置合并
|
||||
|
||||
//蓝天采集系统配置
|
||||
$systemConfig=$appInstance->systemPath.'/data/config.php';
|
||||
if(file_exists($systemConfig)){
|
||||
$systemConfig=include $systemConfig;
|
||||
}
|
||||
$appInstance->system=is_array($systemConfig)?$systemConfig:array();
|
||||
|
||||
self::$appInstance=$appInstance;
|
||||
}
|
||||
return self::$appInstance;
|
||||
}
|
||||
/**
|
||||
* 运行框架
|
||||
* 如果应用使用了其他框架,请在应用文件中重写run方法加载框架
|
||||
*/
|
||||
public function run(){
|
||||
if(!empty($this->config['framework'])){
|
||||
//使用框架
|
||||
|
||||
if(empty($this->config['framework_path'])){
|
||||
$frameworkPath=$this->appFrameworkPath();
|
||||
if(is_dir($frameworkPath)){
|
||||
$this->config['framework_path']=$frameworkPath;
|
||||
}
|
||||
}
|
||||
if(empty($this->config['framework_path'])){
|
||||
exit('框架路径错误');
|
||||
}
|
||||
|
||||
$frameworkPath=$this->config['framework_path'];
|
||||
|
||||
if('thinkphp'==$this->config['framework']){
|
||||
$version='';
|
||||
if(file_exists($frameworkPath.'/base.php')&&preg_match('/\bdefine\s*\([\'\"]THINK_VERSION[\'\"],\s*[\'\"](.*?)[\'\"]\);/i', file_get_contents($frameworkPath.'/base.php'),$version)){
|
||||
$version=$version[1];
|
||||
}elseif(file_exists($frameworkPath.'/library/think/App.php')&&preg_match('/\bconst\s+VERSION\s*=\s*[\'\"](.*?)[\'\"]/i', file_get_contents($frameworkPath.'/library/think/App.php'),$version)){
|
||||
$version=$version[1];
|
||||
}elseif(file_exists($frameworkPath.'/src/think/App.php')&&preg_match('/\bconst\s+VERSION\s*=\s*[\'\"](.*?)[\'\"]/i', file_get_contents($frameworkPath.'/src/think/App.php'),$version)){
|
||||
$version=$version[1];
|
||||
}
|
||||
|
||||
if(preg_match('/^5\.0\./', $version)){
|
||||
//5.0
|
||||
define('APP_PATH', $this->appPath . '/application/');
|
||||
require $frameworkPath . '/base.php';
|
||||
\think\App::run()->send();
|
||||
}elseif(preg_match('/^5\.1\./', $version)){
|
||||
//5.1
|
||||
define('APP_PATH', $this->appPath . '/application/');
|
||||
require $frameworkPath . '/base.php';
|
||||
\think\Container::get('app')->path(APP_PATH)->run()->send();
|
||||
}elseif(preg_match('/^6\.0\./', $version)){
|
||||
//6.0
|
||||
require $this->appPath . '/vendor/autoload.php';
|
||||
$http = (new \think\App())->http;
|
||||
$response = $http->run();
|
||||
$response->send();
|
||||
$http->end($response);
|
||||
}
|
||||
}elseif('laravel'==$this->config['framework']){
|
||||
$version='';
|
||||
$frameworkPath.='/src/Illuminate';
|
||||
if(preg_match('/\bconst\s+VERSION\s*=\s*[\'\"](.*?)[\'\"]/i', file_get_contents($frameworkPath.'/Foundation/Application.php'),$version)){
|
||||
$version=$version[1];
|
||||
}else{
|
||||
$version='';
|
||||
}
|
||||
if(preg_match('/^5\.1\./', $version)){
|
||||
//5.1.x
|
||||
require $this->appPath.'/bootstrap/autoload.php';
|
||||
$app = require_once $this->appPath.'/bootstrap/app.php';
|
||||
$kernel = $app->make('Illuminate\Contracts\Http\Kernel');
|
||||
$response = $kernel->handle(
|
||||
$request = \Illuminate\Http\Request::capture()
|
||||
);
|
||||
$response->send();
|
||||
$kernel->terminate($request, $response);
|
||||
}elseif(preg_match('/^5\.5\./', $version)){
|
||||
//5.5.x
|
||||
define('LARAVEL_START', microtime(true));
|
||||
require $this->appPath.'/vendor/autoload.php';
|
||||
$app = require_once $this->appPath.'/bootstrap/app.php';
|
||||
$kernel = $app->make('Illuminate\Contracts\Http\Kernel');
|
||||
$response = $kernel->handle(
|
||||
$request = \Illuminate\Http\Request::capture()
|
||||
);
|
||||
$response->send();
|
||||
$kernel->terminate($request, $response);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 获取内置的框架路径
|
||||
*/
|
||||
public function appFrameworkPath(){
|
||||
$frameworkPath='';
|
||||
if(empty($this->config['framework_path'])){
|
||||
//检测框架是否存在
|
||||
switch ($this->config['framework']){
|
||||
case 'thinkphp':
|
||||
$frameworkPath=$this->appPath.'/vendor/topthink/framework';
|
||||
if(!file_exists($frameworkPath)){
|
||||
//不存在目录
|
||||
$frameworkPath=$this->appPath.'/thinkphp';//使用旧形式的框架目录
|
||||
}
|
||||
break;
|
||||
case 'laravel':$frameworkPath=$this->appPath.'/vendor/laravel/framework';break;
|
||||
}
|
||||
}
|
||||
return $frameworkPath;
|
||||
}
|
||||
/**
|
||||
* 获取当前执行的文件
|
||||
*/
|
||||
public function baseFile(){
|
||||
$url='';
|
||||
$script_name = basename($_SERVER['SCRIPT_FILENAME']);
|
||||
if (basename($_SERVER['SCRIPT_NAME']) === $script_name) {
|
||||
$url = $_SERVER['SCRIPT_NAME'];
|
||||
} elseif (basename($_SERVER['PHP_SELF']) === $script_name) {
|
||||
$url = $_SERVER['PHP_SELF'];
|
||||
} elseif (isset($_SERVER['ORIG_SCRIPT_NAME']) && basename($_SERVER['ORIG_SCRIPT_NAME']) === $script_name) {
|
||||
$url = $_SERVER['ORIG_SCRIPT_NAME'];
|
||||
} elseif (($pos = strpos($_SERVER['PHP_SELF'], '/' . $script_name)) !== false) {
|
||||
$url = substr($_SERVER['SCRIPT_NAME'], 0, $pos) . '/' . $script_name;
|
||||
} elseif (isset($_SERVER['DOCUMENT_ROOT']) && strpos($_SERVER['SCRIPT_FILENAME'], $_SERVER['DOCUMENT_ROOT']) === 0) {
|
||||
$url = str_replace('\\', '/', str_replace($_SERVER['DOCUMENT_ROOT'], '', $_SERVER['SCRIPT_FILENAME']));
|
||||
}
|
||||
return $url;
|
||||
}
|
||||
/**
|
||||
* 获取当前完整URL
|
||||
*/
|
||||
public function url(){
|
||||
$url='';
|
||||
if (isset($_SERVER['HTTP_X_REWRITE_URL'])) {
|
||||
$url = $_SERVER['HTTP_X_REWRITE_URL'];
|
||||
} elseif (isset($_SERVER['REQUEST_URI'])) {
|
||||
$url = $_SERVER['REQUEST_URI'];
|
||||
} elseif (isset($_SERVER['ORIG_PATH_INFO'])) {
|
||||
$url = $_SERVER['ORIG_PATH_INFO'] . (!empty($_SERVER['QUERY_STRING']) ? '?' . $_SERVER['QUERY_STRING'] : '');
|
||||
} else {
|
||||
$url = '';
|
||||
}
|
||||
return $url;
|
||||
}
|
||||
/**
|
||||
* 获取应用根目录
|
||||
* @return string
|
||||
*/
|
||||
public function root(){
|
||||
$file = $this->baseFile();
|
||||
if ($file && 0 !== strpos($this->url(), $file)) {
|
||||
$file = str_replace('\\', '/', dirname($file));
|
||||
}
|
||||
return rtrim($file, '/');
|
||||
}
|
||||
/**
|
||||
* 判断蓝天采集器是否管理员登录
|
||||
* @param string $jump 是否跳转至登录界面
|
||||
* @return boolean
|
||||
*/
|
||||
public function isAdmin($jump=false){
|
||||
if(session_status()!==2){
|
||||
session_start();
|
||||
}
|
||||
if(isset($_SESSION['skycaiji'])&&!empty($_SESSION['skycaiji']['is_admin'])){
|
||||
return true;
|
||||
}else{
|
||||
if($jump){
|
||||
//跳转至登录页面
|
||||
$url=$this->url();
|
||||
$url=$this->systemUrl.'/index.php?s=admin&_referer='.rawurlencode($url);
|
||||
|
||||
$html='<meta http-equiv="refresh" content="1;url='.$url.'">请登录管理员账号';
|
||||
exit($html);
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 输出json格式状态信息
|
||||
* @param init $status 状态 1:成功 ,0:失败
|
||||
* @param string $info 提示内容
|
||||
* @param string $url 跳转网址
|
||||
*/
|
||||
public function status($status=0,$info='',$url=''){
|
||||
$data=array('status'=>$status,'info'=>$info,'url'=>$url);
|
||||
$data=json_encode($data);
|
||||
header('content-type:application/json;charset=utf-8');
|
||||
exit($data);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前app实例化对象
|
||||
* 所有skycaiji类及子类中的方法都应该通过该函数来调用
|
||||
*/
|
||||
if(!defined('skycaiji_app')){
|
||||
function skycaiji_app(){
|
||||
return \skycaiji::app();
|
||||
}
|
||||
}
|
||||
|
|
50
build.php
50
build.php
|
@ -1,25 +1,25 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: liu21st <liu21st@gmail.com>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
return [
|
||||
// 生成应用公共文件
|
||||
'__file__' => ['common.php', 'config.php', 'database.php'],
|
||||
|
||||
// 定义demo模块的自动生成 (按照实际定义的文件名生成)
|
||||
'demo' => [
|
||||
'__file__' => ['common.php'],
|
||||
'__dir__' => ['behavior', 'controller', 'model', 'view'],
|
||||
'controller' => ['Index', 'Test', 'UserType'],
|
||||
'model' => ['User', 'UserType'],
|
||||
'view' => ['index/index'],
|
||||
],
|
||||
// 其他更多的模块定义
|
||||
];
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: liu21st <liu21st@gmail.com>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
return [
|
||||
// 生成应用公共文件
|
||||
'__file__' => ['common.php', 'config.php', 'database.php'],
|
||||
|
||||
// 定义demo模块的自动生成 (按照实际定义的文件名生成)
|
||||
'demo' => [
|
||||
'__file__' => ['common.php'],
|
||||
'__dir__' => ['behavior', 'controller', 'model', 'view'],
|
||||
'controller' => ['Index', 'Test', 'UserType'],
|
||||
'model' => ['User', 'UserType'],
|
||||
'view' => ['index/index'],
|
||||
],
|
||||
// 其他更多的模块定义
|
||||
];
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
if (!-e $request_filename) {
|
||||
rewrite ^/app/(\w+)/(.*)$ /app/$1/index.php?s=/$2 last;
|
||||
rewrite ^/(.*)$ /index.php?s=/$1 last;
|
||||
if (!-e $request_filename) {
|
||||
rewrite ^/app/(\w+)/(.*)$ /app/$1/index.php?s=/$2 last;
|
||||
rewrite ^/(.*)$ /index.php?s=/$1 last;
|
||||
}
|
|
@ -1,25 +1,25 @@
|
|||
@CHARSET "UTF-8";
|
||||
.content-wrapper .content-header{display:none;}
|
||||
.content-wrapper .content{padding:0;height:100%;overflow:hidden;position:relative;}
|
||||
.content-wrapper{background:#fdfdfd;}
|
||||
|
||||
.manage-nav{margin:0;padding:0px;overflow:hidden;list-style:none;border-bottom:1px solid #ddd;background:#ecf0f5;}
|
||||
.manage-nav li{padding:8px 0px 8px 15px;margin:0;float:left;}
|
||||
.manage-nav .active{font-weight:bold;}
|
||||
.manage-nav .glyphicon-list{margin-top:1px;}
|
||||
|
||||
.dl-info{}
|
||||
.dl-info dt{float:left;clear:left;width:60px;padding-top:10px;}
|
||||
.dl-info dd{margin-left:60px;padding-top:10px;}
|
||||
|
||||
.iframe-main{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display:none;
|
||||
border-top-width: 0px;
|
||||
border-right-width: 0px;
|
||||
border-bottom-width: 0px;
|
||||
border-left-width: 0px;
|
||||
}
|
||||
.iframe-loading{position:absolute;left:20px;top:60px;line-height:32px;text-align:center;}
|
||||
@CHARSET "UTF-8";
|
||||
.content-wrapper .content-header{display:none;}
|
||||
.content-wrapper .content{padding:0;height:100%;overflow:hidden;position:relative;}
|
||||
.content-wrapper{background:#fdfdfd;}
|
||||
|
||||
.manage-nav{margin:0;padding:0px;overflow:hidden;list-style:none;border-bottom:1px solid #ddd;background:#ecf0f5;}
|
||||
.manage-nav li{padding:8px 0px 8px 15px;margin:0;float:left;}
|
||||
.manage-nav .active{font-weight:bold;}
|
||||
.manage-nav .glyphicon-list{margin-top:1px;}
|
||||
|
||||
.dl-info{}
|
||||
.dl-info dt{float:left;clear:left;width:60px;padding-top:10px;}
|
||||
.dl-info dd{margin-left:60px;padding-top:10px;}
|
||||
|
||||
.iframe-main{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display:none;
|
||||
border-top-width: 0px;
|
||||
border-right-width: 0px;
|
||||
border-bottom-width: 0px;
|
||||
border-left-width: 0px;
|
||||
}
|
||||
.iframe-loading{position:absolute;left:20px;top:60px;line-height:32px;text-align:center;}
|
||||
.iframe-loading .loading{float:left;margin-right:5px;}
|
|
@ -1,12 +1,12 @@
|
|||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| SkyCaiji (蓝天采集器)
|
||||
|--------------------------------------------------------------------------
|
||||
| Copyright (c) 2018 https://www.skycaiji.com All rights reserved.
|
||||
|--------------------------------------------------------------------------
|
||||
| 使用协议 https://www.skycaiji.com/licenses
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| SkyCaiji (蓝天采集器)
|
||||
|--------------------------------------------------------------------------
|
||||
| Copyright (c) 2018 https://www.skycaiji.com All rights reserved.
|
||||
|--------------------------------------------------------------------------
|
||||
| 使用协议 https://www.skycaiji.com/licenses
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
'use strict';function AppClass(){}
|
||||
AppClass.prototype={constructor:AppClass,init_list:function(){var $_o=this;$(document).ready(function(){$('#app_list').on('click','.install',function(){var obj=$(this);var parent=obj.parents('tr[data-app]');var app=parent.attr('data-app');if(parent.attr('data-agreement')){windowModal('协议',ulink('Admin/App/agreement?app=_app_',{'_app_':app}))}else{confirmRight('是否安装?',function(){windowModal('正在安装...',ulink('Admin/App/install?app=_app_',{'_app_':app}))})}});$('#app_list').on('click','.uninstall',function(){var obj=$(this);confirmRight('卸载会清理相关数据,确定卸载?',function(){var app=obj.parents('tr[data-app]').attr('data-app');windowModal('正在卸载...',ulink('Admin/App/uninstall?app=_app_',{'_app_':app}))})});$('#app_list').on('click','.upgrade',function(){var obj=$(this);confirmRight('确定升级至新版本?',function(){var app=obj.parents('tr[data-app]').attr('data-app');windowModal('正在升级...',ulink('Admin/App/upgrade?app=_app_',{'_app_':app}))})});$('#app_list').on('click','.enable',function(){var app=$(this).parents('tr[data-app]').attr('data-app');var enable=$(this).attr('data-enable');enable=parseInt(enable);enable=enable>0?0:1;windowModal((enable?'开启':'关闭')+'应用',ulink('Admin/App/enable?app=_app_&enable=_enable_',{'_app_':app,'_enable_':enable}))});$("[data-toggle='popover']").popover();if($('#auto_check').is(':checked')){$_o.check_update()}
|
||||
$('#auto_check').bind('click',function(){var auto=$(this).is(':checked')?1:0;$.ajax({type:"GET",url:ulink('Mystore/appOp?op=auto_check&auto='+auto),dataType:"json",success:function(data){data.code==1?toastr.success(data.msg):toastr.error(data.msg)}})});$('#btn_check').bind('click',function(){$_o.check_update()})})},init_manage:function(){$('#app_manage .nav-tabs a').bind('click',function(){if($(this).attr('target')=='_blank'){window.open($(this).attr('data-url'),'_blank');return!1}});$('#newest_version').bind('click',function(){var obj=$(this);confirmRight('确定升级至新版本?',function(){var app=obj.attr('data-app');windowModal('正在升级...',ulink('Admin/App/upgrade?app=_app_',{'_app_':app}))})});$('#enable').bind('click',function(){var app=$(this).attr('data-app');var enable=$(this).attr('data-enable');enable=parseInt(enable);enable=enable>0?0:1;windowModal((enable?'开启':'关闭')+'应用',ulink('Admin/App/enable?app=_app_&enable=_enable_',{'_app_':app,'_enable_':enable}))});if(document.getElementById('iframe_main')){var boxHeight=$(window).height()-$('.main-header').height();$('.content').height(boxHeight+'px');boxHeight=boxHeight-$('.content .manage-nav').height();$('.content .manage-wrap').height(boxHeight);$('#iframe_main').on('load',function(){$('.iframe-loading').remove();$(this).show()})}},check_update:function(){var apps=new Array();$('#app_list').find('tr[data-app]').each(function(){apps.push($(this).attr('data-app'))});if(apps.length>0){$('#btn_check').html('检测更新 <img src="'+window.site_config.pub+'/static/images/load1.gif" style="width:12px;vertical-align:middle;">');$('.app-store-info').find('.has-update').remove();$.ajax({type:"get",url:ulink('Mystore/appOp?op=check_store_update'),dataType:"json",async:!0,data:{apps:apps},success:function(data){if(data.code==1&&data.data){for(var i in data.data){var app=data.data[i];var storeInfo=$('tr[data-app="'+app.app+'"]').find('.app-store-info');var html='<div class="has-update"><span class="glyphicon glyphicon-exclamation-sign"></span>有更新</div>';storeInfo.append(html)}}else{ajaxDataMsg(data)}},complete:function(){$('#btn_check').html('检测更新')}})}},};var appClass=new AppClass();$(document).ready(function(){storeClass.init_my()})
|
|
@ -1,12 +1,12 @@
|
|||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| SkyCaiji (蓝天采集器)
|
||||
|--------------------------------------------------------------------------
|
||||
| Copyright (c) 2018 https://www.skycaiji.com All rights reserved.
|
||||
|--------------------------------------------------------------------------
|
||||
| 使用协议 https://www.skycaiji.com/licenses
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| SkyCaiji (蓝天采集器)
|
||||
|--------------------------------------------------------------------------
|
||||
| Copyright (c) 2018 https://www.skycaiji.com All rights reserved.
|
||||
|--------------------------------------------------------------------------
|
||||
| 使用协议 https://www.skycaiji.com/licenses
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
'use strict';function ProviderClass(){}
|
||||
ProviderClass.prototype={constructor:ProviderClass,list_init:function(){$('#form_list').on('click','.delete',function(){var tr=$(this).parents('tr[data-id]');var id=tr.attr('data-id');confirmRight('确定删除?',function(){$.ajax({type:'GET',url:ulink('Provider/delete?id='+id),dataType:'json',success:function(data){if(data.code){tr.remove();toastr.success('删除成功')}else{toastr.error(data.msg)}}})})});$('#form_list').on('click','.comment',function(){var url=$(this).parents('tr[data-url]').attr('data-url');url='https://www.skycaiji.com/provider?url='+encodeURIComponent(url);windowStore('评价',url,{lg:1});return!1});$('#form_list').on('click','.edit',function(){var id=$(this).parents('tr[data-id]').attr('data-id');windowModal('编辑',ulink('provider/save?id='+id));return!1});$('#form_list').on('click','.store',function(){var url=$(this).parents('tr[data-url]').attr('data-url');window.location.href=ulink('Store/index?url='+encodeURIComponent(url));return!1});$('#form_list').on('click','.enable',function(){var obj=$(this);var id=$(this).parents('tr[data-id]').attr('data-id');var enable=($(this).text()=='允许')?0:1;$.ajax({type:'GET',url:ulink('Provider/enable?id='+id+'&enable='+enable),dataType:'json',success:function(data){if(data.code){obj.text(enable?'允许':'拒绝');obj.css('color',(enable?'green':'red'))}else{toastr.error(data.msg)}}})});$('#btn_add').bind('click',function(){windowModal('添加',ulink('provider/save'));return!1})},load:function(data){var fid='#win_form_provider';if(data){$(fid).find('[name="url"]').val(data.url);$(fid).find('[name="title"]').val(data.title);$(fid).find('[name="sort"]').val(data.sort);$(fid).find('[name="enable"][value="'+data.enable+'"]').prop('checked','checked')}}}
|
||||
var providerClass=new ProviderClass()
|
Loading…
Reference in New Issue