Files
Web_CRICS_Server_VS2010_Prod/Service/Implement/SysOauth2Manager.cs
2025-12-11 09:17:16 +08:00

48 lines
1.5 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Dao;
using Domain;
namespace Service.Implement
{
public class SysOauth2Manager : GenericManagerBase<SysOauth2>, ISysOauth2Manager
{
public IList<SysOauth2> LoadAllByPage(out long total, int page, int rows, string order, string sort)
{
return ((ISysOauth2Repository)(this.CurrentRepository)).LoadAllByPage(out total, page, rows, order, sort).ToList();
}
/// <summary>
/// 根据code获取最新的授权记录如果授权记录已过期则返回null
/// </summary>
/// <param name="code"></param>
/// <returns></returns>
public SysOauth2 Get(string code)
{
var sysOauth2 = ((ISysOauth2Repository)(this.CurrentRepository)).Get(code);
if (null != sysOauth2)
{
if (sysOauth2.CreatedDate.AddSeconds(sysOauth2.ExpiresIn) < DateTime.Now)
{
return null;
}
}
return sysOauth2;
}
public SysOauth2 GetByRefreshToken(string refreshToken)
{
return ((ISysOauth2Repository)(this.CurrentRepository)).GetByRefreshToken(refreshToken);
}
/// <summary>
/// 获取小度token
/// </summary>
/// <returns></returns>
public string GetXiaoDuToken()
{
return ((ISysOauth2Repository)(this.CurrentRepository)).GetXiaoDuToken();
}
}
}