Skip to content
Bitzsoft.Integrationsbitzsoft.integrations

Reference

薪人薪事

Bitzsoft.Integrations.HumanResources.Xinrenxinshi 包参考——API Key + HMAC-SHA256 签名鉴权、IHumanResourcesService 配置与使用示例。

Last updated

薪人薪事基于薪人薪事开放平台 V2 API,实现 IHumanResourcesService 统一接口。

包信息

NuGet 包Bitzsoft.Integrations.HumanResources.Xinrenxinshi
实现接口IHumanResourcesService
Provider IDxinrenxinshi
鉴权方式API Key + HMAC-SHA256 签名头
默认 ApiBaseUrlhttps://api.xinrenxinshi.com
区域Global

配置字段

字段类型必填默认值说明
ApiBaseUrlstringhttps://api.xinrenxinshi.com薪人薪事开放平台基地址
ApiKeystringAPI Key
ApiSecretstringAPI Secret(用于 HMAC-SHA256 签名)
HttpClientNamestringHumanResourcesXinrenxinshi业务 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 签名(含时间戳与随机数防重放),每次请求由本包自动签名。

100%

滚轮或按钮缩放 · 放大后拖动画面 · 双击切换 100% / 200%