Skip to content
This repository has been archived by the owner on May 7, 2021. It is now read-only.

人员管理

张铭阳 edited this page Sep 30, 2017 · 4 revisions

实例化

use EasyDingTalk\Application;

$app = new Application(...);
$user = $app->user;

获取成员详情

API:

array get(string $userId)

Example:

$user->get('manager1234');

创建成员

API:

array create(array $params)

Example:

$user->create([
    'name' => '张三',
    'department' => [1, 2],
    // ...
]);

更新成员

API:

array update(array $params)

Example:

$user->update([
    'userid' => 'zhangsan',
    'name' => '张三',
    // ...
]);

删除成员

API:

array delete(string $userId)

Example:

$user->delete('zhangsan');

批量删除成员

API:

array delete(array $userIds)

Example:

$user->delete(['zhangsan', 'lisi']);

获取部门成员

API:

array simpleList(int $departmentId, array $params = [])

Example:

$user->simpleList(12562);

// 或传入其他非必填参数
$user->simpleList(12562, [
    'size' => 50,
    'offset' => 20,
]);

获取部门成员(详情)

API:

array list(int $departmentId, int $size, int $offset, array $params = [])

Example:

$user->list(12562, 20, 10);

// 或传入其他非必填参数
$user->list(12562, 20, 10, [
    'order' => 'entry_desc',
]);

获取管理员列表

API:

array admin()

Example:

$user->admin();

根据unionid获取成员的userid

API:

array toUserId($unionId)

Example:

$user->toUserId('xxxxxx');

获取企业员工人数

API:

array count(array $params)

Example:

// 获取未激活人员数量
$user->count([
    'onlyActive' => 0,
]);

// 获取已经激活人员数量
$user->count([
    'onlyActive' => 1,
]);