薪人薪事基于薪人薪事开放平台 V2 API,实现 IHumanResourcesService 统一接口。
包信息
| 项 | 值 |
|---|---|
| NuGet 包 | Bitzsoft.Integrations.HumanResources.Xinrenxinshi |
| 实现接口 | IHumanResourcesService |
| Provider ID | xinrenxinshi |
| 鉴权方式 | API Key + HMAC-SHA256 签名头 |
| 默认 ApiBaseUrl | https://api.xinrenxinshi.com |
| 区域 | Global |
配置字段
| 字段 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
ApiBaseUrl | string | 否 | https://api.xinrenxinshi.com | 薪人薪事开放平台基地址 |
ApiKey | string | 是 | — | API Key |
ApiSecret | string | 是 | — | API Secret(用于 HMAC-SHA256 签名) |
HttpClientName | string | 否 | HumanResourcesXinrenxinshi | 业务 HttpClient 命名 |
配置 JSON 示例
{ "HumanResources": { "Xinrenxinshi": { "ApiBaseUrl": "https://api.xinrenxinshi.com", "ApiKey": "xxxxxxxxxxxx", "ApiSecret": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" } }}DI 注册
// 从配置节注册(默认节名 HumanResources:Xinrenxinshi)services.AddXinrenxinshiHumanResources(configuration);
// 或用回调单独配置services.AddXinrenxinshiHumanResources(options =>{ options.ApiKey = "xxxxxxxxxxxx"; options.ApiSecret = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";});使用示例
public class DeptService{ private readonly IHumanResourcesService _hr;
public DeptService(IHumanResourcesService hr) => _hr = hr;
public Task<List<HrDepartment>> ListAsync() => _hr.ListDepartmentsAsync();
public Task<HrDepartment> CreateAsync(string name, string parentId) => _hr.CreateDepartmentAsync(new CreateDepartmentRequest { Name = name, ParentId = parentId });
public Task<List<HrAttendanceRecord>> AttendanceAsync( string employeeId, DateTimeOffset start, DateTimeOffset end) => _hr.ListAttendanceRecordsAsync(employeeId, start, end);}依赖
| 包 | 说明 |
|---|---|
Bitzsoft.Integrations.HumanResources | 人力资源服务抽象层 |
Bitzsoft.Integrations.Core | 公共基座 |
已知限制
- 鉴权走 HMAC-SHA256 签名(含时间戳与随机数防重放),每次请求由本包自动签名。