|
|
|
@ -10,9 +10,9 @@ namespace Shentun.WebApi.Service |
|
|
|
} |
|
|
|
public class ReturnValue : IReturnValue |
|
|
|
{ |
|
|
|
public int Code { get; set; } |
|
|
|
public string Message { get; set; } |
|
|
|
public object Data { get; set; } |
|
|
|
public int code { get; set; } |
|
|
|
public string message { get; set; } |
|
|
|
public object data { get; set; } |
|
|
|
private ReturnValue() |
|
|
|
{ |
|
|
|
|
|
|
|
@ -21,45 +21,45 @@ namespace Shentun.WebApi.Service |
|
|
|
public static ReturnValue CreateInstance(int code, string message, object obj) |
|
|
|
{ |
|
|
|
ReturnValue returnValue = new ReturnValue(); |
|
|
|
returnValue.Code = code; |
|
|
|
returnValue.Message = message; |
|
|
|
returnValue.Data = obj; |
|
|
|
returnValue.code = code; |
|
|
|
returnValue.message = message; |
|
|
|
returnValue.data = obj; |
|
|
|
return returnValue; |
|
|
|
} |
|
|
|
|
|
|
|
public static ReturnValue CreateSuccessInstance() |
|
|
|
{ |
|
|
|
ReturnValue returnValue = new ReturnValue(); |
|
|
|
returnValue.Code = 1; |
|
|
|
returnValue.Message = "Success"; |
|
|
|
returnValue.Data = null; |
|
|
|
returnValue.code = 1; |
|
|
|
returnValue.message = "Success"; |
|
|
|
returnValue.data = null; |
|
|
|
return returnValue; |
|
|
|
} |
|
|
|
|
|
|
|
public static ReturnValue CreateSuccessInstance(Object obj) |
|
|
|
{ |
|
|
|
ReturnValue returnValue = new ReturnValue(); |
|
|
|
returnValue.Code = 1; |
|
|
|
returnValue.Message = "Success"; |
|
|
|
returnValue.Data = obj; |
|
|
|
returnValue.code = 1; |
|
|
|
returnValue.message = "Success"; |
|
|
|
returnValue.data = obj; |
|
|
|
return returnValue; |
|
|
|
} |
|
|
|
|
|
|
|
public static ReturnValue CreateNotFoundInstance() |
|
|
|
{ |
|
|
|
ReturnValue returnValue = new ReturnValue(); |
|
|
|
returnValue.Code = 0; |
|
|
|
returnValue.Message = "无数据"; |
|
|
|
returnValue.Data = null; |
|
|
|
returnValue.code = 0; |
|
|
|
returnValue.message = "无数据"; |
|
|
|
returnValue.data = null; |
|
|
|
return returnValue; |
|
|
|
} |
|
|
|
|
|
|
|
public static ReturnValue CreateErrorInstance(string message) |
|
|
|
{ |
|
|
|
ReturnValue returnValue = new ReturnValue(); |
|
|
|
returnValue.Code = -1; |
|
|
|
returnValue.Message = message; |
|
|
|
returnValue.Data = null; |
|
|
|
returnValue.code = -1; |
|
|
|
returnValue.message = message; |
|
|
|
returnValue.data = null; |
|
|
|
return returnValue; |
|
|
|
} |
|
|
|
|
|
|
|
@ -67,18 +67,18 @@ namespace Shentun.WebApi.Service |
|
|
|
public static ReturnValue CreateErrorInstance(int code, string messsage) |
|
|
|
{ |
|
|
|
ReturnValue returnValue = new ReturnValue(); |
|
|
|
returnValue.Code = code; |
|
|
|
returnValue.Message = messsage; |
|
|
|
returnValue.Data = null; |
|
|
|
returnValue.code = code; |
|
|
|
returnValue.message = messsage; |
|
|
|
returnValue.data = null; |
|
|
|
return returnValue; |
|
|
|
} |
|
|
|
|
|
|
|
public static ReturnValue CreateDataBaseErrorInstance(string message) |
|
|
|
{ |
|
|
|
ReturnValue returnValue = new ReturnValue(); |
|
|
|
returnValue.Code = -2; |
|
|
|
returnValue.Message = "数据库错误:" + message; |
|
|
|
returnValue.Data = null; |
|
|
|
returnValue.code = -2; |
|
|
|
returnValue.message = "数据库错误:" + message; |
|
|
|
returnValue.data = null; |
|
|
|
return returnValue; |
|
|
|
} |
|
|
|
} |
|
|
|
|