增加webapi 错误统一返回

This commit is contained in:
2018-05-16 23:36:49 +08:00
parent 9642d44c5c
commit ac0e7c830a
3 changed files with 38 additions and 0 deletions
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using COMCMS.Common;
using COMCMS.Web.Common;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
@@ -10,6 +11,7 @@ namespace COMCMS.Web.Controllers.api
{
[Produces("application/json")]
[Route("api/[controller]/[action]")]
[WebAPIHandleError]
public class APIBaseController : Controller
{
#region 通用信息
@@ -47,5 +47,15 @@ namespace COMCMS.Web.Controllers.api
}
}
#endregion
#region 测试出错
[HttpGet]
public object GetTest()
{
int a = 1,b=0;
var c = a / b;
return reJson;
}
#endregion
}
}