Skip to content

Commit

Permalink
合并
Browse files Browse the repository at this point in the history
  • Loading branch information
Coldairarrow committed Apr 19, 2020
2 parents 959f48f + 673830d commit 8b6bd09
Show file tree
Hide file tree
Showing 253 changed files with 4,039 additions and 16,667 deletions.
130 changes: 36 additions & 94 deletions docs/初始化文件/MySQL.sql

Large diffs are not rendered by default.

298 changes: 150 additions & 148 deletions docs/初始化文件/Oracle.sql

Large diffs are not rendered by default.

202 changes: 86 additions & 116 deletions docs/初始化文件/PostgreSQL.sql

Large diffs are not rendered by default.

615 changes: 138 additions & 477 deletions docs/初始化文件/SQLServer.sql

Large diffs are not rendered by default.

119 changes: 0 additions & 119 deletions src/Coldairarrow.Api/00Filter/BaseActionFilter .cs

This file was deleted.

114 changes: 112 additions & 2 deletions src/Coldairarrow.Api/00Filter/BaseActionFilterAsync.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
using Microsoft.AspNetCore.Mvc.Filters;
using Coldairarrow.Util;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;
using System;
using System.Threading.Tasks;

namespace Coldairarrow.Api
{
public abstract class BaseActionFilterAsync : BaseActionFilter, IAsyncActionFilter
public abstract class BaseActionFilterAsync : Attribute, IAsyncActionFilter
{
public async virtual Task OnActionExecuting(ActionExecutingContext context)
{
Expand All @@ -24,5 +27,112 @@ public async Task OnActionExecutionAsync(ActionExecutingContext context, ActionE
await OnActionExecuted(nextContext);
}
}

/// <summary>
/// 返回JSON
/// </summary>
/// <param name="json">json字符串</param>
/// <returns></returns>
public ContentResult JsonContent(string json)
{
return new ContentResult { Content = json, StatusCode = 200, ContentType = "application/json; charset=utf-8" };
}

/// <summary>
/// 返回成功
/// </summary>
/// <returns></returns>
public ContentResult Success()
{
AjaxResult res = new AjaxResult
{
Success = true,
Msg = "请求成功!"
};

return JsonContent(res.ToJson());
}

/// <summary>
/// 返回成功
/// </summary>
/// <param name="msg">消息</param>
/// <returns></returns>
public ContentResult Success(string msg)
{
AjaxResult res = new AjaxResult
{
Success = true,
Msg = msg
};

return JsonContent(res.ToJson());
}

/// <summary>
/// 返回成功
/// </summary>
/// <param name="data">返回的数据</param>
/// <returns></returns>
public ContentResult Success<T>(T data)
{
AjaxResult<T> res = new AjaxResult<T>
{
Success = true,
Msg = "请求成功!",
Data = data
};

return JsonContent(res.ToJson());
}

/// <summary>
/// 返回错误
/// </summary>
/// <returns></returns>
public ContentResult Error()
{
AjaxResult res = new AjaxResult
{
Success = false,
Msg = "请求失败!"
};

return JsonContent(res.ToJson());
}

/// <summary>
/// 返回错误
/// </summary>
/// <param name="msg">错误提示</param>
/// <returns></returns>
public ContentResult Error(string msg)
{
AjaxResult res = new AjaxResult
{
Success = false,
Msg = msg,
};

return JsonContent(res.ToJson());
}

/// <summary>
/// 返回错误
/// </summary>
/// <param name="msg">错误提示</param>
/// <param name="errorCode">错误代码</param>
/// <returns></returns>
public ContentResult Error(string msg, int errorCode)
{
AjaxResult res = new AjaxResult
{
Success = false,
Msg = msg,
ErrorCode = errorCode
};

return JsonContent(res.ToJson());
}
}
}
59 changes: 0 additions & 59 deletions src/Coldairarrow.Api/00Filter/JSON支持/JsonParamterAttribute.cs

This file was deleted.

This file was deleted.

Loading

0 comments on commit 8b6bd09

Please sign in to comment.