Files
li 1b24994e74 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: 新闻自动采集脚本
2026-03-30 20:16:32 +08:00

71 lines
1.6 KiB
PHP
Executable File

<?php
/**
* 隐藏插件,默认开启
*/
class toolsCommonPlugin extends PluginBase{
function __construct(){
parent::__construct();
}
public function regiest(){
$this->hookRegiest(array(
'user.commonJs.insert' => 'toolsCommonPlugin.echoJs'
));
}
public function echoJs($st,$act){
$this->systemBackup();
$this->echoFile('static/main.js');
}
public function systemBackup(){
$system = DATA_PATH.'system/';
$bakcupLast = $system.'backup/last/';
$backupLastDay = $system.'backup/day/'.date('Ymd',time()).'/';
//每N天备份一次;首次备份当天
$backupRepeat = 5;
$day = intval(date('d',time()));
if( !@file_exists($bakcupLast) ||
(!@file_exists($backupLastDay) && $day % $backupRepeat == 0)
){
mk_dir($backupLastDay);
$this->backupTo($backupLastDay);
}
//每天覆盖备份一次
if(!@file_exists($bakcupLast)){
mk_dir($bakcupLast);
$this->backupTo($bakcupLast);
}
$lastTime = @filemtime($bakcupLast.'/system_member.php');
if(time() - $lastTime > 60*60*24){
$this->backupTo($bakcupLast);
}
}
private function backupTo($folder){
$system = DATA_PATH.'system/';
$backFile = array(
'apps.php',
'system_group.php',
'system_member.php',
'system_role.php',
'system_role_group.php',
'system_setting.php',
'desktop_app.php'
);
foreach ($backFile as $file) {
if(file_exists($folder.$file)){
@unlink($folder.$file);
}
@copy($system.$file,$folder.$file);
}
}
/**
* ie8 css hack;
* @return [type] [description]
*/
public function pie(){
header('Content-type: text/x-component');
include($this->pluginPath.'/static/pie/pie.htc');
}
}