using Api.Framework; using Api.Framework.Enums; using Api.Framework.Model; using Api.Framework.Tools; using SqlSugar; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using WPHRebate.Entitys; using WPHRebate.Properties; namespace WPHRebate { public static class SessionExt { const string wphinfo_temp_list_wphrebate = "wphinfo_temp_list_wphrebate"; /// /// 获取fl_adzone_info表的数据集合缓存 /// /// /// 刷新 /// public static List FindWphInfoTempGroups(this SqlSugarClient session, bool refresh = false) { var wphinfo_temp_groups = ApiClient.Cache.Get>(wphinfo_temp_list_wphrebate);//根据KEY、获得缓存 if (refresh || wphinfo_temp_groups == null) { wphinfo_temp_groups = session.Find($"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(wphinfo_temp_list_wphrebate, wphinfo_temp_groups, 60); } return wphinfo_temp_groups; } public static void Clear() { ApiClient.Cache.Remove(wphinfo_temp_list_wphrebate); } } }