From ffaf75bb7202eb080a5059c46edc16402ca28c06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E9=92=8A?= Date: Tue, 16 Dec 2025 10:57:25 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E6=98=BE=E7=A4=BA=E5=8A=A0?= =?UTF-8?q?=E9=94=81=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/adminapi/controller/BlindBox.php | 4 +- application/api/model/Tasks.php | 6 + application/cron/controller/Test.php | 119 +++++++++++++++++++ 3 files changed, 127 insertions(+), 2 deletions(-) diff --git a/application/adminapi/controller/BlindBox.php b/application/adminapi/controller/BlindBox.php index 96ce1f30..d264c221 100644 --- a/application/adminapi/controller/BlindBox.php +++ b/application/adminapi/controller/BlindBox.php @@ -757,10 +757,10 @@ class BlindBox extends adminApi $where['createtime'] = ['>=', strtotime($stime)]; } if($etime!==""){ - $where['createtime'] = ['<=', strtotime($etime.'23:59:59')]; + $where['createtime'] = ['<=', strtotime($etime)]; } if($stime!=="" && $etime!==""){ - $where['createtime'] = ['between', [strtotime($stime), strtotime($etime.'23:59:59')]]; + $where['createtime'] = ['between', [strtotime($stime), strtotime($etime)]]; } $count = db::name('vs_gift_bag_receive_pan_log')->where($where)->count(); $lists_data = db::name('vs_gift_bag_receive_pan_log')->where($where)->page($page, $page_limit)->order("id desc")->select(); diff --git a/application/api/model/Tasks.php b/application/api/model/Tasks.php index 12915b32..a2c04c27 100644 --- a/application/api/model/Tasks.php +++ b/application/api/model/Tasks.php @@ -65,6 +65,7 @@ class Tasks extends Model foreach ($this->task_type as $key => $value) { $reslut['tasks'][$key-1]['task_type_id'] = $key; $reslut['tasks'][$key-1]['task_type_name'] = $value; + $reslut['tasks'][$key-1]['is_lock'] = 0; $reslut['tasks'][$key-1]['task_list'] = []; } foreach ($gift_box as $key => $val) { @@ -274,6 +275,11 @@ class Tasks extends Model } } + foreach ($reslut['tasks'] as &$value) { + if(empty($value['task_list'])){ + $value['is_lock'] = 1; + } + } return ['code' => 1, 'msg' => '获取成功', 'data' => $reslut]; } //完成每日任务 diff --git a/application/cron/controller/Test.php b/application/cron/controller/Test.php index 019d67c8..9048d435 100644 --- a/application/cron/controller/Test.php +++ b/application/cron/controller/Test.php @@ -293,4 +293,123 @@ class Test echo "任务历史数据补发完成 用户总数:".count($user_list). " \n"; } + //推算7号平台结余 + public function calc_7_balance(){ + set_time_limit(0); + $jisuan = 0; + + // 分页处理,防止超时 + $pageSize = 100; + $page = 1; + $hasMore = true; + + while ($hasMore) { + // 分页查询用户钱包数据 + $offset = ($page - 1) * $pageSize; + $user_list = db::name('user_wallet') + ->limit($offset, $pageSize) + ->select(); + // 判断是否还有更多数据 + if (count($user_list) < $pageSize) { + $hasMore = false; + } + + // 如果没有数据则退出循环 + if (empty($user_list)) { + break; + } + + foreach ($user_list as $key => $value) { + $earnings = $value['earnings']; + //根据注释,应该计算2025-12-07之前的收益所得 + $income = db::name('vs_user_money_log') + ->where(['user_id'=>$value['user_id']]) + ->whereIn('change_type',[6,9,11,12,18,19,21,22,31,28,34,52,53,54,55,57]) + ->where('createtime','>=', strtotime('2025-12-07')) + ->where('createtime','<=', time()) + ->sum('change_value'); + //根据注释,应该计算2025-12-07之前的消费 + $expense = db::name('vs_user_money_log') + ->where(['user_id'=>$value['user_id']]) + ->whereIn('change_type',[3,14,29]) + ->where('createtime','>=', strtotime('2025-12-07')) + ->where('createtime','<=', time()) + ->sum('change_value'); + $jisuan += ($earnings - $income + $expense); + echo "用户({$value['user_id']}):"."的结余:".($earnings - $income + $expense)."\n"; + } + echo "第".$page."页数据处理完成 \n"; + // 释放内存 + unset($user_list); + $page++; + + // 每处理10页输出一次进度 + if ($page % 10 == 0) { + echo "已处理 {$page} 页数据...\n"; + } + } + echo "2025-12-07以前平台结余:".$jisuan."\n"; + } + public function calc_7_balances(){ + //当前平台结余 + for($i=1;$i<=16;$i++){ + $time = strtotime('2025-12-'.$i); + $all_earnings = db::name('user_wallet')->sum('earnings'); + $all_income = db::name('vs_user_money_log') + ->whereIn('change_type',[6,9,11,12,18,19,21,22,31,28,34,52,53,54,55,57]) + ->where('money_type',2) + ->where('createtime','>=', $time) + ->where('createtime','<=', time()) + ->sum('change_value'); + $all_expense = db::name('vs_user_money_log') + ->whereIn('change_type',[14,29]) + ->where('money_type',2) + ->where('createtime','>=',$time) + ->where('createtime','<=', time()) + ->sum('change_value'); + //提现 + $all_tixian = db::name('vs_user_money_log') + ->whereIn('change_type',[3]) + ->where('money_type',2) + ->where('createtime','>=',$time) + ->where('createtime','<=', time()) + ->sum('change_value'); + //充值 +// $all_recharge = db::name('vs_user_money_log') +// ->where('change_type',2) +// ->where('createtime','>=', $time) +// ->where('createtime','<=', time()) +// ->sum('change_value'); + //充值 + $all_recharge1 = db::name('vs_user_recharge') + ->where('pay_status',2) + ->where('createtime','>=', $time) + ->where('createtime','<=', time()) + ->sum('money'); + $jisuan = ($all_earnings + $all_expense + $all_tixian) - $all_income; + echo date('Y-m-d',time())." 当前平台总结余:".$all_earnings."\n"; + echo date('Y-m-d',$time)." 以后平台总收入(用户总收益):".$all_income."\n"; + echo date('Y-m-d',$time)." 以后平台总支出(用户总消耗钻石红包,兑换金币):".$all_expense."\n"; + echo date('Y-m-d',$time)." 以后的提现记录:".$all_tixian."\n"; + echo date('Y-m-d',$time)." 以后充值(完成):".$all_recharge1 ."\n"; + echo date('Y-m-d',$time)." 以前平台总结余:".$jisuan."\n"; + echo "========================================================"."\n"; + } + } + + //1 + public function calc_1_7_balances(){ + //当前平台结余 + $stime = strtotime('2025-12-01'); + $etime = strtotime('2025-12-08'); + + $all_expense = db::name('vs_user_money_log') + ->whereIn('change_type',[3,14,29]) + ->where('money_type',2) + ->where('createtime','>=',$stime) + ->where('createtime','<=', $etime) + ->sum('change_value'); + echo "2025-12-01至2025-12-07平台总提现:".$all_expense."\n"; + } + } \ No newline at end of file