* Fix bug #50289.
This commit is contained in:
@@ -441,6 +441,36 @@ class feishuapi
|
||||
return $depts;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据open_id列表,获取用户。
|
||||
* Batch get users by open_id list.
|
||||
*
|
||||
* @param array $userIdList
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function batchGetUsers($userIdList)
|
||||
{
|
||||
$openidPairs = array();
|
||||
$userGroup = array_chunk($userIdList, 49);
|
||||
foreach($userGroup as $userIdList)
|
||||
{
|
||||
$urls = array();
|
||||
foreach($userIdList as $userID) $urls[] = $this->apiUrl . "contact/v3/users/{$userID}";
|
||||
$datas = $this->multiRequest($urls);
|
||||
foreach($datas as $response)
|
||||
{
|
||||
$response = json_decode($response);
|
||||
if(empty($response->data->user)) continue;
|
||||
|
||||
$user = $response->data->user;
|
||||
$openidPairs[$user->open_id] = $user->name;
|
||||
}
|
||||
}
|
||||
|
||||
return $openidPairs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for errors.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user