60 lines
3.3 KiB
C#
60 lines
3.3 KiB
C#
|
using Api.Framework;
|
|||
|
using Api.Framework.Enums;
|
|||
|
using Api.Framework.Tools;
|
|||
|
using SqlSugar;
|
|||
|
using System;
|
|||
|
using System.Collections;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Linq;
|
|||
|
using System.Text;
|
|||
|
using System.Threading.Tasks;
|
|||
|
using Weixin.TBCirclePromotion.Entitys;
|
|||
|
using Weixin.TBCirclePromotion.Properties;
|
|||
|
|
|||
|
namespace Weixin.TBCirclePromotion
|
|||
|
{
|
|||
|
public static class SessionEx
|
|||
|
{
|
|||
|
const string tb_circle_promotion_temp_list = "tb_circle_promotion_temp_list";
|
|||
|
|
|||
|
/// <summary>
|
|||
|
///
|
|||
|
/// </summary>
|
|||
|
/// <param name="session"></param>
|
|||
|
/// <param name="refresh"></param>
|
|||
|
/// <returns></returns>
|
|||
|
public static List<tbinfo_temp> FindTBCirclePromotions(this SqlSugarClient session, bool refresh = false)
|
|||
|
{
|
|||
|
return session.Find<tbinfo_temp>($"select ri.id as ID,ri.type as chattype,ri.name as name,ri.nick as nick,flag.adzone_pid as adzone_pid,flag.adzone_name as adzone_name,flag.onoff as onoff,flag.adzone_pid_cps_name as adzone_pid_cps_name from fl_robot_info ri left join (select r.id as ID,r.type as chattype,r.name as name,r.nick as nick,a.adzone_pid as adzone_pid,a.adzone_name as adzone_name,a.onoff as onoff,a.adzone_pid_cps_name as adzone_pid_cps_name from fl_robot_info r left join fl_adzone_info a on r.id = a.robot_id where alliance_id = '{(int)CpsType.阿里妈妈}' and custom_type = '{Resources.SoftwareType}') flag on ri.id = flag.ID");
|
|||
|
|
|||
|
//var tb_circle_promotion_temp = ApiClient.Cache.Get<string>(tb_circle_promotion_temp_list);//根据KEY、获得缓存
|
|||
|
//List<tbinfo_temp> list = null;
|
|||
|
//if (refresh || tb_circle_promotion_temp == null)
|
|||
|
//{
|
|||
|
// list = session.Find<tbinfo_temp>($"select ri.id as ID,ri.type as chattype,ri.name as name,ri.nick as nick,flag.adzone_pid as adzone_pid,flag.adzone_name as adzone_name,flag.onoff as onoff,flag.adzone_pid_cps_name as adzone_pid_cps_name from fl_robot_info ri left join (select r.id as ID,r.type as chattype,r.name as name,r.nick as nick,a.adzone_pid as adzone_pid,a.adzone_name as adzone_name,a.onoff as onoff,a.adzone_pid_cps_name as adzone_pid_cps_name from fl_robot_info r left join fl_adzone_info a on r.id = a.robot_id where alliance_id = '{(int)CpsType.阿里妈妈}' and custom_type = '{Resources.SoftwareType}') flag on ri.id = flag.ID");
|
|||
|
|
|||
|
// Dictionary<string, object> pair = new Dictionary<string, object>() { { "data", list } };
|
|||
|
// tb_circle_promotion_temp = CsharpHttpHelper.HttpHelper.ObjectToJson(pair);
|
|||
|
// ApiClient.Cache.Set(tb_circle_promotion_temp_list, tb_circle_promotion_temp, 60);
|
|||
|
//}
|
|||
|
//if (list == null && !string.IsNullOrWhiteSpace(tb_circle_promotion_temp))
|
|||
|
//{
|
|||
|
// var pair = CsharpHttpHelper.HttpExtend.JsonToDictionary(tb_circle_promotion_temp);
|
|||
|
// if (pair != null && pair.ContainsKey("data"))
|
|||
|
// {
|
|||
|
// var result = pair["data"] as ArrayList;
|
|||
|
// list = new List<tbinfo_temp>();
|
|||
|
// foreach (tbinfo_temp item in result)
|
|||
|
// {
|
|||
|
// list.Add(item);
|
|||
|
// }
|
|||
|
// }
|
|||
|
//}
|
|||
|
//if (list == null)
|
|||
|
// list = new List<tbinfo_temp>();
|
|||
|
//return list;
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
}
|