mirror of
https://gitee.com/ccnetcore/Yi
synced 2026-03-10 03:30:51 +08:00
框架分层
This commit is contained in:
18
Yi.Framework/Yi.Framework.Common/Models/LogModel.cs
Normal file
18
Yi.Framework/Yi.Framework.Common/Models/LogModel.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Yi.Framework.Common.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// 写入分布式日志需要的字段
|
||||
/// </summary>
|
||||
public class LogModel
|
||||
{
|
||||
public string OriginalClassName { get; set; }
|
||||
public string OriginalMethodName { get; set; }
|
||||
public string Remark { get; set; }
|
||||
}
|
||||
}
|
||||
66
Yi.Framework/Yi.Framework.Common/Models/Result.cs
Normal file
66
Yi.Framework/Yi.Framework.Common/Models/Result.cs
Normal file
@@ -0,0 +1,66 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
|
||||
namespace Yi.Framework.Common.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// 结果数据
|
||||
/// </summary>
|
||||
public class Result
|
||||
{
|
||||
public bool status { get; set; }
|
||||
public int code { get; set; }
|
||||
public string msg { get; set; }
|
||||
public object data { get; set; }
|
||||
public static Result Instance(bool status, string msg)
|
||||
{
|
||||
return new Result() { status = status, code = 500, msg = msg };
|
||||
}
|
||||
public static Result Error(string msg = "fail")
|
||||
{
|
||||
return new Result() { status = false, code = 500, msg = msg };
|
||||
}
|
||||
public static Result Success(string msg = "succeed")
|
||||
{
|
||||
return new Result() { status = true, code = 200, msg = msg };
|
||||
}
|
||||
public Result SetData(object obj)
|
||||
{
|
||||
this.data = obj;
|
||||
return this;
|
||||
}
|
||||
public Result SetCode(int Code)
|
||||
{
|
||||
this.code = Code;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
public class Result<T>
|
||||
{
|
||||
public bool status { get; set; }
|
||||
public int code { get; set; }
|
||||
public string msg { get; set; }
|
||||
public T data { get; set; }
|
||||
|
||||
public static Result<T> Instance(bool status, string msg)
|
||||
{
|
||||
return new Result<T>() { status = status, code = 500, msg = msg };
|
||||
}
|
||||
public static Result<T> Error(string msg = "fail")
|
||||
{
|
||||
return new Result<T> { status = false, code = 500, msg = msg };
|
||||
}
|
||||
public static Result<T> Success(string msg = "succeed")
|
||||
{
|
||||
return new Result<T> { status = true, code = 200, msg = msg };
|
||||
}
|
||||
public Result<T> SetData(T TValue)
|
||||
{
|
||||
this.data = TValue;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user