简化webapi
This commit is contained in:
@@ -11,7 +11,6 @@ using XCode;
|
||||
using System.Web;
|
||||
using COMCMS.Web.Filter;
|
||||
using NewLife.Log;
|
||||
using static COMCMS.Web.Models.APIModels;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Senparc.Weixin.WxOpen;
|
||||
|
||||
@@ -11,7 +11,6 @@ using XCode;
|
||||
using System.Web;
|
||||
using COMCMS.Web.Filter;
|
||||
using NewLife.Log;
|
||||
using static COMCMS.Web.Models.APIModels;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Senparc.Weixin.WxOpen;
|
||||
|
||||
@@ -11,10 +11,10 @@ using XCode;
|
||||
using System.Web;
|
||||
using COMCMS.Web.Filter;
|
||||
using NewLife.Log;
|
||||
using static COMCMS.Web.Models.APIModels;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Senparc.Weixin.WxOpen;
|
||||
using COMCMS.Web.Models;
|
||||
|
||||
namespace COMCMS.Web.Controllers.api
|
||||
{
|
||||
|
||||
@@ -120,7 +120,7 @@ namespace COMCMS.Web.Filter
|
||||
string timeStamp = pars["timeStamp"];
|
||||
//判断时间有效性
|
||||
DateTime postTime = Utils.StampToDateTime(timeStamp);
|
||||
if (postTime < DateTime.Now.AddSeconds(-120))//30秒有效期
|
||||
if (postTime < DateTime.UtcNow.AddSeconds(-120))//30秒有效期
|
||||
{
|
||||
return new ReJson(40004, "signature 错误!", 1);
|
||||
}
|
||||
|
||||
@@ -5,8 +5,6 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace COMCMS.Web.Models
|
||||
{
|
||||
public class APIModels
|
||||
{
|
||||
#region 修改我的个人资料Model
|
||||
public class APIModMyInfo
|
||||
{
|
||||
@@ -57,5 +55,54 @@ namespace COMCMS.Web.Models
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 通用返回信息
|
||||
public class ReJson
|
||||
{
|
||||
public ReJson(string message)
|
||||
{
|
||||
this.message = message;
|
||||
code = 0;
|
||||
}
|
||||
|
||||
public ReJson(int code, string message)
|
||||
{
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public ReJson(int code, string message, int isReload)
|
||||
{
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
this.isReload = isReload;
|
||||
}
|
||||
|
||||
public ReJson(int code, string message, object detail)
|
||||
{
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
this.detail = detail;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 返回代码 0 为正确
|
||||
/// </summary>
|
||||
public int code { get; set; } = 40000;
|
||||
|
||||
/// <summary>
|
||||
/// 提示语
|
||||
/// </summary>
|
||||
public string message { get; set; }
|
||||
/// <summary>
|
||||
/// 是否重新加载
|
||||
/// </summary>
|
||||
public int isReload { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 数据详情 object
|
||||
/// </summary>
|
||||
public object detail { get; set; }
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user