diff --git a/framework/Furion.Pure/RemoteRequest/Attributes/Parameters/QueryStringAttribute.cs b/framework/Furion.Pure/RemoteRequest/Attributes/Parameters/QueryStringAttribute.cs index 46318ab30e194bc96c11bba43526c826ed610b17..2b0955cfbc86abb7496bfb3756960e72643763e7 100644 --- a/framework/Furion.Pure/RemoteRequest/Attributes/Parameters/QueryStringAttribute.cs +++ b/framework/Furion.Pure/RemoteRequest/Attributes/Parameters/QueryStringAttribute.cs @@ -39,13 +39,20 @@ public class QueryStringAttribute : ParameterBaseAttribute /// 构造函数 /// /// - public QueryStringAttribute(string alias) + /// + public QueryStringAttribute(string alias, string format = null) { Alias = alias; + Format = format; } /// /// 参数别名 /// public string Alias { get; set; } + + /// + /// 格式化 + /// + public string Format { get; set; } } \ No newline at end of file diff --git a/framework/Furion.Pure/RemoteRequest/Proxies/HttpDispatchProxy.cs b/framework/Furion.Pure/RemoteRequest/Proxies/HttpDispatchProxy.cs index 1feb4fe149427b85e0aaa8b6f044f016289073c2..eb1d00a41941aa6e29900edb3408f845941865d0 100644 --- a/framework/Furion.Pure/RemoteRequest/Proxies/HttpDispatchProxy.cs +++ b/framework/Furion.Pure/RemoteRequest/Proxies/HttpDispatchProxy.cs @@ -168,10 +168,15 @@ public class HttpDispatchProxy : AspectDispatchProxy, IDispatchProxy // 处理基元类型 if (valueType.IsRichPrimitive() - && (!valueType.IsArray || valueType == typeof(string))) + && ((!valueType.IsArray && valueType != typeof(DateTime)) || valueType == typeof(string))) { parameterQueries.Add(queryStringAttribute.Alias ?? item.Name, item.Value); } + // 处理时间类型 + else if (valueType == typeof(DateTime)) + { + parameterQueries.Add(queryStringAttribute.Alias ?? item.Name, ((DateTime)item.Value).ToString(queryStringAttribute.Format)); + } // 处理集合类型 else if (valueType.IsArray || (typeof(IEnumerable).IsAssignableFrom(valueType) diff --git a/framework/Furion/RemoteRequest/Attributes/Parameters/QueryStringAttribute.cs b/framework/Furion/RemoteRequest/Attributes/Parameters/QueryStringAttribute.cs index 46318ab30e194bc96c11bba43526c826ed610b17..2b0955cfbc86abb7496bfb3756960e72643763e7 100644 --- a/framework/Furion/RemoteRequest/Attributes/Parameters/QueryStringAttribute.cs +++ b/framework/Furion/RemoteRequest/Attributes/Parameters/QueryStringAttribute.cs @@ -39,13 +39,20 @@ public class QueryStringAttribute : ParameterBaseAttribute /// 构造函数 /// /// - public QueryStringAttribute(string alias) + /// + public QueryStringAttribute(string alias, string format = null) { Alias = alias; + Format = format; } /// /// 参数别名 /// public string Alias { get; set; } + + /// + /// 格式化 + /// + public string Format { get; set; } } \ No newline at end of file diff --git a/framework/Furion/RemoteRequest/Proxies/HttpDispatchProxy.cs b/framework/Furion/RemoteRequest/Proxies/HttpDispatchProxy.cs index 1feb4fe149427b85e0aaa8b6f044f016289073c2..eb1d00a41941aa6e29900edb3408f845941865d0 100644 --- a/framework/Furion/RemoteRequest/Proxies/HttpDispatchProxy.cs +++ b/framework/Furion/RemoteRequest/Proxies/HttpDispatchProxy.cs @@ -168,10 +168,15 @@ public class HttpDispatchProxy : AspectDispatchProxy, IDispatchProxy // 处理基元类型 if (valueType.IsRichPrimitive() - && (!valueType.IsArray || valueType == typeof(string))) + && ((!valueType.IsArray && valueType != typeof(DateTime)) || valueType == typeof(string))) { parameterQueries.Add(queryStringAttribute.Alias ?? item.Name, item.Value); } + // 处理时间类型 + else if (valueType == typeof(DateTime)) + { + parameterQueries.Add(queryStringAttribute.Alias ?? item.Name, ((DateTime)item.Value).ToString(queryStringAttribute.Format)); + } // 处理集合类型 else if (valueType.IsArray || (typeof(IEnumerable).IsAssignableFrom(valueType)