Gateway::sendToGroup第一個參數(shù)$group指的是什么?我試過傳入client_id數(shù)組和uid數(shù)組都沒用,
if (count((array)$to) > 1) {
$to = array_unique(array_filter($to));
if (!empty($exclude_client_id) && $toType == 'uid') { // 排除目標(biāo):分組推送
// 如果是uid則將uid轉(zhuǎn)換為綁定的client_id
$exclude_ids = [];
foreach ((array)$exclude_client_id as $item) {
$exclude_ids = array_merge($exclude_ids, Gateway::getClientIdByUid($item));
}
$exclude_client_id = $exclude_ids;
}
if ($toType == 'uid') {
$clientIds = [];
foreach ((array)$to as $uid) {
$cid = Gateway::getClientIdByUid($uid);
file_put_contents(__DIR__ . '/日志.log', $uid . '::' . json_encode($cid) . "\r\n", FILE_APPEND);
$clientIds = array_merge($clientIds, $cid);
}
} else {
$clientIds = $to;
}
file_put_contents(__DIR__ . '/日志.log', json_encode([
'to' => $to,
'clients' => $clientIds,
'exclude' => $exclude_client_id,
'msg' => $message,
]) . "\r\n", FILE_APPEND);
return Gateway::sendToGroup((array)$clientIds, $message, $exclude_client_id);
}
要先joinGroup,參考文檔 http://wtbis.cn/doc/gateway-worker/join-group.html
group是一個群體的標(biāo)識,例如QQ群里的群ID
后來才發(fā)現(xiàn),這尼瑪只能傳 Gateway::joinGroup($clientId, '分組名稱');中的分組名稱或者分組名稱數(shù)組,不能直接傳client_id數(shù)組