mirror of
https://gitee.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat.git
synced 2025-07-17 10:41:58 +08:00
feat(work): 新增获取设备打卡数据相关接口
This commit is contained in:
parent
7d2f818392
commit
687bdc6f50
@ -0,0 +1,53 @@
|
|||||||
|
using System;
|
||||||
|
using System.Net.Http;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Flurl;
|
||||||
|
using Flurl.Http;
|
||||||
|
|
||||||
|
namespace SKIT.FlurlHttpClient.Wechat.Work
|
||||||
|
{
|
||||||
|
public static class WechatWorkClientExecuteCgibinHarewareExtensions
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// <para>异步调用 [POST] /cgi-bin/hardware/get_device_feature 接口。</para>
|
||||||
|
/// <para>REF: https://open.work.weixin.qq.com/api/doc/90002/90151/92739 </para>
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="client"></param>
|
||||||
|
/// <param name="request"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static async Task<Models.CgibinHardwareGetDeviceFeatureResponse> ExecuteCgibinHardwareGetDeviceFeatureAsync(this WechatWorkClient client, Models.CgibinHardwareGetDeviceFeatureRequest request, CancellationToken cancellationToken = default)
|
||||||
|
{
|
||||||
|
if (client is null) throw new ArgumentNullException(nameof(client));
|
||||||
|
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||||
|
|
||||||
|
IFlurlRequest flurlReq = client
|
||||||
|
.CreateRequest(request, HttpMethod.Post, "cgi-bin", "hardware", "get_device_feature")
|
||||||
|
.SetQueryParam("provider_access_token", request.ProviderAccessToken);
|
||||||
|
|
||||||
|
return await client.SendRequestWithJsonAsync<Models.CgibinHardwareGetDeviceFeatureResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// <para>异步调用 [POST] /cgi-bin/hardware/get_hardware_checkin_data 接口。</para>
|
||||||
|
/// <para>REF: https://open.work.weixin.qq.com/api/doc/90000/90135/94126 </para>
|
||||||
|
/// <para>REF: https://open.work.weixin.qq.com/api/doc/90001/90143/95176 </para>
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="client"></param>
|
||||||
|
/// <param name="request"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static async Task<Models.CgibinHardwareGetHardwareCheckinDataResponse> ExecuteCgibinHardwareGetHardwareCheckinDataAsync(this WechatWorkClient client, Models.CgibinHardwareGetHardwareCheckinDataRequest request, CancellationToken cancellationToken = default)
|
||||||
|
{
|
||||||
|
if (client is null) throw new ArgumentNullException(nameof(client));
|
||||||
|
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||||
|
|
||||||
|
IFlurlRequest flurlReq = client
|
||||||
|
.CreateRequest(request, HttpMethod.Post, "cgi-bin", "hardware", "get_hardware_checkin_data")
|
||||||
|
.SetQueryParam("access_token", request.AccessToken);
|
||||||
|
|
||||||
|
return await client.SendRequestWithJsonAsync<Models.CgibinHardwareGetHardwareCheckinDataResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,8 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Net.Http.Headers;
|
using System.Net.Http.Headers;
|
||||||
using System.Text;
|
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Web;
|
using System.Web;
|
||||||
@ -522,26 +520,6 @@ namespace SKIT.FlurlHttpClient.Wechat.Work
|
|||||||
return await client.SendRequestWithJsonAsync<Models.CgibinServiceFetchDeviceLogResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
return await client.SendRequestWithJsonAsync<Models.CgibinServiceFetchDeviceLogResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// <para>异步调用 [POST] /cgi-bin/hardware/get_device_feature 接口。</para>
|
|
||||||
/// <para>REF: https://open.work.weixin.qq.com/api/doc/90002/90151/92739 </para>
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="client"></param>
|
|
||||||
/// <param name="request"></param>
|
|
||||||
/// <param name="cancellationToken"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static async Task<Models.CgibinHardwareGetDeviceFeatureResponse> ExecuteCgibinHardwareGetDeviceFeatureAsync(this WechatWorkClient client, Models.CgibinHardwareGetDeviceFeatureRequest request, CancellationToken cancellationToken = default)
|
|
||||||
{
|
|
||||||
if (client is null) throw new ArgumentNullException(nameof(client));
|
|
||||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
|
||||||
|
|
||||||
IFlurlRequest flurlReq = client
|
|
||||||
.CreateRequest(request, HttpMethod.Post, "cgi-bin", "hardware", "get_device_feature")
|
|
||||||
.SetQueryParam("provider_access_token", request.ProviderAccessToken);
|
|
||||||
|
|
||||||
return await client.SendRequestWithJsonAsync<Models.CgibinHardwareGetDeviceFeatureResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// <para>异步调用 [POST] /cgi-bin/service/del_device 接口。</para>
|
/// <para>异步调用 [POST] /cgi-bin/service/del_device 接口。</para>
|
||||||
/// <para>REF: https://open.work.weixin.qq.com/api/doc/90002/90151/92770 </para>
|
/// <para>REF: https://open.work.weixin.qq.com/api/doc/90002/90151/92770 </para>
|
||||||
|
@ -0,0 +1,38 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// <para>表示 [POST] /cgi-bin/hardware/get_hardware_checkin_data 接口的请求。</para>
|
||||||
|
/// </summary>
|
||||||
|
public class CgibinHardwareGetHardwareCheckinDataRequest : WechatWorkRequest
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 获取或设置过滤类型。
|
||||||
|
/// </summary>
|
||||||
|
[Newtonsoft.Json.JsonProperty("filter_type")]
|
||||||
|
[System.Text.Json.Serialization.JsonPropertyName("filter_type")]
|
||||||
|
public int? FilterType { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取或设置开始时间戳。
|
||||||
|
/// </summary>
|
||||||
|
[Newtonsoft.Json.JsonProperty("starttime")]
|
||||||
|
[System.Text.Json.Serialization.JsonPropertyName("starttime")]
|
||||||
|
public long StartTimestamp { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取或设置结束时间戳。
|
||||||
|
/// </summary>
|
||||||
|
[Newtonsoft.Json.JsonProperty("endtime")]
|
||||||
|
[System.Text.Json.Serialization.JsonPropertyName("endtime")]
|
||||||
|
public long EndTimestamp { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取或设置成员账号列表。
|
||||||
|
/// </summary>
|
||||||
|
[Newtonsoft.Json.JsonProperty("useridlist")]
|
||||||
|
[System.Text.Json.Serialization.JsonPropertyName("useridlist")]
|
||||||
|
public IList<string> UserIdList { get; set; } = new List<string>();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,49 @@
|
|||||||
|
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// <para>表示 [POST] /cgi-bin/hardware/get_hardware_checkin_data 接口的响应。</para>
|
||||||
|
/// </summary>
|
||||||
|
public class CgibinHardwareGetHardwareCheckinDataResponse : WechatWorkResponse
|
||||||
|
{
|
||||||
|
public static class Types
|
||||||
|
{
|
||||||
|
public class CheckinData
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 获取或设置成员账号。
|
||||||
|
/// </summary>
|
||||||
|
[Newtonsoft.Json.JsonProperty("userid")]
|
||||||
|
[System.Text.Json.Serialization.JsonPropertyName("userid")]
|
||||||
|
public string UserId { get; set; } = default!;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取或设置打卡时间戳。
|
||||||
|
/// </summary>
|
||||||
|
[Newtonsoft.Json.JsonProperty("checkin_time")]
|
||||||
|
[System.Text.Json.Serialization.JsonPropertyName("checkin_time")]
|
||||||
|
public long CheckinTimestamp { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取或设置打卡设备的序列号。
|
||||||
|
/// </summary>
|
||||||
|
[Newtonsoft.Json.JsonProperty("device_sn")]
|
||||||
|
[System.Text.Json.Serialization.JsonPropertyName("device_sn")]
|
||||||
|
public string DeviceSerialNumber { get; set; } = default!;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取或设置打卡设备的名称。
|
||||||
|
/// </summary>
|
||||||
|
[Newtonsoft.Json.JsonProperty("device_name")]
|
||||||
|
[System.Text.Json.Serialization.JsonPropertyName("device_name")]
|
||||||
|
public string DeviceName { get; set; } = default!;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取或设置打卡数据列表。
|
||||||
|
/// </summary>
|
||||||
|
[Newtonsoft.Json.JsonProperty("checkindata")]
|
||||||
|
[System.Text.Json.Serialization.JsonPropertyName("checkindata")]
|
||||||
|
public Types.CheckinData[] CheckinDataList { get; set; } = default!;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"filter_type": 1,
|
||||||
|
"starttime": 1492617600,
|
||||||
|
"endtime": 1492790400,
|
||||||
|
"useridlist": [
|
||||||
|
"james",
|
||||||
|
"paul"
|
||||||
|
]
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"errcode": 0,
|
||||||
|
"errmsg": "ok",
|
||||||
|
"checkindata": [
|
||||||
|
{
|
||||||
|
"userid": "james",
|
||||||
|
"checkin_time": 1492617610,
|
||||||
|
"device_sn": "xxxxx",
|
||||||
|
"device_name": "xxxx门店"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"userid": "paul",
|
||||||
|
"checkin_time": 1492617620,
|
||||||
|
"device_sn": "yyyy",
|
||||||
|
"device_name": "yyyy门店"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user