|
|
@ -565,42 +565,11 @@ public static class Extensions |
|
|
|
return target; |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary></summary>
|
|
|
|
/// <param name="this"></param>
|
|
|
|
/// <param name="list"></param>
|
|
|
|
/// <param name="lower"></param>
|
|
|
|
/// <param name="depth"></param>
|
|
|
|
/// <param name="force"></param>
|
|
|
|
public static void Respond(this ApiResponse @this, IList list, bool lower = true, int depth = -1, bool force = false) |
|
|
|
{ |
|
|
|
if (@this == null) return; |
|
|
|
|
|
|
|
if (list == null) |
|
|
|
{ |
|
|
|
@this.Error("获取失败。"); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
@this.Data.SetProperty("count", list.Count); |
|
|
|
@this.Data.SetProperty("list", Json.Parse(list, lower, depth, force)); |
|
|
|
} |
|
|
|
/// <summary>设置响应,当发生错误时设置响应。返回错误信息。</summary>
|
|
|
|
public static string Respond(this ApiResponse @this, IList list, bool lower = true, int depth = -1, bool force = false) => WebUtility.Respond(@this, list, lower, depth, force); |
|
|
|
|
|
|
|
/// <summary></summary>
|
|
|
|
/// <param name="this"></param>
|
|
|
|
/// <param name="record"></param>
|
|
|
|
/// <param name="lower"></param>
|
|
|
|
public static void Respond(this ApiResponse @this, Record record, bool lower = true) |
|
|
|
{ |
|
|
|
if (@this == null) return; |
|
|
|
|
|
|
|
if (record == null) |
|
|
|
{ |
|
|
|
@this.Error("获取失败。"); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
@this.Data.Reset(Json.Parse(record, lower)); |
|
|
|
} |
|
|
|
/// <summary>设置响应,当发生错误时设置响应。返回错误信息。</summary>
|
|
|
|
public static string Respond(this ApiResponse @this, Record record, bool lower = true) => WebUtility.Respond(@this, record, lower); |
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|