toArray() : []; if (empty($accounts)) { dd('查询不到公众号'); } $client = new Client(['timeout' => 10, 'verify' => false]); $accountsArr = array_chunk($accounts, 50); foreach ($accountsArr as $accountList) { $reportData = [ 'platform' => 'wangduyun', 'list' => [] ]; foreach ($accountList as $account) { $reportData['list'][] = [ 'id' => getProp($account, 'id'), 'name' => getProp($account, 'nickname'), 'app_id' => getProp($account, 'appid'), 'channel_id' => getProp($account, 'distribution_channel_id'), ]; } // 执行上报 $url = 'https://firetrack.wd.amanbook.com/api/syncOfficialAccounts'; $client->post($url, [ 'headers' => [ 'x-code' => 'Mvnx1Yr3O8i!TS5u' ], 'json' => $reportData ]); } } }