完整版V1 加入爬虫功能

This commit is contained in:
root
2026-06-09 03:36:30 +08:00
parent 34d76cce74
commit a68b83fcbd
69 changed files with 5058 additions and 56 deletions
@@ -0,0 +1,50 @@
<?php
declare(strict_types=1);
namespace app\common\library\scrm;
/**
* 云控蜘蛛统一返回数据结构
*/
class UnifiedScrmData
{
/** @var int 今日新增(完成数量) */
public int $todayNewCount = 0;
/** @var int 在线号码数 */
public int $totalOnline = 0;
/** @var int 离线号码数 */
public int $totalOffline = 0;
/** @var array<int, array{number:string,status:string,newFollowersToday:int}> */
public array $numbers = [];
/** @var int 号码总数 */
public int $total = 0;
/**
* @param string $number 号码
* @param bool $isOnline 是否在线
* @param int $newFollowersToday 今日进线
*/
public function addNumber(string $number, bool $isOnline, int $newFollowersToday = 0): void
{
$number = trim($number);
if ($number === '') {
return;
}
$this->numbers[] = [
'number' => $number,
'status' => $isOnline ? 'online' : 'offline',
'newFollowersToday' => max(0, $newFollowersToday),
];
if ($isOnline) {
$this->totalOnline++;
} else {
$this->totalOffline++;
}
}
}