mirror of
https://gitee.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat.git
synced 2026-03-10 00:13:36 +08:00
feat(work): 升级公共组件
This commit is contained in:
@@ -1,12 +1,9 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
namespace Newtonsoft.Json.Converters
|
||||
{
|
||||
internal class SeparatedByVBarInt32ArrayConverter : JsonConverter<int[]?>
|
||||
internal class TextualIntegerArrayWithPipeSplitConverter : JsonConverter<int[]?>
|
||||
{
|
||||
private const string SEPARATOR = "|";
|
||||
|
||||
public override bool CanRead
|
||||
{
|
||||
get { return true; }
|
||||
@@ -27,28 +24,29 @@ namespace Newtonsoft.Json.Converters
|
||||
{
|
||||
string? value = serializer.Deserialize<string>(reader);
|
||||
if (value == null)
|
||||
return existingValue;
|
||||
return null;
|
||||
if (string.IsNullOrEmpty(value))
|
||||
return Array.Empty<int>();
|
||||
|
||||
try
|
||||
string[] strArr = value.Split('|');
|
||||
int[] intArr = new int[strArr.Length];
|
||||
for (int i = 0; i < strArr.Length; i++)
|
||||
{
|
||||
return value
|
||||
.Split(new string[] { SEPARATOR }, StringSplitOptions.RemoveEmptyEntries)
|
||||
.Select(e => int.Parse(e))
|
||||
.ToArray();
|
||||
}
|
||||
catch (FormatException ex)
|
||||
{
|
||||
throw new JsonReaderException(ex.Message, ex);
|
||||
if (!int.TryParse(strArr[i], out int j))
|
||||
throw new JsonSerializationException("Unexpected token when parsing string to integer.");
|
||||
|
||||
intArr[i] = j;
|
||||
}
|
||||
return intArr;
|
||||
}
|
||||
|
||||
throw new JsonReaderException();
|
||||
throw new JsonSerializationException();
|
||||
}
|
||||
|
||||
public override void WriteJson(JsonWriter writer, int[]? value, JsonSerializer serializer)
|
||||
{
|
||||
if (value != null)
|
||||
writer.WriteValue(string.Join(SEPARATOR, value));
|
||||
writer.WriteValue(string.Join("|", value));
|
||||
else
|
||||
writer.WriteNull();
|
||||
}
|
||||
@@ -2,10 +2,8 @@
|
||||
|
||||
namespace Newtonsoft.Json.Converters
|
||||
{
|
||||
internal class SeparatedByVBarStringArrayConverter : JsonConverter<string[]?>
|
||||
internal class TextualStringArrayWithPipeSplitConverter : JsonConverter<string[]?>
|
||||
{
|
||||
private const string SEPARATOR = "|";
|
||||
|
||||
public override bool CanRead
|
||||
{
|
||||
get { return true; }
|
||||
@@ -26,18 +24,20 @@ namespace Newtonsoft.Json.Converters
|
||||
{
|
||||
string? value = serializer.Deserialize<string>(reader);
|
||||
if (value == null)
|
||||
return existingValue;
|
||||
return null;
|
||||
if (string.IsNullOrEmpty(value))
|
||||
return Array.Empty<string>();
|
||||
|
||||
return value.Split(new string[] { SEPARATOR }, StringSplitOptions.RemoveEmptyEntries);
|
||||
return value.Split('|');
|
||||
}
|
||||
|
||||
throw new JsonReaderException();
|
||||
throw new JsonSerializationException();
|
||||
}
|
||||
|
||||
public override void WriteJson(JsonWriter writer, string[]? value, JsonSerializer serializer)
|
||||
{
|
||||
if (value != null)
|
||||
writer.WriteValue(string.Join(SEPARATOR, value));
|
||||
writer.WriteValue(string.Join("|", value));
|
||||
else
|
||||
writer.WriteNull();
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Newtonsoft.Json.Converters
|
||||
{
|
||||
internal class TextualIntegerListWithPipeSplitConverter : JsonConverter
|
||||
{
|
||||
private readonly JsonConverter<int[]?> _converter = new TextualIntegerArrayWithPipeSplitConverter();
|
||||
|
||||
public override bool CanConvert(Type objectType)
|
||||
{
|
||||
return objectType.IsGenericType &&
|
||||
typeof(IList<>).IsAssignableFrom(objectType.GetGenericTypeDefinition()) &&
|
||||
typeof(int) == objectType.GetGenericArguments()[0];
|
||||
}
|
||||
|
||||
public override bool CanRead
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public override bool CanWrite
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public override object? ReadJson(JsonReader reader, Type objectType, object? existingValue, JsonSerializer serializer)
|
||||
{
|
||||
int[]? array = _converter.ReadJson(reader, objectType, null, false, serializer);
|
||||
return array?.ToList();
|
||||
}
|
||||
|
||||
public override void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer)
|
||||
{
|
||||
_converter.WriteJson(writer, ((IList<int>?)value)?.ToArray(), serializer);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Newtonsoft.Json.Converters
|
||||
{
|
||||
internal class TextualStringListWithPipeSplitConverter : JsonConverter
|
||||
{
|
||||
private readonly JsonConverter<string[]?> _converter = new TextualStringArrayWithPipeSplitConverter();
|
||||
|
||||
public override bool CanConvert(Type objectType)
|
||||
{
|
||||
return objectType.IsGenericType &&
|
||||
typeof(IList<>).IsAssignableFrom(objectType.GetGenericTypeDefinition()) &&
|
||||
typeof(string) == objectType.GetGenericArguments()[0];
|
||||
}
|
||||
|
||||
public override bool CanRead
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public override bool CanWrite
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public override object? ReadJson(JsonReader reader, Type objectType, object? existingValue, JsonSerializer serializer)
|
||||
{
|
||||
string[]? array = _converter.ReadJson(reader, objectType, null, false, serializer);
|
||||
return array?.ToList();
|
||||
}
|
||||
|
||||
public override void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer)
|
||||
{
|
||||
_converter.WriteJson(writer, ((IList<string>?)value)?.ToArray(), serializer);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@ using System.Text.Json.Serialization;
|
||||
|
||||
namespace System.Text.Json.Converters
|
||||
{
|
||||
internal class SeparatedByVBarInt32ArrayConverter : JsonConverter<int[]?>
|
||||
internal class TextualIntegerArrayWithPipeSplitConverter : JsonConverter<int[]?>
|
||||
{
|
||||
private const string SEPARATOR = "|";
|
||||
|
||||
@@ -18,18 +18,19 @@ namespace System.Text.Json.Converters
|
||||
string? value = reader.GetString();
|
||||
if (value == null)
|
||||
return null;
|
||||
if (string.IsNullOrEmpty(value))
|
||||
return Array.Empty<int>();
|
||||
|
||||
try
|
||||
string[] strArr = value.Split('|');
|
||||
int[] intArr = new int[strArr.Length];
|
||||
for (int i = 0; i < strArr.Length; i++)
|
||||
{
|
||||
return value
|
||||
.Split(new string[] { SEPARATOR }, StringSplitOptions.RemoveEmptyEntries)
|
||||
.Select(e => int.Parse(e))
|
||||
.ToArray();
|
||||
}
|
||||
catch (FormatException ex)
|
||||
{
|
||||
throw new JsonException(ex.Message, ex);
|
||||
if (!int.TryParse(strArr[i], out int j))
|
||||
throw new JsonException("Unexpected token when parsing string to integer.");
|
||||
|
||||
intArr[i] = j;
|
||||
}
|
||||
return intArr;
|
||||
}
|
||||
|
||||
throw new JsonException();
|
||||
@@ -38,7 +39,7 @@ namespace System.Text.Json.Converters
|
||||
public override void Write(Utf8JsonWriter writer, int[]? value, JsonSerializerOptions options)
|
||||
{
|
||||
if (value != null)
|
||||
writer.WriteStringValue(string.Join(SEPARATOR, value));
|
||||
writer.WriteStringValue(string.Join("|", value));
|
||||
else
|
||||
writer.WriteNullValue();
|
||||
}
|
||||
@@ -2,10 +2,8 @@
|
||||
|
||||
namespace System.Text.Json.Converters
|
||||
{
|
||||
internal class SeparatedByVBarStringArrayConverter : JsonConverter<string[]?>
|
||||
internal class TextualStringArrayWithPipeSplitConverter : JsonConverter<string[]?>
|
||||
{
|
||||
private const string SEPARATOR = "|";
|
||||
|
||||
public override string[]? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
|
||||
{
|
||||
if (reader.TokenType == JsonTokenType.Null)
|
||||
@@ -17,8 +15,10 @@ namespace System.Text.Json.Converters
|
||||
string? value = reader.GetString();
|
||||
if (value == null)
|
||||
return null;
|
||||
if (string.IsNullOrEmpty(value))
|
||||
return Array.Empty<string>();
|
||||
|
||||
return value.Split(new string[] { SEPARATOR }, StringSplitOptions.RemoveEmptyEntries);
|
||||
return value.Split('|');
|
||||
}
|
||||
|
||||
throw new JsonException();
|
||||
@@ -27,7 +27,7 @@ namespace System.Text.Json.Converters
|
||||
public override void Write(Utf8JsonWriter writer, string[]? value, JsonSerializerOptions options)
|
||||
{
|
||||
if (value != null)
|
||||
writer.WriteStringValue(string.Join(SEPARATOR, value));
|
||||
writer.WriteStringValue(string.Join("|", value));
|
||||
else
|
||||
writer.WriteNullValue();
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace System.Text.Json.Converters
|
||||
{
|
||||
internal class TextualIntegerListWithPipeSplitConverter : JsonConverterFactory
|
||||
{
|
||||
private sealed class InnerTextualIntegerListWithVBarSplitConverter : JsonConverter<IList<int>?>
|
||||
{
|
||||
private readonly JsonConverter<int[]?> _converter = new TextualIntegerArrayWithPipeSplitConverter();
|
||||
|
||||
public override IList<int>? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
|
||||
{
|
||||
int[]? array = _converter.Read(ref reader, typeToConvert, options);
|
||||
IList<int>? list = array?.ToList();
|
||||
return list;
|
||||
}
|
||||
|
||||
public override void Write(Utf8JsonWriter writer, IList<int>? value, JsonSerializerOptions options)
|
||||
{
|
||||
_converter.Write(writer, value?.ToArray(), options);
|
||||
}
|
||||
}
|
||||
|
||||
public override bool CanConvert(Type typeToConvert)
|
||||
{
|
||||
return typeToConvert.IsGenericType &&
|
||||
typeof(IList<>).IsAssignableFrom(typeToConvert.GetGenericTypeDefinition()) &&
|
||||
typeof(int) == typeToConvert.GetGenericArguments()[0];
|
||||
}
|
||||
|
||||
public override JsonConverter? CreateConverter(Type typeToConvert, JsonSerializerOptions options)
|
||||
{
|
||||
return new InnerTextualIntegerListWithVBarSplitConverter();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace System.Text.Json.Converters
|
||||
{
|
||||
internal class TextualStringListWithPipeSplitConverter : JsonConverterFactory
|
||||
{
|
||||
private sealed class InnerTextualStringListWithVBarSplitConverter : JsonConverter<IList<string>?>
|
||||
{
|
||||
private readonly JsonConverter<string[]?> _converter = new TextualStringArrayWithPipeSplitConverter();
|
||||
|
||||
public override IList<string>? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
|
||||
{
|
||||
string[]? array = _converter.Read(ref reader, typeToConvert, options);
|
||||
IList<string>? list = array?.ToList();
|
||||
return list;
|
||||
}
|
||||
|
||||
public override void Write(Utf8JsonWriter writer, IList<string>? value, JsonSerializerOptions options)
|
||||
{
|
||||
_converter.Write(writer, value?.ToArray(), options);
|
||||
}
|
||||
}
|
||||
|
||||
public override bool CanConvert(Type typeToConvert)
|
||||
{
|
||||
return typeToConvert.IsGenericType &&
|
||||
typeof(IList<>).IsAssignableFrom(typeToConvert.GetGenericTypeDefinition()) &&
|
||||
typeof(string) == typeToConvert.GetGenericArguments()[0];
|
||||
}
|
||||
|
||||
public override JsonConverter? CreateConverter(Type typeToConvert, JsonSerializerOptions options)
|
||||
{
|
||||
return new InnerTextualStringListWithVBarSplitConverter();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Newtonsoft.Json.Converters
|
||||
{
|
||||
internal class SeparatedByVBarInt32IListConverter : JsonConverter<IList<int>?>
|
||||
{
|
||||
private readonly JsonConverter<List<int>?> _converter = new SeparatedByVBarInt32ListConverter();
|
||||
|
||||
public override bool CanRead
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public override bool CanWrite
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public override IList<int>? ReadJson(JsonReader reader, Type objectType, IList<int>? existingValue, bool hasExistingValue, JsonSerializer serializer)
|
||||
{
|
||||
return _converter.ReadJson(reader, objectType, ConvertIListToList(existingValue), hasExistingValue, serializer);
|
||||
}
|
||||
|
||||
public override void WriteJson(JsonWriter writer, IList<int>? value, JsonSerializer serializer)
|
||||
{
|
||||
_converter.WriteJson(writer, ConvertIListToList(value), serializer);
|
||||
}
|
||||
|
||||
private List<int>? ConvertIListToList(IList<int>? src)
|
||||
{
|
||||
if (src == null)
|
||||
return null;
|
||||
|
||||
List<int>? dest = src as List<int>;
|
||||
if (dest != null)
|
||||
return dest;
|
||||
|
||||
return new List<int>(src);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Newtonsoft.Json.Converters
|
||||
{
|
||||
internal class SeparatedByVBarInt32ListConverter : JsonConverter<List<int>?>
|
||||
{
|
||||
private readonly JsonConverter<int[]?> _converter = new SeparatedByVBarInt32ArrayConverter();
|
||||
|
||||
public override bool CanRead
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public override bool CanWrite
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public override List<int>? ReadJson(JsonReader reader, Type objectType, List<int>? existingValue, bool hasExistingValue, JsonSerializer serializer)
|
||||
{
|
||||
return _converter.ReadJson(reader, objectType, existingValue?.ToArray(), hasExistingValue, serializer)?.ToList();
|
||||
}
|
||||
|
||||
public override void WriteJson(JsonWriter writer, List<int>? value, JsonSerializer serializer)
|
||||
{
|
||||
_converter.WriteJson(writer, value?.ToArray(), serializer);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Newtonsoft.Json.Converters
|
||||
{
|
||||
internal class SeparatedByVBarStringIListConverter : JsonConverter<IList<string>?>
|
||||
{
|
||||
private readonly JsonConverter<List<string>?> _converter = new SeparatedByVBarStringListConverter();
|
||||
|
||||
public override bool CanRead
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public override bool CanWrite
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public override IList<string>? ReadJson(JsonReader reader, Type objectType, IList<string>? existingValue, bool hasExistingValue, JsonSerializer serializer)
|
||||
{
|
||||
return _converter.ReadJson(reader, objectType, ConvertIListToList(existingValue), hasExistingValue, serializer);
|
||||
}
|
||||
|
||||
public override void WriteJson(JsonWriter writer, IList<string>? value, JsonSerializer serializer)
|
||||
{
|
||||
_converter.WriteJson(writer, ConvertIListToList(value), serializer);
|
||||
}
|
||||
|
||||
private List<string>? ConvertIListToList(IList<string>? src)
|
||||
{
|
||||
if (src == null)
|
||||
return null;
|
||||
|
||||
List<string>? dest = src as List<string>;
|
||||
if (dest != null)
|
||||
return dest;
|
||||
|
||||
return new List<string>(src);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Newtonsoft.Json.Converters
|
||||
{
|
||||
internal class SeparatedByVBarStringListConverter : JsonConverter<List<string>?>
|
||||
{
|
||||
private readonly JsonConverter<string[]?> _converter = new SeparatedByVBarStringArrayConverter();
|
||||
|
||||
public override bool CanRead
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public override bool CanWrite
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public override List<string>? ReadJson(JsonReader reader, Type objectType, List<string>? existingValue, bool hasExistingValue, JsonSerializer serializer)
|
||||
{
|
||||
return _converter.ReadJson(reader, objectType, existingValue?.ToArray(), hasExistingValue, serializer)?.ToList();
|
||||
}
|
||||
|
||||
public override void WriteJson(JsonWriter writer, List<string>? value, JsonSerializer serializer)
|
||||
{
|
||||
_converter.WriteJson(writer, value?.ToArray(), serializer);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace System.Text.Json.Converters
|
||||
{
|
||||
internal class SeparatedByVBarInt32IListConverter : JsonConverter<IList<int>?>
|
||||
{
|
||||
private readonly JsonConverter<List<int>?> _converter = new SeparatedByVBarInt32ListConverter();
|
||||
|
||||
public override IList<int>? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
|
||||
{
|
||||
return _converter.Read(ref reader, typeToConvert, options);
|
||||
}
|
||||
|
||||
public override void Write(Utf8JsonWriter writer, IList<int>? value, JsonSerializerOptions options)
|
||||
{
|
||||
_converter.Write(writer, ConvertIListToList(value), options);
|
||||
}
|
||||
|
||||
private List<int>? ConvertIListToList(IList<int>? src)
|
||||
{
|
||||
if (src == null)
|
||||
return null;
|
||||
|
||||
List<int>? dest = src as List<int>;
|
||||
if (dest != null)
|
||||
return dest;
|
||||
|
||||
return new List<int>(src);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace System.Text.Json.Converters
|
||||
{
|
||||
internal class SeparatedByVBarInt32ListConverter : JsonConverter<List<int>?>
|
||||
{
|
||||
private readonly JsonConverter<int[]?> _converter = new SeparatedByVBarInt32ArrayConverter();
|
||||
|
||||
public override List<int>? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
|
||||
{
|
||||
return _converter.Read(ref reader, typeToConvert, options)?.ToList();
|
||||
}
|
||||
|
||||
public override void Write(Utf8JsonWriter writer, List<int>? value, JsonSerializerOptions options)
|
||||
{
|
||||
_converter.Write(writer, value?.ToArray(), options);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace System.Text.Json.Converters
|
||||
{
|
||||
internal class SeparatedByVBarStringIListConverter : JsonConverter<IList<string>?>
|
||||
{
|
||||
private readonly JsonConverter<List<string>?> _converter = new SeparatedByVBarStringListConverter();
|
||||
|
||||
public override IList<string>? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
|
||||
{
|
||||
return _converter.Read(ref reader, typeToConvert, options);
|
||||
}
|
||||
|
||||
public override void Write(Utf8JsonWriter writer, IList<string>? value, JsonSerializerOptions options)
|
||||
{
|
||||
_converter.Write(writer, ConvertIListToList(value), options);
|
||||
}
|
||||
|
||||
private List<string>? ConvertIListToList(IList<string>? src)
|
||||
{
|
||||
if (src == null)
|
||||
return null;
|
||||
|
||||
List<string>? dest = src as List<string>;
|
||||
if (dest != null)
|
||||
return dest;
|
||||
|
||||
return new List<string>(src);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace System.Text.Json.Converters
|
||||
{
|
||||
internal class SeparatedByVBarStringListConverter : JsonConverter<List<string>?>
|
||||
{
|
||||
private readonly JsonConverter<string[]?> _converter = new SeparatedByVBarStringArrayConverter();
|
||||
|
||||
public override List<string>? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
|
||||
{
|
||||
return _converter.Read(ref reader, typeToConvert, options)?.ToList();
|
||||
}
|
||||
|
||||
public override void Write(Utf8JsonWriter writer, List<string>? value, JsonSerializerOptions options)
|
||||
{
|
||||
_converter.Write(writer, value?.ToArray(), options);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -964,27 +964,27 @@ namespace SKIT.FlurlHttpClient.Wechat.Work.Models
|
||||
/// 获取或设置接收消息的成员账号列表。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("touser")]
|
||||
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.SeparatedByVBarStringIListConverter))]
|
||||
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.TextualStringListWithPipeSplitConverter))]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("touser")]
|
||||
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.SeparatedByVBarStringIListConverter))]
|
||||
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.TextualStringListWithPipeSplitConverter))]
|
||||
public IList<string>? ToUserIdList { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置接收消息的部门 ID 列表。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("toparty")]
|
||||
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.SeparatedByVBarInt32IListConverter))]
|
||||
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.TextualIntegerListWithPipeSplitConverter))]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("toparty")]
|
||||
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.SeparatedByVBarInt32IListConverter))]
|
||||
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.TextualIntegerListWithPipeSplitConverter))]
|
||||
public IList<int>? ToDepartmentIdList { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置接收消息的标签 ID 列表。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("totag")]
|
||||
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.SeparatedByVBarInt32IListConverter))]
|
||||
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.TextualIntegerListWithPipeSplitConverter))]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("totag")]
|
||||
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.SeparatedByVBarInt32IListConverter))]
|
||||
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.TextualIntegerListWithPipeSplitConverter))]
|
||||
public IList<int>? ToTagIdList { get; set; }
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -9,27 +9,27 @@
|
||||
/// 获取或设置无效的成员账号列表。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("invaliduser")]
|
||||
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.SeparatedByVBarStringArrayConverter))]
|
||||
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.TextualStringArrayWithPipeSplitConverter))]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("invaliduser")]
|
||||
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.SeparatedByVBarStringArrayConverter))]
|
||||
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.TextualStringArrayWithPipeSplitConverter))]
|
||||
public string[]? InvalidUserIdList { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置无效的部门 ID 列表。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("invalidparty")]
|
||||
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.SeparatedByVBarInt32ArrayConverter))]
|
||||
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.TextualIntegerArrayWithPipeSplitConverter))]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("invalidparty")]
|
||||
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.SeparatedByVBarInt32ArrayConverter))]
|
||||
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.TextualIntegerArrayWithPipeSplitConverter))]
|
||||
public int[]? InvalidDepartmentIdList { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置无效的标签 ID 列表。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("invalidtag")]
|
||||
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.SeparatedByVBarInt32ArrayConverter))]
|
||||
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.TextualIntegerArrayWithPipeSplitConverter))]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("invalidtag")]
|
||||
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.SeparatedByVBarInt32ArrayConverter))]
|
||||
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.TextualIntegerArrayWithPipeSplitConverter))]
|
||||
public int[]? InvalidTagIdList { get; set; }
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
/// 获取或设置无效的成员账号列表。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("invalidlist")]
|
||||
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.SeparatedByVBarStringArrayConverter))]
|
||||
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.TextualStringArrayWithPipeSplitConverter))]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("invalidlist")]
|
||||
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.SeparatedByVBarStringArrayConverter))]
|
||||
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.TextualStringArrayWithPipeSplitConverter))]
|
||||
public string[]? InvalidUserIdList { get; set; }
|
||||
|
||||
/// <summary>
|
||||
|
||||
26
src/SKIT.FlurlHttpClient.Wechat.Work/README.md
Normal file
26
src/SKIT.FlurlHttpClient.Wechat.Work/README.md
Normal file
@@ -0,0 +1,26 @@
|
||||
## SKIT.FlurlHttpClient.Wechat.Work
|
||||
|
||||
[](https://github.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat) [](https://github.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat) [](https://www.nuget.org/packages/SKIT.FlurlHttpClient.Wechat.Work) [](https://mit-license.org/)
|
||||
|
||||
基于 `Flurl.Http` 的企业微信 API 客户端。
|
||||
|
||||
---
|
||||
|
||||
### 【功能特性】
|
||||
|
||||
- 基于企业微信 API 封装。
|
||||
- 支持企业内部开发、第三方应用开发(即服务商)、智慧硬件开发(即硬件接入)三种模式。
|
||||
- 提供了企业微信 API 所需的 SHA-1、AES 等算法工具类。
|
||||
- 提供了 JS-SDK 签名、解析回调通知事件等扩展方法。
|
||||
|
||||
---
|
||||
|
||||
### 【开发文档】
|
||||
|
||||
[点此查看](https://github.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat)。
|
||||
|
||||
---
|
||||
|
||||
### 【更新日志】
|
||||
|
||||
[点此查看](https://github.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat/blob/main/CHANGELOG.md)。
|
||||
@@ -9,6 +9,8 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<PackageId>SKIT.FlurlHttpClient.Wechat.Work</PackageId>
|
||||
<PackageIcon>LOGO.png</PackageIcon>
|
||||
<PackageReadmeFile>README.md</PackageReadmeFile>
|
||||
<PackageLicenseExpression>MIT</PackageLicenseExpression>
|
||||
<PackageProjectUrl>https://github.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat</PackageProjectUrl>
|
||||
<PackageTags>Flurl.Http Wechat Weixin MicroMessage WechatWork WeixinWork Wxwork 微信 企业微信 企业号 微信企业号</PackageTags>
|
||||
@@ -17,17 +19,28 @@
|
||||
<Authors>Fu Diwei</Authors>
|
||||
<RepositoryType>git</RepositoryType>
|
||||
<RepositoryUrl>https://github.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat.git</RepositoryUrl>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
<IncludeSymbols>true</IncludeSymbols>
|
||||
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
|
||||
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
|
||||
<Deterministic>true</Deterministic>
|
||||
<EmbedUntrackedSources>true</EmbedUntrackedSources>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
<IncludeSymbols>true</IncludeSymbols>
|
||||
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Include="../../LOGO.png" Pack="true" PackagePath="/" />
|
||||
<None Include="README.md" Pack="true" PackagePath="/" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="System.Web" Condition="'$(TargetFramework)' == 'net461'" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="SKIT.FlurlHttpClient.Common" Version="2.1.1" />
|
||||
<PackageReference Include="SKIT.FlurlHttpClient.Common" Version="2.2.0" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -10,7 +10,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Work.Utilities
|
||||
public static class SHA1Utility
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取信息摘要。
|
||||
/// 获取 SHA-1 信息摘要。
|
||||
/// </summary>
|
||||
/// <param name="bytes">信息字节数组。</param>
|
||||
/// <returns>信息摘要。</returns>
|
||||
@@ -24,7 +24,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Work.Utilities
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取信息摘要。
|
||||
/// 获取 SHA-1 信息摘要。
|
||||
/// </summary>
|
||||
/// <param name="message">文本信息。</param>
|
||||
/// <returns>信息摘要。</returns>
|
||||
|
||||
Reference in New Issue
Block a user