fix namesapce

This commit is contained in:
2020-08-05 15:29:56 +08:00
parent f1138a5a10
commit 2abe486151
17 changed files with 117 additions and 120 deletions
@@ -1,12 +1,12 @@
using YYApi.Communications;
using SimApi.Communications;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using System.Linq;
using YYApi.Exceptions;
using YYApi.Attributes;
using SimApi.Exceptions;
using SimApi.Attributes;
namespace YYApi.Controllers
namespace SimApi.Controllers
{
/// <summary>
/// 基础控制器,所有控制器均继承本控制器
@@ -14,12 +14,12 @@ namespace YYApi.Controllers
/// 2. 报错返回
/// 3. 错误回馈页面
/// </summary>
public class YYBaseController : Controller
public class SimApiBaseController : Controller
{
/// <summary>
/// 当前登录用户的ID
/// </summary>
protected YYLoginItem LoginInfo => (YYLoginItem)HttpContext.Items["LoginInfo"];
protected SimApiLoginItem LoginInfo => (SimApiLoginItem)HttpContext.Items["LoginInfo"];
/// <summary>
/// 验证请求参数
@@ -49,7 +49,7 @@ namespace YYApi.Controllers
/// <returns></returns>
protected static void Error(int code = 500, string message = "")
{
throw new YYApiException(code, message);
throw new SimApiException(code, message);
}
/// <summary>
@@ -81,11 +81,11 @@ namespace YYApi.Controllers
/// 上传文件
/// </summary>
/// <returns></returns>
protected YYBaseResponse<string> UploadFile()
protected SimApiBaseResponse<string> UploadFile()
{
return new YYBaseResponse<string>();
return new SimApiBaseResponse<string>();
}
}
}
@@ -1,16 +1,16 @@
using System;
using Microsoft.AspNetCore.Mvc;
using YYApi.Attributes;
using YYApi.Communications;
using YYApi.Helpers;
using SimApi.Attributes;
using SimApi.Communications;
using SimApi.Helpers;
namespace YYApi.Controllers
namespace SimApi.Controllers
{
public class YYCommonController : YYBaseController
public class YYCommonController : SimApiBaseController
{
private YYAuth Auth { get; }
private SimApiAuth Auth { get; }
public YYCommonController(YYAuth auth)
public YYCommonController(SimApiAuth auth)
{
Auth = auth;
}
@@ -22,9 +22,9 @@ namespace YYApi.Controllers
/// <returns></returns>
[HttpGet("exception/{code:int}")]
[ApiExplorerSettings(IgnoreApi = true)]
public YYBaseResponse ExceptionHandler(int code)
public SimApiBaseResponse ExceptionHandler(int code)
{
var response = new YYBaseResponse();
var response = new SimApiBaseResponse();
response.SetCode(code);
return response;
}
@@ -33,19 +33,19 @@ namespace YYApi.Controllers
/// 检测用户登陆的控制器
/// </summary>
/// <returns></returns>
[HttpPost("/auth/check"), YYDoc("认证", "检测登陆")]
public YYBaseResponse<int> CheckLogin()
[HttpPost("/auth/check"), SimApiDoc("认证", "检测登陆")]
public SimApiBaseResponse<int> CheckLogin()
{
ErrorWhenNull(LoginInfo, 401);
return new YYBaseResponse<int> { Data = LoginInfo.Id };
return new SimApiBaseResponse<int> { Data = LoginInfo.Id };
}
/// <summary>
/// 退出登陆
/// </summary>
/// <returns></returns>
[HttpPost("/auth/logout"), YYDoc("认证", "退出登陆")]
public YYBaseResponse Logout()
[HttpPost("/auth/logout"), SimApiDoc("认证", "退出登陆")]
public SimApiBaseResponse Logout()
{
string token = null;
@@ -54,7 +54,7 @@ namespace YYApi.Controllers
token = Request.Headers["Token"];
}
Auth.Logout(token);
return new YYBaseResponse();
return new SimApiBaseResponse();
}
}
}