44 lines
1.6 KiB
C#
44 lines
1.6 KiB
C#
|
using Api.Framework;
|
|||
|
using Api.Framework.Tools;
|
|||
|
using SqlSugar;
|
|||
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Linq;
|
|||
|
using System.Text;
|
|||
|
using System.Threading.Tasks;
|
|||
|
using VideoFission.Entitys;
|
|||
|
|
|||
|
namespace VideoFission
|
|||
|
{
|
|||
|
public static class RuleInfoEx
|
|||
|
{
|
|||
|
public static fl_plugin_videofission_rule_info FindSignInfo(this SqlSugarClient session, RuleType type, long amount)
|
|||
|
{
|
|||
|
var list = session.FindSignInfos(type);
|
|||
|
if (list != null && list.Count > 0)
|
|||
|
{
|
|||
|
return list.FirstOrDefault(f=>f.amount == amount);
|
|||
|
}
|
|||
|
return null;
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 获得延迟冻结信息
|
|||
|
/// </summary>
|
|||
|
/// <param name="session"></param>
|
|||
|
/// <param name="refresh">是否刷新缓存</param>
|
|||
|
/// <returns></returns>
|
|||
|
public static List<fl_plugin_videofission_rule_info> FindSignInfos(this SqlSugarClient session, RuleType type, bool refresh = false)
|
|||
|
{
|
|||
|
var key = $"fl_plugin_videofission_rule_info_tables_{type}";
|
|||
|
var list = ApiClient.Cache.Get<List<fl_plugin_videofission_rule_info>>(key);
|
|||
|
if (list != null && !refresh) return list;
|
|||
|
list = session.Find<fl_plugin_videofission_rule_info>("select * from fl_plugin_videofission_rule_info where ruletype = @ruletype order by amount asc", new { ruletype = (int)type });
|
|||
|
if (list == null) list = new List<fl_plugin_videofission_rule_info>();
|
|||
|
ApiClient.Cache.Set(key, list, 60);
|
|||
|
return list;
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
}
|