diff --git a/src/Services/Tg/Hook/Mod/Order.php b/src/Services/Tg/Hook/Mod/Order.php index ace69a02..cf15b229 100644 --- a/src/Services/Tg/Hook/Mod/Order.php +++ b/src/Services/Tg/Hook/Mod/Order.php @@ -41,7 +41,7 @@ final class Order // @list($sCmd, $iDay) = explode("#", $sText, 2); if (!isset($aParam['aArg'][1])) { - $iDay = 1; + $iDay = 0; } else { $iDay = $aParam['aArg'][1]; } @@ -52,6 +52,8 @@ final class Order } $sStartTime = strtotime("-$iDay days"); + $tmp = date("Y-m-d", $sStartTime); + $sStartTime = strtotime($tmp); $aOrderList = ModelOrder::where('update_time', '>=', $sStartTime) ->whereIn('status', ['activated', 'pending_activation']) // 添加状态条件 diff --git a/src/Services/Tg/Hook/Mod/SaleCode.php b/src/Services/Tg/Hook/Mod/SaleCode.php index 203219e1..b13c1455 100644 --- a/src/Services/Tg/Hook/Mod/SaleCode.php +++ b/src/Services/Tg/Hook/Mod/SaleCode.php @@ -13,38 +13,6 @@ final class SaleCode public function List() { - @list($sCmd, $iDay) = explode("#", $sText, 2); - - // 确保 $iDay 是一个有效的数字 - if (!is_numeric($iDay) || $iDay < 0) { - $this->sendMessage('无效的天数参数'); - Http::response(200, '内部服务器错误'); - } - - $sStartTime = strtotime("-$iDay days"); - - $aOrderList = Order::where('update_time', '>=', $sStartTime) - ->whereIn('status', ['activated', 'pending_activation']) // 添加状态条件 - ->select('coupon', - \App\Services\DB::raw('count(*) as total'), - \App\Services\DB::raw('SUM(price) as total_price')) - ->groupBy('coupon') - ->get() - ->toArray(); - - $sMsg = '从 '.date("Y-m-d H:i:s", $sStartTime); - foreach ($aOrderList as $row) { - $coupon = str_replace('.', '#', $row['coupon']); - if (!$coupon) { - $coupon = '无'; - } - $sMsg .= "\n\n"; - $sMsg .= $coupon . ' - ' . $row['total_price'] . ' / ' . $row['total']; - } - - $this->sendMessage($sMsg); - - Http::response(200, 'ok'); }