diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Extensions/WechatWorkClientExecuteCgibinCheckinExtensions.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Extensions/WechatWorkClientExecuteCgibinCheckinExtensions.cs index 910b4e1c..c3b31417 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.Work/Extensions/WechatWorkClientExecuteCgibinCheckinExtensions.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Extensions/WechatWorkClientExecuteCgibinCheckinExtensions.cs @@ -129,6 +129,29 @@ namespace SKIT.FlurlHttpClient.Wechat.Work return await client.SendFlurlRequestAsJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false); } + /// + /// 异步调用 [POST] /cgi-bin/checkin/add_checkin_record 接口。 + /// + /// REF:
+ /// + ///
+ ///
+ /// + /// + /// + /// + public static async Task ExecuteCgibinCheckinAddCheckinRecordAsync(this WechatWorkClient client, Models.CgibinCheckinAddCheckinRecordRequest 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 + .CreateFlurlRequest(request, HttpMethod.Post, "cgi-bin", "checkin", "add_checkin_record") + .SetQueryParam("access_token", request.AccessToken); + + return await client.SendFlurlRequestAsJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false); + } + /// /// 异步调用 [POST] /cgi-bin/checkin/addcheckinuserface 接口。 /// diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinCheckin/CgibinCheckinAddCheckinRecordRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinCheckin/CgibinCheckinAddCheckinRecordRequest.cs new file mode 100644 index 00000000..9612c6d5 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinCheckin/CgibinCheckinAddCheckinRecordRequest.cs @@ -0,0 +1,107 @@ +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [POST] /cgi-bin/checkin/add_checkin_record 接口的请求。 + /// + public class CgibinCheckinAddCheckinRecordRequest : WechatWorkRequest + { + public static class Types + { + public class Record + { + /// + /// 获取或设置成员账号。 + /// + [Newtonsoft.Json.JsonProperty("userid")] + [System.Text.Json.Serialization.JsonPropertyName("userid")] + public string UserId { get; set; } = default!; + + /// + /// 获取或设置打卡时间戳。 + /// + [Newtonsoft.Json.JsonProperty("checkin_time")] + [System.Text.Json.Serialization.JsonPropertyName("checkin_time")] + public long CheckinTimestamp { get; set; } + + /// + /// 获取或设置打卡地点名称。 + /// + [Newtonsoft.Json.JsonProperty("location_title")] + [System.Text.Json.Serialization.JsonPropertyName("location_title")] + public string? LocationTitle { get; set; } + + /// + /// 获取或设置打卡地点详情。 + /// + [Newtonsoft.Json.JsonProperty("location_detail")] + [System.Text.Json.Serialization.JsonPropertyName("location_detail")] + public string? LocationDetail { get; set; } + + /// + /// 获取或设置打卡地点经度。 + /// + [Newtonsoft.Json.JsonProperty("lng")] + [System.Text.Json.Serialization.JsonPropertyName("lng")] + public decimal? LocationLongitude { get; set; } + + /// + /// 获取或设置打卡地点纬度。 + /// + [Newtonsoft.Json.JsonProperty("lat")] + [System.Text.Json.Serialization.JsonPropertyName("lat")] + public decimal? LocationLatitude { get; set; } + + /// + /// 获取或设置打卡 Wi-Fi 名称。 + /// + [Newtonsoft.Json.JsonProperty("wifiname")] + [System.Text.Json.Serialization.JsonPropertyName("wifiname")] + public string? WiFiName { get; set; } + + /// + /// 获取或设置打卡 Wi-Fi 的 MAC 地址或 BSSID。 + /// + [Newtonsoft.Json.JsonProperty("wifimac")] + [System.Text.Json.Serialization.JsonPropertyName("wifimac")] + public string? WiFiMac { get; set; } + + /// + /// 获取或设置打卡设备类型。 + /// + [Newtonsoft.Json.JsonProperty("device_type")] + [System.Text.Json.Serialization.JsonPropertyName("device_type")] + public int? DeviceType { get; set; } + + /// + /// 获取或设置打卡设备品牌。 + /// + [Newtonsoft.Json.JsonProperty("device_detail")] + [System.Text.Json.Serialization.JsonPropertyName("device_detail")] + public string? DeviceDetail { get; set; } + + /// + /// 获取或设置备注。 + /// + [Newtonsoft.Json.JsonProperty("notes")] + [System.Text.Json.Serialization.JsonPropertyName("notes")] + public string? Notes { get; set; } + + /// + /// 获取或设置附件图片 MediaId 列表。 + /// + [Newtonsoft.Json.JsonProperty("mediaids")] + [System.Text.Json.Serialization.JsonPropertyName("mediaids")] + public IList? MediaIdList { get; set; } + } + } + + /// + /// 获取或设置打卡记录列表。 + /// + [Newtonsoft.Json.JsonProperty("records")] + [System.Text.Json.Serialization.JsonPropertyName("records")] + public IList RecordList { get; set; } = new List(); + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinCheckin/CgibinCheckinAddCheckinRecordResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinCheckin/CgibinCheckinAddCheckinRecordResponse.cs new file mode 100644 index 00000000..28f111f5 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinCheckin/CgibinCheckinAddCheckinRecordResponse.cs @@ -0,0 +1,9 @@ +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [POST] /cgi-bin/checkin/add_checkin_record 接口的响应。 + /// + public class CgibinCheckinAddCheckinRecordResponse : WechatWorkResponse + { + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinCheckin/CgibinCheckinGetCheckinDataResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinCheckin/CgibinCheckinGetCheckinDataResponse.cs index f8d7d50d..491e4cbf 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinCheckin/CgibinCheckinGetCheckinDataResponse.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinCheckin/CgibinCheckinGetCheckinDataResponse.cs @@ -7,7 +7,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Work.Models { public static class Types { - public class Data + public class Record { /// /// 获取或设置成员账号。 @@ -129,11 +129,11 @@ namespace SKIT.FlurlHttpClient.Wechat.Work.Models public string? Notes { get; set; } /// - /// 获取或设置备注附件图片 MediaId 列表。 + /// 获取或设置附件图片 MediaId 列表。 /// [Newtonsoft.Json.JsonProperty("mediaids")] [System.Text.Json.Serialization.JsonPropertyName("mediaids")] - public string[]? NotesMediaIdList { get; set; } + public string[]? MediaIdList { get; set; } } } @@ -142,6 +142,6 @@ namespace SKIT.FlurlHttpClient.Wechat.Work.Models /// [Newtonsoft.Json.JsonProperty("checkindata")] [System.Text.Json.Serialization.JsonPropertyName("checkindata")] - public Types.Data[] DataList { get; set; } = default!; + public Types.Record[] RecordList { get; set; } = default!; } } diff --git a/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/ModelSamples/CgibinCheckin/CgibinCheckinAddCheckinRecordRequest.json b/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/ModelSamples/CgibinCheckin/CgibinCheckinAddCheckinRecordRequest.json new file mode 100644 index 00000000..23681ee9 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/ModelSamples/CgibinCheckin/CgibinCheckinAddCheckinRecordRequest.json @@ -0,0 +1,20 @@ +{ + "records": [ + { + "userid": "userId", + "checkin_time": 1705899000, + "location_title": "1234", + "location_detail": "1234", + "mediaids": [ + "mediaId" + ], + "notes": "", + "device_type": 1, + "lat": 22234233, + "lng": 1233123, + "device_detail": "device_detail_test", + "wifiname": "Tencent-WiFi", + "wifimac": "a2:8b:7f:c0:27:4b" + } + ] +}