Files
huangjingfen/pro_v3.5.1/crmeb/services/wechat/client/work/UserClient.php
panchengyong c1e74d8e68 chore(php): 统一 ScottPan 文件头与注释域名替换
- 按 docs/renew-code-comment.md 将 PHP 文件头改为带边框的 Author 注释\n- 注释中的 crmeb.com 替换为 uj345.cn(代码字符串中的外链未改)\n- 新增 docs/renew-code-comment.md 说明

Made-with: Cursor
2026-03-29 11:22:58 +08:00

79 lines
2.1 KiB
PHP

<?php
// +----------------------------------------------------------------------
// | Author: ScottPan Team
// +----------------------------------------------------------------------
namespace crmeb\services\wechat\client\work;
use crmeb\services\wechat\client\BaseClient;
use EasyWeChat\Kernel\HttpClient\Response;
use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface;
use Symfony\Contracts\HttpClient\ResponseInterface;
/**
* 用户
* Class UserClient
* @author 等风来
* @email 136327134@qq.com
* @date 2023/9/18
* @package crmeb\services\wechat\client\work
*/
class UserClient extends BaseClient
{
/**
* 获取部门成员详细信息
* @param int $departmentId
* @param bool $fetchChild
* @return Response|ResponseInterface
* @throws TransportExceptionInterface
* @author 等风来
* @email 136327134@qq.com
* @date 2023/9/15
*/
public function getDetailedDepartmentUsers(int $departmentId, bool $fetchChild = false): ResponseInterface|Response
{
$params = [
'department_id' => $departmentId,
'fetch_child' => (int)$fetchChild,
];
return $this->api->get('cgi-bin/user/list', $params);
}
/**
* 获取通讯录成员详情
* @param string $userId
* @return Response|ResponseInterface
* @throws TransportExceptionInterface
* @author 等风来
* @email 136327134@qq.com
* @date 2023/9/15
*/
public function get(string $userId): ResponseInterface|Response
{
return $this->api->get('cgi-bin/user/get', ['userid' => $userId]);
}
/**
* userid转openid
* @param string $userId
* @param int|null $agentId
* @return Response|ResponseInterface
* @throws TransportExceptionInterface
* @author 等风来
* @email 136327134@qq.com
* @date 2023/9/15
*/
public function userIdToOpenid(string $userId, int $agentId = null): ResponseInterface|Response
{
$params = [
'userid' => $userId,
'agentid' => $agentId,
];
return $this->api->postJson('cgi-bin/user/convert_to_openid', $params);
}
}