Skip to content

Commit c95502a

Browse files
committed
[增加]1. 增加错误码的处理
1 parent 31fe4c1 commit c95502a

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

GameFrameX.Foundation.Http.Normalization/HttpJsonResultData.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,16 @@ public sealed class HttpJsonResultData<T>
1313
/// </summary>
1414
public bool IsSuccess { get; set; } = false;
1515

16+
/// <summary>
17+
/// 响应码
18+
/// 表示请求的处理结果,为0表示成功,其他值表示不同的错误类型。
19+
/// </summary>
20+
public int Code { get; set; }
21+
1622
/// <summary>
1723
/// 数据对象
1824
/// 包含请求成功时返回的数据,类型为T。
25+
/// 如果请求失败,可能为默认值或null。
1926
/// </summary>
2027
public T Data { get; set; }
2128
}

GameFrameX.Foundation.Http.Normalization/HttpJsonResultHelper.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ public static class HttpJsonResultHelper
2828
// 检查响应码是否表示成功
2929
if (httpJsonResult.Code != 0)
3030
{
31+
resultData.Code = httpJsonResult.Code;
3132
return resultData; // 返回默认的失败结果
3233
}
3334

0 commit comments

Comments
 (0)