Wechat can recursively obtain department users.

This commit is contained in:
leiyong
2020-03-17 16:32:45 +08:00
parent 9e21c86389
commit b0966e0faf

View File

@@ -59,7 +59,7 @@ class wechatapi
$users = array();
foreach($depts->deptList as $deptID)
{
$response = $this->queryAPI($this->apiUrl . "user/simplelist?access_token={$this->token}&department_id={$deptID}");
$response = $this->queryAPI($this->apiUrl . "user/simplelist?access_token={$this->token}&department_id={$deptID}&fetch_child=1");
if($this->isError()) return array('result' => 'fail', 'message' => $this->errors);
foreach($response->userlist as $user) $users[$user->name] = $user->userid;