67 lines
4.0 KiB
C#
67 lines
4.0 KiB
C#
using Api.Framework;
|
|
using Api.Framework.Enums;
|
|
using Api.Framework.Model;
|
|
using Api.Framework.Tools;
|
|
using DYRebate.Entitys;
|
|
using DYRebate.Properties;
|
|
using SqlSugar;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace DYRebate
|
|
{
|
|
public static class SessionExt
|
|
{
|
|
const string dyinfo_temp_list_dyrebate = "dyinfo_temp_list_dyrebate";
|
|
const string dyinfo_temp_list_dkrebate = "dyinfo_temp_list_dkrebate";
|
|
|
|
/// <summary>
|
|
/// 获取fl_adzone_info表的数据集合缓存
|
|
/// </summary>
|
|
/// <param name="session"></param>
|
|
/// <param name="refresh">刷新</param>
|
|
/// <returns></returns>
|
|
public static List<dyinfo_temp> FindDyInfoTempGroups(this SqlSugarClient session, bool refresh = false)
|
|
{
|
|
|
|
var dyinfo_temp_groups = ApiClient.Cache.Get<List<dyinfo_temp>>(dyinfo_temp_list_dyrebate);//根据KEY、获得缓存
|
|
if (refresh || dyinfo_temp_groups == null)
|
|
{
|
|
dyinfo_temp_groups = session.Find<dyinfo_temp>($"select ri.id as ID,ri.type as chattype,ri.name as name,ri.nick as nick,flag.* from fl_robot_info ri left join (select ai1_temp.robot_id as id,ai1_temp.onoff as onoff,ai1_temp.adzone_pid_cps_name as pid_chief_cps_name,ai1_temp.adzone_pid as pid_chief,ai1_temp.adzone_name as pid_chief_name,ai2_temp.adzone_pid_cps_name as pid_deputy_cps_name,ai2_temp.adzone_pid as pid_deputy,ai2_temp.adzone_name as pid_deputy_name from (select * from fl_adzone_info ai1 where ai1.alliance_id = '{(int)CpsType.抖音联盟}' and ai1.custom_type = '{Resources.SoftwareType}' and ai1.extend = 'chief') ai1_temp INNER JOIN (select * from fl_adzone_info ai2 where ai2.alliance_id = '{(int)CpsType.抖音联盟}' and ai2.custom_type = '{Resources.SoftwareType}' and ai2.extend='deputy') ai2_temp on ai1_temp.robot_id = ai2_temp.robot_id) flag on ri.id = flag.id");
|
|
ApiClient.Cache.Set(dyinfo_temp_list_dyrebate, dyinfo_temp_groups, 60);
|
|
}
|
|
return dyinfo_temp_groups;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取fl_adzone_info表的数据集合缓存
|
|
/// </summary>
|
|
/// <param name="session"></param>
|
|
/// <param name="refresh">刷新</param>
|
|
/// <returns></returns>
|
|
public static List<dyinfo_temp> FindDkInfoTempGroups(this SqlSugarClient session, bool refresh = false)
|
|
{
|
|
var dyinfo_temp_groups = ApiClient.Cache.Get<List<dyinfo_temp>>(dyinfo_temp_list_dkrebate);//根据KEY、获得缓存
|
|
if (refresh || dyinfo_temp_groups == null)
|
|
{
|
|
dyinfo_temp_groups = session.Find<dyinfo_temp>($"select ri.id as ID,ri.type as chattype,ri.name as name,ri.nick as nick,flag.* from fl_robot_info ri left join (select ai1_temp.robot_id as id,ai1_temp.onoff as onoff,ai1_temp.adzone_pid_cps_name as pid_chief_cps_name,ai1_temp.adzone_pid as pid_chief,ai1_temp.adzone_name as pid_chief_name,ai2_temp.adzone_pid_cps_name as pid_deputy_cps_name,ai2_temp.adzone_pid as pid_deputy,ai2_temp.adzone_name as pid_deputy_name from (select * from fl_adzone_info ai1 where ai1.alliance_id = '{(int)CpsType.抖客联盟}' and ai1.custom_type = '{Resources.SoftwareTypeDouKe}' and ai1.extend = 'chief') ai1_temp INNER JOIN (select * from fl_adzone_info ai2 where ai2.alliance_id = '{(int)CpsType.抖客联盟}' and ai2.custom_type = '{Resources.SoftwareTypeDouKe}' and ai2.extend='deputy') ai2_temp on ai1_temp.robot_id = ai2_temp.robot_id) flag on ri.id = flag.id");
|
|
ApiClient.Cache.Set(dyinfo_temp_list_dkrebate, dyinfo_temp_groups, 60);
|
|
}
|
|
return dyinfo_temp_groups;
|
|
}
|
|
|
|
public static fl_member_info FindMemberinfo(this SqlSugarClient session, long userid)
|
|
{
|
|
return session.Find<fl_member_info>("select * from fl_member_info where id = @id", new { id = userid }).FirstOrDefault();
|
|
}
|
|
|
|
public static void Clear()
|
|
{
|
|
ApiClient.Cache.Remove(dyinfo_temp_list_dyrebate);
|
|
}
|
|
}
|
|
}
|