You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
1.4 KiB
51 lines
1.4 KiB
namespace Video.Application |
|
{ |
|
public class ApiResult<T> |
|
{ |
|
public int Code { get; set; } |
|
public string Msg { get; set; } |
|
public string InnerMsg { get; set; } |
|
public T Data { get; set; } |
|
|
|
public static ApiResult<T> IsSuccess(T data, string msg = "请求成功") |
|
{ |
|
return new ApiResult<T>() { Code = 200, Data = data, Msg = msg }; |
|
} |
|
|
|
/// <summary> |
|
/// 服务端处理错误 |
|
/// </summary> |
|
/// <param name="msg"></param> |
|
/// <returns></returns> |
|
public static ApiResult<T> IsFail(string msg) |
|
{ |
|
return new ApiResult<T> { Code = 2005, Msg = msg }; |
|
} |
|
|
|
/// <summary> |
|
/// 服务端处理错误 |
|
/// </summary> |
|
/// <param name="msg"></param> |
|
/// <returns></returns> |
|
public static ApiResult<T> IsNoFound(string msg = null) |
|
{ |
|
return new ApiResult<T> { Code = 2005, Msg = msg ?? "数据不存在" }; |
|
} |
|
|
|
/// <summary> |
|
/// 客户端错误 |
|
/// </summary> |
|
/// <param name="msg"></param> |
|
/// <returns></returns> |
|
public static ApiResult<T> IsBadReq(string msg) |
|
{ |
|
return new ApiResult<T> { Code = 2006, Msg = msg }; |
|
} |
|
} |
|
|
|
public class ApiHubResult<T> : ApiResult<T> |
|
{ |
|
public long? Projectid { get; set; } |
|
public long? Constid { get; set; } |
|
} |
|
} |