This commit is contained in:
454313500@qq.com
2021-04-10 18:28:45 +08:00
parent d26140ac18
commit 8673e8fd85
12 changed files with 386 additions and 318 deletions

40
CC.Yi.Common/Result.cs Normal file
View File

@@ -0,0 +1,40 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Common
{
/// <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)
{
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;
}
}
}