|
@@ -56,34 +56,29 @@ namespace MySystem
|
|
|
#region 获取列表
|
|
|
public List<int> GetList(int MerchantId, int pageNum = 1, int pageSize = 10)
|
|
|
{
|
|
|
- string key = "PosMachineList:" + MerchantId;
|
|
|
- List<int> list = new List<int>();
|
|
|
- if (RedisDbconn.Instance.Exists(key))
|
|
|
- {
|
|
|
- list = RedisDbconn.Instance.GetList<int>(key, pageNum, pageSize);
|
|
|
- if (list.Count > 0)
|
|
|
- {
|
|
|
- return list;
|
|
|
- }
|
|
|
- }
|
|
|
+ // string key = "PosMachineList:" + MerchantId;
|
|
|
+ // List<int> list = new List<int>();
|
|
|
+ // if (RedisDbconn.Instance.Exists(key))
|
|
|
+ // {
|
|
|
+ // list = RedisDbconn.Instance.GetList<int>(key, pageNum, pageSize);
|
|
|
+ // if (list.Count > 0)
|
|
|
+ // {
|
|
|
+ // return list;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ int skip = (pageNum - 1) * pageSize;
|
|
|
WebCMSEntities db = new WebCMSEntities();
|
|
|
- var mysqllist = db.PosMachines.Select(m => new { m.Id, m.BindMerchantId }).Where(m => m.BindMerchantId == MerchantId).OrderByDescending(m => m.Id).ToList();
|
|
|
+ List<int> newlist = new List<int>();
|
|
|
+ var mysqllist = db.PosMachines.Select(m => new { m.Id, m.BindMerchantId }).Where(m => m.BindMerchantId == MerchantId).OrderByDescending(m => m.Id).Skip(skip).Take(pageSize).ToList();
|
|
|
if (mysqllist.Count > 0)
|
|
|
{
|
|
|
- List<int> newlist = new List<int>();
|
|
|
foreach (var sub in mysqllist)
|
|
|
{
|
|
|
newlist.Add(sub.Id);
|
|
|
}
|
|
|
- RedisDbconn.Instance.Clear(key);
|
|
|
- foreach (int sub in newlist)
|
|
|
- {
|
|
|
- RedisDbconn.Instance.AddRightList(key, sub);
|
|
|
- }
|
|
|
- RedisDbconn.Instance.SetExpire(key, Library.function.get_Random(1800, 5400));
|
|
|
}
|
|
|
db.Dispose();
|
|
|
- return list;
|
|
|
+ return newlist;
|
|
|
}
|
|
|
#endregion
|
|
|
}
|