feat: 后端全量更新 - 含所有本次需求
- Contract.php: 返回合约账户余额(balance_contract) - My.php: 地址管理增加BTC/ETH - AppContract.php: 一键平仓(closeall) - AppProxy.php: 代理专属注册链接 + 分级权限(L1/L2) - site.php: 手续费减半(0.018→0.009) - agent_permission_setup.sql: 代理权限SQL - crypto_news_crawler.py: 新闻自动采集脚本
This commit is contained in:
+125
@@ -0,0 +1,125 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\btpanel;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
use addons\btpanel\library\Api;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class Ajax extends Backend
|
||||
{
|
||||
protected $noNeedRight = ['*'];
|
||||
protected $api = null;
|
||||
public function _initialize()
|
||||
{
|
||||
$config = get_addon_config('btpanel');
|
||||
if (!$config['key']) {
|
||||
$this->error('未设置BT面板接口密钥,请先设置插件');
|
||||
}
|
||||
parent::_initialize();
|
||||
$this->api=new Api();
|
||||
}
|
||||
public function getWebSiteDomain()
|
||||
{
|
||||
$id = $this->request->request('id', -1);
|
||||
return json($this->api->getWebSiteDomain($id));
|
||||
}
|
||||
|
||||
public function updatePanel()
|
||||
{
|
||||
return json($this->api->updatePanel());
|
||||
}
|
||||
|
||||
public function getNetWork()
|
||||
{
|
||||
return json($this->api->getNetWork());
|
||||
}
|
||||
public function getLogs()
|
||||
{
|
||||
$type = $this->request->request('type', '');
|
||||
if ($type == 'crontab') {
|
||||
return json($this->api->getLogs($this->request->request(), $type));
|
||||
} else {
|
||||
return json($this->api->getLogs($this->request->request()));
|
||||
}
|
||||
}
|
||||
public function getPanelErrorLogs()
|
||||
{
|
||||
return json($this->api->getPanelErrorLogs());
|
||||
}
|
||||
public function getSiteData()
|
||||
{
|
||||
$type = $this->request->request('type', -1);
|
||||
return json($this->api->getWebSite(['limit'=>9999,'type'=>$type])) ;
|
||||
}
|
||||
public function setControl()
|
||||
{
|
||||
$type = $this->request->request('type', -1);
|
||||
$day = $this->request->request('day', 30);
|
||||
return json($this->api->setControl($type, $day)) ;
|
||||
}
|
||||
public function getMonitorData()
|
||||
{
|
||||
$action = $this->request->request('action', null);
|
||||
$start = $this->request->request('start', null);
|
||||
$end = $this->request->request('end', null);
|
||||
switch ($action) {
|
||||
case 'getLoadAverage':
|
||||
return json($this->api->getLoadAverage($start, $end));
|
||||
case 'getCpuIo':
|
||||
return json($this->api->getCpuIo($start, $end));
|
||||
case 'getDiskIo':
|
||||
return json($this->api->getDiskIo($start, $end));
|
||||
case 'GetNetWorkIo':
|
||||
return json($this->api->GetNetWorkIo($start, $end));
|
||||
default:
|
||||
return json([]);
|
||||
}
|
||||
}
|
||||
public function getCrontab()
|
||||
{
|
||||
return json($this->api->getCrontab()) ;
|
||||
}
|
||||
public function getDataList()
|
||||
{
|
||||
$type = $this->request->request('type', 'sites');
|
||||
return json($this->api->getDataList($type)) ;
|
||||
}
|
||||
public function startTask()
|
||||
{
|
||||
$id = $this->request->request('id', null);
|
||||
return json($this->api->startTask($id)) ;
|
||||
}
|
||||
public function getCrontabFind()
|
||||
{
|
||||
$id = $this->request->request('id', null);
|
||||
return json($this->api->getCrontabFind($id)) ;
|
||||
}
|
||||
public function modifyCrond()
|
||||
{
|
||||
$params = $this->request->request();
|
||||
return json($this->api->modifyCrond($params)) ;
|
||||
}
|
||||
public function setCronStatus()
|
||||
{
|
||||
$id = $this->request->request('id', null);
|
||||
return json($this->api->setCronStatus($id)) ;
|
||||
}
|
||||
public function addCrontab()
|
||||
{
|
||||
$params = $this->request->request();
|
||||
return json($this->api->addCrontab($params)) ;
|
||||
}
|
||||
public function delCrontab()
|
||||
{
|
||||
$id = $this->request->request('id', null);
|
||||
return json($this->api->delCrontab($id)) ;
|
||||
}
|
||||
public function delLogs()
|
||||
{
|
||||
$id = $this->request->request('id', null);
|
||||
return json($this->api->delLogs($id)) ;
|
||||
}
|
||||
}
|
||||
+109
@@ -0,0 +1,109 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\btpanel;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
use addons\btpanel\library\Api;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class Crontab extends Backend
|
||||
{
|
||||
protected $noNeedRight = ['index'];
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$config = get_addon_config('btpanel');
|
||||
if(!$config['key']){
|
||||
$this->error('未设置BT面板接口密钥,请先设置插件');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 首页
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$api = new Api();
|
||||
$m_SetControl = $api->setControl();
|
||||
$this->assignconfig('SetControl', $m_SetControl);
|
||||
return $this->view->fetch();
|
||||
}
|
||||
public function add(){
|
||||
$data = $this->getBaseData();
|
||||
$this->assignconfig('crontab', $data);
|
||||
$this->view->assign('data', $data);
|
||||
return $this->view->fetch();
|
||||
}
|
||||
public function edit($id=null){
|
||||
$api = new Api();
|
||||
$data = $this->getBaseData();
|
||||
$m_getCrontabFind = $api->getCrontabFind($id);
|
||||
$this->view->assign('row', $m_getCrontabFind);
|
||||
$this->assignconfig('row', $m_getCrontabFind);
|
||||
$this->assignconfig('crontab', $data);
|
||||
$this->view->assign('data', $data);
|
||||
return $this->view->fetch();
|
||||
}
|
||||
private function getBaseData(){
|
||||
$data=[];
|
||||
$api = new Api();
|
||||
$m_DataList_Sites = $api->getDataList('sites');
|
||||
$m_DataList_Database = $api->getDataList('databases');
|
||||
$data['dataListSites']=[];
|
||||
$data['dataListDatabases']=[];
|
||||
if (isset($m_DataList_Sites['data'])) {
|
||||
$data['dataListSites']['sNameArray'][] = ['name'=>'所有','value'=>'ALL'];
|
||||
foreach ($m_DataList_Sites['data'] as $item) {
|
||||
$data['dataListSites']['sNameArray'][]=['name'=>$item['name'].' ['.$item['ps'].']','value'=>$item['name']];
|
||||
}
|
||||
$data['dataListSites']['backupsArray'][]=['name'=>'服务器磁盘','value'=>'localhost'];
|
||||
foreach ($m_DataList_Sites['orderOpt'] as $item) {
|
||||
$data['dataListSites']['backupsArray'][]=['name'=>$item['name'] ,'value'=>$item['value']];
|
||||
}
|
||||
}
|
||||
if (isset($m_DataList_Database['data'])) {
|
||||
$data['dataListDatabases']['sNameArray'][] = ['name'=>'所有','value'=>'ALL'];
|
||||
foreach ($m_DataList_Database['data'] as $item) {
|
||||
$data['dataListDatabases']['sNameArray'][]=['name'=>$item['name'].' ['.$item['ps'].']','value'=>$item['name']];
|
||||
}
|
||||
$data['dataListDatabases']['backupsArray'][]=['name'=>'服务器磁盘','value'=>'localhost'];
|
||||
foreach ($m_DataList_Database['orderOpt'] as $item) {
|
||||
$data['dataListDatabases']['backupsArray'][]=['name'=>$item['name'] ,'value'=>$item['value']];
|
||||
}
|
||||
}
|
||||
// echo "<pre>";print_r($data);echo "<pre>";die;
|
||||
|
||||
$data['sTypeArray']=[
|
||||
'toShell'=>'Shell脚本',
|
||||
'site'=>'备份网站',
|
||||
'database'=>'备份数据库',
|
||||
'logs'=>'日志切割',
|
||||
'path'=>'备份目录',
|
||||
'syncTime'=>'同步时间',
|
||||
'rememory'=>'释放内存',
|
||||
'toUrl'=>'访问URL'
|
||||
];
|
||||
$data['cycleArray']=[
|
||||
'day'=>'每天',
|
||||
'day-n'=>'N天',
|
||||
'hour'=>'每小时',
|
||||
'hour-n'=>'N小时',
|
||||
'minute-n'=>'N分钟',
|
||||
'week'=>'每星期',
|
||||
'month'=>'每月'
|
||||
];
|
||||
$data['weekArray']= [
|
||||
1=> '周一',
|
||||
2=>'周二',
|
||||
3=>'周三',
|
||||
4=>'周四',
|
||||
5=>'周五',
|
||||
6=>'周六',
|
||||
7=>'周日'
|
||||
];
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\btpanel;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
use addons\btpanel\library\Api;
|
||||
use think\Config;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class Index extends Backend
|
||||
{
|
||||
|
||||
protected $noNeedRight = ['index'];
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$config = get_addon_config('btpanel');
|
||||
$this->assignconfig('btpanel',$config);
|
||||
if(!$config['key']){
|
||||
$this->error('未设置BT面板接口密钥,请先设置插件');
|
||||
}
|
||||
if($config['admin'] && $this->auth->username !== 'admin'){
|
||||
$this->error('仅限管理员访问');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 首页
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$api = new Api();
|
||||
$m_SystemTotal = $api->getSystemTotal();
|
||||
$m_SiteTypes = $api->getSiteTypes();
|
||||
$this->view->assign('SystemTotal',$m_SystemTotal);
|
||||
$this->view->assign('SiteTypes',$m_SiteTypes);
|
||||
return $this->view->fetch();
|
||||
}
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\btpanel;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
use addons\btpanel\library\Api;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class Logs extends Backend
|
||||
{
|
||||
protected $noNeedRight = ['index'];
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$config = get_addon_config('btpanel');
|
||||
if(!$config['key']){
|
||||
$this->error('未设置BT面板接口密钥,请先设置插件');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 首页
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$api = new Api();
|
||||
$api->getTaskCount();
|
||||
return $this->view->fetch();
|
||||
}
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\btpanel;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
use addons\btpanel\library\Api;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class Monitor extends Backend
|
||||
{
|
||||
protected $noNeedRight = ['index'];
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$config = get_addon_config('btpanel');
|
||||
if(!$config['key']){
|
||||
$this->error('未设置BT面板接口密钥,请先设置插件');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 首页
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$api = new Api();
|
||||
$m_SetControl = $api->setControl();
|
||||
$this->assignconfig('SetControl', $m_SetControl);
|
||||
return $this->view->fetch();
|
||||
}
|
||||
}
|
||||
BIN
Binary file not shown.
|
After Width: | Height: | Size: 50 KiB |
Reference in New Issue
Block a user