- 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: 新闻自动采集脚本
175 lines
7.4 KiB
PHP
Executable File
175 lines
7.4 KiB
PHP
Executable File
<?php
|
|
|
|
namespace app\admin\controller;
|
|
|
|
use app\common\controller\Backend;
|
|
use think\Config;
|
|
use think\Db;
|
|
|
|
/**
|
|
* 控制台
|
|
*
|
|
* @icon fa fa-dashboard
|
|
* @remark 用于展示当前系统中的统计数据、统计报表及重要实时数据
|
|
*/
|
|
class Dashboard extends Backend
|
|
{
|
|
|
|
/**
|
|
* 查看
|
|
*/
|
|
public function index()
|
|
{
|
|
$admin_id = $this->auth->id;
|
|
|
|
$team_arr = Db::name("user")->field("id,jointime")->select();
|
|
if($admin_id > 1){
|
|
$user = Db::name("user")->where("admin_id",$admin_id)->find();
|
|
if($user){
|
|
$team_arr = Db::name("user")->field("id,jointime")->where("path","like",$user['path']."%")->select();
|
|
}
|
|
}
|
|
$son_arr = [];
|
|
foreach ($team_arr as $ke => $val) {
|
|
$son_arr[] = $val['id'];
|
|
}
|
|
$today = strtotime(date("Y-m-d"));
|
|
$yestoday = $today-86400;
|
|
//团队人数
|
|
$count_user = count($team_arr);$today_user = 0;$yestoday_user = 0;
|
|
foreach ($team_arr as $key => $value) {
|
|
if(in_array($val['id'], $son_arr) && $value['jointime']>$today){
|
|
$today_user = $today_user+1;
|
|
}
|
|
if(in_array($val['id'], $son_arr) && $value['jointime']<$today && $value['jointime']>$yestoday){
|
|
$yestoday_user = $yestoday_user+1;
|
|
}
|
|
}
|
|
//累计充值
|
|
$rechrge = Db::name("app_recharge")->field("user_id,num,addtime")->where("status",1)->select();
|
|
$count_reg = 0;$today_reg = 0;$yestoday_reg = 0;
|
|
foreach ($rechrge as $ke => $val) {
|
|
if(in_array($val['user_id'], $son_arr)){
|
|
$count_reg = $count_reg+$val['num'];
|
|
}
|
|
if(in_array($val['user_id'], $son_arr) && $val['addtime']>$today){
|
|
$today_reg = $today_reg+$val['num'];
|
|
}
|
|
if(in_array($val['user_id'], $son_arr) && $val['addtime']<$today && $val['addtime']>$yestoday){
|
|
$yestoday_reg = $yestoday_reg+$val['num'];
|
|
}
|
|
}
|
|
//累计提现
|
|
$widthdraw = Db::name("app_widthdraw")->field("user_id,num,add_time")->where("status",1)->select();
|
|
$count_wid = 0;$today_wid = 0;$yestoday_wid = 0;
|
|
foreach ($widthdraw as $ke => $val) {
|
|
if(in_array($val['user_id'], $son_arr)){
|
|
$count_wid = $count_wid+$val['num'];
|
|
}
|
|
if(in_array($val['user_id'], $son_arr) && $val['add_time']>$today){
|
|
$today_wid = $today_wid+$val['num'];
|
|
}
|
|
if(in_array($val['user_id'], $son_arr) && $val['add_time']<$today && $val['add_time']>$yestoday){
|
|
$yestoday_wid = $yestoday_wid+$val['num'];
|
|
}
|
|
}
|
|
//币币
|
|
$trade = Db::name("app_coin_trade")->field("user_id,have_usdt,createtime")->where("status",1)->select();
|
|
$count_trade = 0;$today_trade = 0;$yestoday_trade = 0;
|
|
foreach ($trade as $ke => $val) {
|
|
if(in_array($val['user_id'], $son_arr)){
|
|
$count_trade = $count_trade+$val['have_usdt'];
|
|
}
|
|
if(in_array($val['user_id'], $son_arr) && $val['createtime']>$today){
|
|
$today_trade = $today_trade+$val['have_usdt'];
|
|
}
|
|
if(in_array($val['user_id'], $son_arr) && $val['createtime']<$today && $val['createtime']>$yestoday){
|
|
$yestoday_trade = $yestoday_trade+$val['have_usdt'];
|
|
}
|
|
}
|
|
//合约
|
|
$contract = Db::name("app_contract")->field("user_id,num,createtime")->where("status",1)->select();
|
|
$count_cont = 0;$today_cont = 0;$yestoday_cont = 0;
|
|
foreach ($contract as $ke => $val) {
|
|
if(in_array($val['user_id'], $son_arr)){
|
|
$count_cont = $count_cont+$val['num'];
|
|
}
|
|
if(in_array($val['user_id'], $son_arr) && $val['createtime']>$today){
|
|
$today_cont = $today_cont+$val['num'];
|
|
}
|
|
if(in_array($val['user_id'], $son_arr) && $val['createtime']<$today && $val['createtime']>$yestoday){
|
|
$yestoday_cont = $yestoday_cont+$val['num'];
|
|
}
|
|
}
|
|
//ICO
|
|
$detail = Db::name("his_order")->field("user_id,trade_num,createtime")->select();
|
|
$count_ico = 0;$today_ico = 0;$yestoday_ico = 0;
|
|
foreach ($detail as $ke => $val) {
|
|
if(in_array($val['user_id'], $son_arr)){
|
|
$count_ico = $count_ico+$val['trade_num'];
|
|
}
|
|
if(in_array($val['user_id'], $son_arr) && $val['createtime']>$today){
|
|
$today_ico = $today_ico+$val['trade_num'];
|
|
}
|
|
if(in_array($val['user_id'], $son_arr) && $val['createtime']<$today && $val['createtime']>$yestoday){
|
|
$yestoday_ico = $yestoday_ico+$val['trade_num'];
|
|
}
|
|
}
|
|
$this->view->assign([
|
|
'count_user' => $count_user,
|
|
'today_user' => $today_user,
|
|
'yestoday_user' => $yestoday_user,
|
|
'count_reg' => sprintf("%.2f",$count_reg),
|
|
'today_reg' => sprintf("%.2f",$today_reg),
|
|
'yestoday_reg' => sprintf("%.2f",$yestoday_reg),
|
|
'count_wid' => sprintf("%.2f",$count_wid),
|
|
'today_wid' => sprintf("%.2f",$today_wid),
|
|
'yestoday_wid' => sprintf("%.2f",$yestoday_wid),
|
|
'count_trade' => sprintf("%.2f",$count_trade),
|
|
'today_trade' => sprintf("%.2f",$today_trade),
|
|
'yestoday_trade' => sprintf("%.2f",$yestoday_trade),
|
|
'count_cont' => sprintf("%.2f",$count_cont),
|
|
'today_cont' => sprintf("%.2f",$today_cont),
|
|
'yestoday_cont' => sprintf("%.2f",$yestoday_cont),
|
|
'count_ico' => sprintf("%.2f",$count_ico),
|
|
'today_ico' => sprintf("%.2f",$today_ico),
|
|
'yestoday_ico' => sprintf("%.2f",$yestoday_ico)
|
|
]);
|
|
return $this->view->fetch();
|
|
|
|
// $seventtime = \fast\Date::unixtime('day', -7);
|
|
// $paylist = $createlist = [];
|
|
// for ($i = 0; $i < 7; $i++)
|
|
// {
|
|
// $day = date("Y-m-d", $seventtime + ($i * 86400));
|
|
// $createlist[$day] = mt_rand(20, 200);
|
|
// $paylist[$day] = mt_rand(1, mt_rand(1, $createlist[$day]));
|
|
// }
|
|
// $hooks = config('addons.hooks');
|
|
// $uploadmode = isset($hooks['upload_config_init']) && $hooks['upload_config_init'] ? implode(',', $hooks['upload_config_init']) : 'local';
|
|
// $addonComposerCfg = ROOT_PATH . '/vendor/karsonzhang/fastadmin-addons/composer.json';
|
|
// Config::parse($addonComposerCfg, "json", "composer");
|
|
// $config = Config::get("composer");
|
|
// $addonVersion = isset($config['version']) ? $config['version'] : __('Unknown');
|
|
// $this->view->assign([
|
|
// 'totaluser' => 35200,
|
|
// 'totalviews' => 219390,
|
|
// 'totalorder' => 32143,
|
|
// 'totalorderamount' => 174800,
|
|
// 'todayuserlogin' => 321,
|
|
// 'todayusersignup' => 430,
|
|
// 'todayorder' => 2324,
|
|
// 'unsettleorder' => 132,
|
|
// 'sevendnu' => '80%',
|
|
// 'sevendau' => '32%',
|
|
// 'paylist' => $paylist,
|
|
// 'createlist' => $createlist,
|
|
// 'addonversion' => $addonVersion,
|
|
// 'uploadmode' => $uploadmode
|
|
// ]);
|
|
//
|
|
// return $this->view->fetch();
|
|
}
|
|
|
|
}
|