Files
juipnet/Infrastructure/WxApi/Response/WxResponseBase.cs

24 lines
759 B
C#
Raw Normal View History

2020-12-28 14:55:48 +08:00
using Hncore.Infrastructure.Extension;
using System;
namespace Hncore.Wx.Open
{
public class ResponseBase
{
public int errcode { get; set; }
public string errmsg { get; set; }
public int expires_in { get; set; }
public long create_from { get; set; }
public virtual bool need_to_refresh_token
{
get
{
var timespan = (DateTime.Now.TimestampFrom19700101() - create_from);
//此处不应该等于0 errcode=0表明微信返回的token有错误 需要刷新 ==0是正确的
//提前10分钟过期
return errcode != 0 || timespan < 0 || timespan > expires_in-10*60;
}
}
}
}