no message

This commit is contained in:
hellcat 2025-04-19 20:33:22 +08:00
parent ee894878f9
commit c0f23e8f86
2 changed files with 16 additions and 3 deletions

View File

@ -65,8 +65,8 @@ $oHttp->aData['message']['text'] = '\/user#find 1';
$oHttp->aData['message']['text'] = '\/cmd#list'; $oHttp->aData['message']['text'] = '\/cmd#list';
$oHttp->aData['message']['text'] = '\/visitor#all'; $oHttp->aData['message']['text'] = '\/visitor#all';
$oHttp->aData['message']['text'] = '\/user#report__day'; //$oHttp->aData['message']['text'] = '\/user#report__day';
$oHttp->aData['message']['text'] = '\/user#countReg__date__2021-03-28__2028-03-28'; //$oHttp->aData['message']['text'] = '\/user#countReg__date__2021-03-28__2028-03-28';
//{ //{
// "update_id": 761180998, // "update_id": 761180998,

View File

@ -14,11 +14,24 @@ final class Visitor
{ {
$aVisitors = ModelVisitor::select('from', DB::raw('count(*) as total')) $aVisitors = ModelVisitor::select('from', DB::raw('count(*) as total'))
->groupBy('from') ->groupBy('from')
->orderBy('total', 'desc') // 按 total 降序排序
->get() ->get()
->toArray(); ->toArray();
return json_encode($aVisitors, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT); $sPre = "\n\n---------------------------";
$sMsg = '';
$iTotalCount = 0;
foreach ($aVisitors as $row) {
$sMsg .= "\n\n" . $row['from'] . ":" . $row['total'];
$iTotalCount += $row['total'] ?? 0;
}
$sTotal = "\n\n总数:".$row['total'];
$str = $sPre.$sTotal.$sMsg.$sPre;
return $str;
} }
} }