From 77d9c037a0e981c7611b7d7ca89192b268c35e1e Mon Sep 17 00:00:00 2001 From: youda Date: Mon, 2 Jun 2025 09:46:02 +0800 Subject: [PATCH] 333 --- app/admin/controller/Statistics.php | 6 ++---- app/api/controller/User.php | 20 ++++++++++++++++++-- app/api/route/app.php | 1 + 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/app/admin/controller/Statistics.php b/app/admin/controller/Statistics.php index c742327..30be3a6 100755 --- a/app/admin/controller/Statistics.php +++ b/app/admin/controller/Statistics.php @@ -2175,9 +2175,8 @@ class Statistics extends Base AND u.istest = 0 AND o.status = 1 AND o.addtime >= UNIX_TIMESTAMP(?) - AND o.addtime <= UNIX_TIMESTAMP(?) GROUP BY DATE(FROM_UNIXTIME(o.addtime)) - ", [$startDate, $endDate]); + ", [$startDate]); // 2. 登录人数统计 $loginStats = Db::query(" @@ -2214,9 +2213,8 @@ class Statistics extends Base AND u.status = 1 AND u.istest = 0 AND o.created_at >= ? - AND o.created_at <= ? GROUP BY DATE(o.created_at) - ", [$startDate, $endDate]); + ", [$startDate]); // 生成日期范围内的所有日期 $allDates = []; diff --git a/app/api/controller/User.php b/app/api/controller/User.php index 57e00bf..037c34a 100755 --- a/app/api/controller/User.php +++ b/app/api/controller/User.php @@ -20,6 +20,7 @@ use app\common\server\LiveMoney; use PhpOffice\PhpSpreadsheet\Chart\Legend; use think\facade\Db; use think\Request; +use think\facade\Log; use app\common\server\Qcode; use Qcloud\Cos\Client; class User extends Base @@ -164,9 +165,10 @@ class User extends Base $save['nickname'] = $nickname; } if ($imagebase && $imagebase != "") { - $base64Image = str_replace('data:image/png;base64,', '', $imagebase); + // 提取实际的 Base64 数据部分(去除 data:image/png;base64, 前缀) + $base64_data = substr($imagebase, strpos($imagebase, ',') + 1); // 解码 Base64 数据为二进制数据 - $binaryData = base64_decode($base64Image); + $binaryData = base64_decode($base64_data); // 初始化腾讯云 COS 客户端 $cosClient = new Client([ 'region' => $this->region, @@ -1311,5 +1313,19 @@ class User extends Base } } + /** + * 用户注销 + */ + public function user_log_off() + { + $user_id = $this->getuserid(); + if ($user_id == 0) { + return $this->renderError("未登录"); + } + $type = request()->param('type', 0); + // 输出收集的所有日志 + Log::info("用户id申请注销==》" . $user_id . "==>" . ($type == 0 ? "注销账号" : "取消注销账号")); + return $this->renderSuccess(($type == 0 ? "注销账号" : "取消注销账号") . "成功"); + } } \ No newline at end of file diff --git a/app/api/route/app.php b/app/api/route/app.php index 46a6bf2..fad2a5b 100755 --- a/app/api/route/app.php +++ b/app/api/route/app.php @@ -67,6 +67,7 @@ Route::any('invitation_commission', 'User/invitation_commission'); Route::any('recharge', 'User/recharge'); Route::any('item_card_list', 'User/item_card_list'); Route::any('bind_invite_code', 'User/bind_invite_code'); +Route::any('user_log_off', 'User/user_log_off'); #Rank.php排行榜 #============================ Route::any('rank_week', 'Rank/rank_week');