no message
This commit is contained in:
parent
c260457b5b
commit
586e049fc6
@ -41,7 +41,7 @@ final class Order
|
|||||||
// @list($sCmd, $iDay) = explode("#", $sText, 2);
|
// @list($sCmd, $iDay) = explode("#", $sText, 2);
|
||||||
|
|
||||||
if (!isset($aParam['aArg'][1])) {
|
if (!isset($aParam['aArg'][1])) {
|
||||||
$iDay = 1;
|
$iDay = 0;
|
||||||
} else {
|
} else {
|
||||||
$iDay = $aParam['aArg'][1];
|
$iDay = $aParam['aArg'][1];
|
||||||
}
|
}
|
||||||
@ -52,6 +52,8 @@ final class Order
|
|||||||
}
|
}
|
||||||
|
|
||||||
$sStartTime = strtotime("-$iDay days");
|
$sStartTime = strtotime("-$iDay days");
|
||||||
|
$tmp = date("Y-m-d", $sStartTime);
|
||||||
|
$sStartTime = strtotime($tmp);
|
||||||
|
|
||||||
$aOrderList = ModelOrder::where('update_time', '>=', $sStartTime)
|
$aOrderList = ModelOrder::where('update_time', '>=', $sStartTime)
|
||||||
->whereIn('status', ['activated', 'pending_activation']) // 添加状态条件
|
->whereIn('status', ['activated', 'pending_activation']) // 添加状态条件
|
||||||
|
|||||||
@ -13,38 +13,6 @@ final class SaleCode
|
|||||||
public function List()
|
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');
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user