优化数据返回

This commit is contained in:
不做码农 2023-04-12 22:06:37 +08:00
parent cabdf0eaf9
commit b9b919bac7
2 changed files with 4 additions and 1 deletions

View File

@ -7,6 +7,9 @@ namespace Infrastructure
[Description("success")]
SUCCESS = 200,
[Description("no data")]
NO_DATA = 210,
[Description("参数错误")]
PARAM_ERROR = 101,

View File

@ -22,7 +22,7 @@ namespace ZR.Admin.WebApi.Controllers
/// <returns></returns>
protected IActionResult SUCCESS(object data, string timeFormatStr = "yyyy-MM-dd HH:mm:ss")
{
string jsonStr = GetJsonStr(GetApiResult(data != null ? ResultCode.SUCCESS : ResultCode.FAIL, data), timeFormatStr);
string jsonStr = GetJsonStr(GetApiResult(data != null ? ResultCode.SUCCESS : ResultCode.NO_DATA, data), timeFormatStr);
return Content(jsonStr, "application/json");
}