no message
This commit is contained in:
1 parent
74f61921b3
commit
5bbf50e8b2
8 files changed
+111
-5
No files matched your search
@@ -19,6 +19,8 @@ use App\Models\User;
|
||||
use App\Models\TgStep;
|
||||
use App\Models\Zhuanfas;
|
||||
use App\Models\Ducks;
|
||||
use App\Models\Visitor;
|
||||
use App\Models\CountVisitor;
|
||||
use App\Services\TomTool\TgSendFormat;
|
||||
use App\Services\IM\Telegram;
|
||||
use App\Utils\Tools;
|
||||
@@ -61,6 +63,38 @@ final class Cron
|
||||
{
|
||||
TgStep::where("date", "<=", date('Y-m-d', strtotime('-1 day')))->delete();
|
||||
}
|
||||
|
||||
public static function visitorCount(): void
|
||||
{
|
||||
$oVisitor = Visitor::select('from', DB::raw('count(*) as count'))
|
||||
->groupBy('from')
|
||||
->get();
|
||||
|
||||
foreach ($oVisitor as $row) {
|
||||
|
||||
$oCountVisitor = new CountVisitor();
|
||||
$oCountVisitor->from = $row->from;
|
||||
$oCountVisitor->count = $row->count;
|
||||
$oCountVisitor->date = date('Y-m-d', strtotime('-1 day'));
|
||||
$oCountVisitor->save();
|
||||
|
||||
}
|
||||
|
||||
Visitor::truncate();
|
||||
|
||||
// tg报表
|
||||
$aCountVisitor = CountVisitor::where('date', date('Y-m-d', strtotime('-1 day')))->get()->toArray();
|
||||
|
||||
$sTgReport = '';
|
||||
foreach ($aCountVisitor as $row) {
|
||||
|
||||
$sTgReport .= $row["from"].":".$row["count"]."\n";
|
||||
|
||||
}
|
||||
|
||||
(new Telegram())->send(0, $sTgReport);
|
||||
|
||||
}
|
||||
|
||||
public static function detectInactiveUser(): void
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user