From 60a813524ce3dcb807e765fa7a28c5b742b003a8 Mon Sep 17 00:00:00 2001 From: youda Date: Fri, 16 May 2025 18:47:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/controller/User.php | 70 ++++++++++--------- app/api/controller/Config.php | 2 +- app/api/controller/Login.php | 4 +- .../server/platform/MiniProgramPlatform.php | 5 ++ 4 files changed, 46 insertions(+), 35 deletions(-) diff --git a/app/admin/controller/User.php b/app/admin/controller/User.php index f0b30f5..8e99dd1 100755 --- a/app/admin/controller/User.php +++ b/app/admin/controller/User.php @@ -1577,8 +1577,8 @@ class User extends Base IFNULL(sum(price),0) money_1, IFNULL(sum(use_money),0) money_2, IFNULL(sum(price)+SUM(use_money),0) use_money, - (select IFNULL(sum(goodslist_money),0) sc_money from order_list where user_id=o.user_id and status=2 {$whereUser2}) fh_money, - (select IFNULL(sum(goodslist_money),0) sc_money from order_list where user_id=o.user_id and status=0 {$whereUser3}) bb_money, + (select IFNULL(sum(goodslist_money),0) sc_money from order_list where user_id=o.user_id and status=2 and goodslist_type<3 {$whereUser2}) fh_money, + (select IFNULL(sum(goodslist_money),0) sc_money from order_list where user_id=o.user_id and status=0 and goodslist_type<3 {$whereUser3}) bb_money, (TRUNCATE(u.money2/100, 2)) money2, (TRUNCATE(IFNULL((SELECT money FROM profit_money2 where user_id=o.user_id {$whereUser1} order by id desc LIMIT 1),0)/100, 2)) sy_money FROM `order` o LEFT join `user` u ON o.user_id=u.id where {$whereUser} group by o.user_id ) t where use_money>0 @@ -1654,7 +1654,7 @@ class User extends Base $whereUser .= " and o.addtime > {$start_time} and o.addtime < {$end_time}"; $whereUser1 = " and addtime > {$start_time} and addtime < {$end_time}"; $whereUser2 = " and choice_time > {$start_time} and choice_time < {$end_time}"; - $whereUser3 = " and addtime < {$start_time} "; + $whereUser3 = " and addtime < {$end_time} "; } } @@ -1675,40 +1675,44 @@ class User extends Base } } - // 构建SQL查询 - 不应用分页限制,获取全部数据 - $sql = "select c.* from ( - select t.*, - (CASE - WHEN t.use_money>0 THEN (t.use_money-t.fh_money-t.bb_money-t.sy_money) - ELSE 0 - END) yue_money - from ( - SELECT o.user_id, u.uid, u.nickname, u.headimg, u.mobile, - u.money, - u.integral, - count(1) orderCount, - sum(IFNULL(order_zhe_total,0)) order_zhe_total, - IFNULL(sum(price),0) money_1, - IFNULL(sum(use_money),0) money_2, - IFNULL(sum(price)+SUM(use_money),0) use_money, - (select IFNULL(sum(goodslist_money),0) sc_money from order_list where user_id=o.user_id and status=2 {$whereUser2}) fh_money, - (select IFNULL(sum(goodslist_money),0) sc_money from order_list where user_id=o.user_id and status=0 {$whereUser3}) bb_money, - (TRUNCATE(u.money2/100, 2)) money2, - (TRUNCATE(IFNULL((SELECT money FROM profit_money2 where user_id=o.user_id {$whereUser1} order by id desc LIMIT 1),0)/100, 2)) sy_money - FROM `order` o LEFT join `user` u ON o.user_id=u.id where {$whereUser} group by o.user_id ) t where use_money>0 - ) c order by yue_money desc"; - //添加日志记录 - \think\facade\Log::info($sql); + // 构建SQL查询 - 不应用分页限制,获取全部数据 + $sql = "select c.* from ( + select t.*, + (CASE + WHEN t.use_money>0 THEN (t.use_money-t.fh_money-t.bb_money-t.sy_money) + ELSE 0 + END) yue_money + from ( + SELECT o.user_id, u.uid, u.nickname, u.headimg, u.mobile, + u.money, + u.integral, + count(1) orderCount, + sum(IFNULL(order_zhe_total,0)) order_zhe_total, + IFNULL(sum(price),0) money_1, + IFNULL(sum(use_money),0) money_2, + IFNULL(sum(price)+SUM(use_money),0) use_money, + (select IFNULL(sum(goodslist_money),0) sc_money from order_list where user_id=o.user_id and status=2 and goodslist_type<3 {$whereUser2}) fh_money, + (select IFNULL(sum(goodslist_money),0) sc_money from order_list where user_id=o.user_id and status=0 and goodslist_type<3 {$whereUser3}) bb_money, + (TRUNCATE(u.money2/100, 2)) money2, + (TRUNCATE(IFNULL((SELECT money FROM profit_money2 where user_id=o.user_id {$whereUser1} order by id desc LIMIT 1),0)/100, 2)) sy_money + FROM `order` o LEFT join `user` u ON o.user_id=u.id where {$whereUser} group by o.user_id ) t where use_money>0 + ) c order by yue_money desc"; + + //添加日志记录 + \think\facade\Log::info($sql); + // 执行查询 $list = \think\facade\Db::query($sql); // 处理结果数据 foreach ($list as &$item) { + // 处理图片URL + $item['headimg'] = empty($item['headimg']) ? '' : imageUrl($item['headimg']); + // 格式化数值 $item['money'] = floatval($item['money']); $item['integral'] = floatval($item['integral']); - $item['money2'] = floatval($item['money2']*100); - $item['sy_money'] = floatval($item['sy_money']*100); + $item['money2'] = floatval($item['money2']); $item['order_zhe_total'] = floatval($item['order_zhe_total']); $item['money_1'] = floatval($item['money_1']); $item['money_2'] = floatval($item['money_2']); @@ -1760,7 +1764,7 @@ class User extends Base 'P' => '剩余达达券', 'Q' => '亏损/盈利状态', 'R' => '亏损/盈利金额', - 'S' => '利润值' + // 'S' => '利润值' ]; foreach ($headers as $key => $val) { @@ -1788,7 +1792,7 @@ class User extends Base $sheet->setCellValue('M' . $row, $item['use_money']); $sheet->setCellValue('N' . $row, $item['fh_money']); $sheet->setCellValue('O' . $row, $item['bb_money']); - $sheet->setCellValue('P' . $row, "用户剩余:".$item['sy_money']); + $sheet->setCellValue('P' . $row, $item['sy_money']); $sheet->setCellValue('Q' . $row, $item['profit_status']); $sheet->setCellValue('R' . $row, $item['profit_value']); $sheet->setCellValue('S' . $row, $item['yue_money']); @@ -1798,12 +1802,12 @@ class User extends Base // 亏损标红 $sheet->getStyle('Q' . $row)->getFont()->getColor()->setARGB('FFFF0000'); $sheet->getStyle('R' . $row)->getFont()->getColor()->setARGB('FFFF0000'); - $sheet->getStyle('S' . $row)->getFont()->getColor()->setARGB('FFFF0000'); + // $sheet->getStyle('S' . $row)->getFont()->getColor()->setARGB('FFFF0000'); } else { // 盈利标绿 $sheet->getStyle('Q' . $row)->getFont()->getColor()->setARGB('FF008000'); $sheet->getStyle('R' . $row)->getFont()->getColor()->setARGB('FF008000'); - $sheet->getStyle('S' . $row)->getFont()->getColor()->setARGB('FF008000'); + // $sheet->getStyle('S' . $row)->getFont()->getColor()->setARGB('FF008000'); } $row++; diff --git a/app/api/controller/Config.php b/app/api/controller/Config.php index adfb962..7729fe6 100755 --- a/app/api/controller/Config.php +++ b/app/api/controller/Config.php @@ -26,7 +26,7 @@ class Config extends Base return $this->renderSuccess('获取成功', [ 'good_type' => $goodsTypeList, 'app_setting' => $app_setting, - 'version' => '110' + 'version' => '111' ]); } diff --git a/app/api/controller/Login.php b/app/api/controller/Login.php index e07d0c9..0b5c50c 100755 --- a/app/api/controller/Login.php +++ b/app/api/controller/Login.php @@ -795,7 +795,9 @@ class Login extends Base // 获取设备信息 $device = request()->param('device', ''); // 设备类型 $device_info = request()->param('device_info', ''); // 设备详细信息 - + if ($device == "") { + $device = request()->header('client'); + } // 获取IP和地理位置信息 $ip = $this->getRealIp(); $location = ''; diff --git a/app/common/server/platform/MiniProgramPlatform.php b/app/common/server/platform/MiniProgramPlatform.php index 29a00d8..8ee2dde 100644 --- a/app/common/server/platform/MiniProgramPlatform.php +++ b/app/common/server/platform/MiniProgramPlatform.php @@ -72,6 +72,11 @@ class MiniProgramPlatform extends BasePlatform 'msg' => '支付未开放,请在08:00-22:00范围内购买' ]; } + return [ + 'status' => 0, + 'data' => [], + 'msg' => '小程序支付通道维护中,请联系客服下载app。' + ]; $data += ['user' => null, 'price' => 0, 'title' => '', 'attach' => 'order_wxs', 'pre' => 'MH_']; [ 'user' => $user,