Browse Source

整理redis读取数据部分
添加service模块

lcl 2 years ago
parent
commit
79130974d8

+ 0 - 11
AppStart/Redis/Mysql/MerchantInfoDbconn.cs

@@ -12,21 +12,10 @@ namespace MySystem
         #region 获取单个字段
         #region 获取单个字段
         public MerchantInfo Get(int Id)
         public MerchantInfo Get(int Id)
         {
         {
-            string key = "MerchantInfo:" + Id;
-            if (RedisDbconn.Instance.Exists(key))
-            {
-                MerchantInfo obj = RedisDbconn.Instance.Get<MerchantInfo>(key);
-                if (obj != null)
-                {
-                    return obj;
-                }
-            }
             WebCMSEntities db = new WebCMSEntities();
             WebCMSEntities db = new WebCMSEntities();
             MerchantInfo order = db.MerchantInfo.FirstOrDefault(m => m.Id == Id);
             MerchantInfo order = db.MerchantInfo.FirstOrDefault(m => m.Id == Id);
             if (order != null)
             if (order != null)
             {
             {
-                RedisDbconn.Instance.Set(key, order);
-                RedisDbconn.Instance.SetExpire(key, Library.function.get_Random(1800, 5400));
             }
             }
             return order;
             return order;
         }
         }

+ 6 - 6
Areas/Api/Controllers/v1/MainServer/ConsumerOrdersController.cs

@@ -115,15 +115,16 @@ namespace MySystem.Areas.Api.Controllers.v1
             int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
             int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
             int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
             int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
             List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
             List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            List<ConsumerOrders> query = RedisDbconn.Instance.GetList<ConsumerOrders>("ConsumerOrders", PageNum, PageSize);
+            string condition = "";
             if (!string.IsNullOrEmpty(data["MerchantId"].ToString()))
             if (!string.IsNullOrEmpty(data["MerchantId"].ToString()))
             {
             {
-                query = query.Where(m => m.MerchantId == MerchantId).ToList();
+                condition += " and MerchantId=" + MerchantId;
             }
             }
             if (!string.IsNullOrEmpty(data["OrderNo"].ToString()))
             if (!string.IsNullOrEmpty(data["OrderNo"].ToString()))
             {
             {
-                query = query.Where(m => m.OrderNo == OrderNo).ToList();
+                condition += " and OrderNo='" + OrderNo + "'";
             }
             }
+            List<ConsumerOrders> query = new ConsumerOrdersService().List(new List<FieldItem>(), condition, PageNum, PageSize);
             foreach (var subdata in query)
             foreach (var subdata in query)
             {
             {
                 Dictionary<string, object> curData = new Dictionary<string, object>();
                 Dictionary<string, object> curData = new Dictionary<string, object>();
@@ -160,10 +161,9 @@ namespace MySystem.Areas.Api.Controllers.v1
             int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
             int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
             int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
             int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
             List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
             List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            List<int> query = RedisDbconn.Instance.GetList<int>("ConsumerOrderForConsumer:" + ConsumerId, PageNum, PageSize);
-            foreach (int OrderId in query)
+            List<ConsumerOrders> query = new ConsumerOrdersService().List(new List<FieldItem>(), " and ConsumerId=" + ConsumerId, PageNum, PageSize);
+            foreach (ConsumerOrders subdata in query)
             {
             {
-                ConsumerOrders subdata = RedisDbconn.Instance.Get<ConsumerOrders>("ConsumerOrders:" + OrderId) ?? new ConsumerOrders();
                 MerchantInfo merchant = MerchantInfoDbconn.Instance.Get(subdata.MerchantId) ?? new MerchantInfo();
                 MerchantInfo merchant = MerchantInfoDbconn.Instance.Get(subdata.MerchantId) ?? new MerchantInfo();
                 Dictionary<string, object> curData = new Dictionary<string, object>();
                 Dictionary<string, object> curData = new Dictionary<string, object>();
                 curData.Add("OrderNo", subdata.OrderNo); //订单号
                 curData.Add("OrderNo", subdata.OrderNo); //订单号

+ 1 - 1
Areas/Api/Controllers/v1/MainServer/ConsumerProfitController.cs

@@ -41,7 +41,7 @@ namespace MySystem.Areas.Api.Controllers.v1
             int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
             int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
             int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
             int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
             List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
             List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            List<ConsumerProfit> query = RedisDbconn.Instance.GetList<ConsumerProfit>("ConsumerProfit:" + ConsumerId, PageNum, PageSize);
+            List<ConsumerProfit> query = new ConsumerProfitService().List(new List<FieldItem>(), " and ConsumerId=" + ConsumerId, PageNum, PageSize);
             foreach (var subdata in query)
             foreach (var subdata in query)
             {
             {
                 MerchantInfo merchant = MerchantInfoDbconn.Instance.Get(subdata.MerchantId) ?? new MerchantInfo();
                 MerchantInfo merchant = MerchantInfoDbconn.Instance.Get(subdata.MerchantId) ?? new MerchantInfo();

+ 1 - 1
Areas/Api/Controllers/v1/MainServer/IndexIconListController.cs

@@ -40,7 +40,7 @@ namespace MySystem.Areas.Api.Controllers.v1
             int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
             int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
             int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
             int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
             List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
             List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            List<IndexIconList> query = RedisDbconn.Instance.GetList<IndexIconList>("IndexIconList", PageNum, PageSize);
+            List<IndexIconList> query = new IndexIconListService().List(new List<FieldItem>(), "", PageNum, PageSize);
             foreach (var subdata in query)
             foreach (var subdata in query)
             {
             {
                 Dictionary<string, object> curData = new Dictionary<string, object>();
                 Dictionary<string, object> curData = new Dictionary<string, object>();

+ 2 - 4
Areas/Api/Controllers/v1/MainServer/MerchantInfoController.cs

@@ -454,7 +454,6 @@ namespace MySystem.Areas.Api.Controllers.v1
             {
             {
                 maindb.MerchantInfo.Remove(edit);
                 maindb.MerchantInfo.Remove(edit);
                 maindb.SaveChanges();
                 maindb.SaveChanges();
-                RedisDbconn.Instance.Clear("TmpMerchantInfo:" + UserId);
             }
             }
             return new AppResultJson() { Status = "1", Info = "", Data = Obj };
             return new AppResultJson() { Status = "1", Info = "", Data = Obj };
         }
         }
@@ -478,7 +477,6 @@ namespace MySystem.Areas.Api.Controllers.v1
             int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
             int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
             int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
             int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
             List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
             List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            // List<MerchantInfo> query = RedisDbconn.Instance.GetList<MerchantInfo>("TmpMerchantInfo:" + UserId, PageNum, PageSize).OrderByDescending(m => m.Id).ToList();
             List<MerchantInfo> query = maindb.MerchantInfo.Where(m => m.UserId == UserId && m.QueryCount == 1).ToList();
             List<MerchantInfo> query = maindb.MerchantInfo.Where(m => m.UserId == UserId && m.QueryCount == 1).ToList();
             foreach (var subdata in query)
             foreach (var subdata in query)
             {
             {
@@ -710,7 +708,7 @@ namespace MySystem.Areas.Api.Controllers.v1
             }
             }
             RedisDbconn.Instance.Clear("MobileCodeCheck:" + Mobile);
             RedisDbconn.Instance.Clear("MobileCodeCheck:" + Mobile);
             Dictionary<string, object> Obj = new Dictionary<string, object>();
             Dictionary<string, object> Obj = new Dictionary<string, object>();
-            MerchantForMobile find = RedisDbconn.Instance.Get<MerchantForMobile>("MerchantForMobile:" + Mobile);
+            MerchantForMobile find = new MerchantForMobileService().Query(Mobile);
             if (find == null)
             if (find == null)
             {
             {
                 return new AppResultJson() { Status = "-1", Info = "手机号不正确" };
                 return new AppResultJson() { Status = "-1", Info = "手机号不正确" };
@@ -744,7 +742,7 @@ namespace MySystem.Areas.Api.Controllers.v1
                 Obj.Add("Id", 1);
                 Obj.Add("Id", 1);
                 return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
                 return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
             }
             }
-            MerchantForMobile find = RedisDbconn.Instance.Get<MerchantForMobile>("MerchantForMobile:" + Mobile);
+            MerchantForMobile find = new MerchantForMobileService().Query(Mobile);
             if (find == null)
             if (find == null)
             {
             {
                 return Json(new AppResultJson() { Status = "-1", Info = "手机号不正确" });
                 return Json(new AppResultJson() { Status = "-1", Info = "手机号不正确" });

+ 3 - 3
Areas/Api/Controllers/v1/MainServer/MerchantQrCodeController.cs

@@ -77,7 +77,7 @@ namespace MySystem.Areas.Api.Controllers.v1
             string SnNo = data["SnNo"].ToString(); //Sn编号
             string SnNo = data["SnNo"].ToString(); //Sn编号
             string MachineNo = data["Machine"].ToString(); //音箱码
             string MachineNo = data["Machine"].ToString(); //音箱码
             Dictionary<string, object> Obj = new Dictionary<string, object>();
             Dictionary<string, object> Obj = new Dictionary<string, object>();
-            MerchantQrCode query = RedisDbconn.Instance.Get<MerchantQrCode>("MerchantQrCode:" + SnNo);
+            MerchantQrCode query = new MerchantQrCodeService().Query(SnNo);
             if (query != null)
             if (query != null)
             {
             {
                 if (query.MerchantId > 0)
                 if (query.MerchantId > 0)
@@ -146,9 +146,9 @@ namespace MySystem.Areas.Api.Controllers.v1
             JsonData data = JsonMapper.ToObject(value);
             JsonData data = JsonMapper.ToObject(value);
             int MerchantId = int.Parse(function.CheckInt(data["MerchantId"].ToString())); //商户
             int MerchantId = int.Parse(function.CheckInt(data["MerchantId"].ToString())); //商户
             int MachineId = int.Parse(function.CheckInt(data["MachineId"].ToString())); //设备
             int MachineId = int.Parse(function.CheckInt(data["MachineId"].ToString())); //设备
-            string QrCodeId = data["QrCodeId"].ToString(); //收款码Id
+            int QrCodeId = int.Parse(function.CheckInt(data["QrCodeId"].ToString())); //收款码Id
             Dictionary<string, object> Obj = new Dictionary<string, object>();
             Dictionary<string, object> Obj = new Dictionary<string, object>();
-            MerchantQrCode query = RedisDbconn.Instance.Get<MerchantQrCode>("MerchantQrCode:" + QrCodeId) ?? new MerchantQrCode();
+            MerchantQrCode query = new MerchantQrCodeService().Query(QrCodeId) ?? new MerchantQrCode();
             PosMachines machine = PosMachinesDbconn.Instance.Get(MachineId) ?? new PosMachines();
             PosMachines machine = PosMachinesDbconn.Instance.Get(MachineId) ?? new PosMachines();
             query.MerchantId = MerchantId; //商户
             query.MerchantId = MerchantId; //商户
             query.MachineId = MachineId; //设备
             query.MachineId = MachineId; //设备

+ 1 - 1
Areas/Api/Controllers/v1/MainServer/PageInfoController.cs

@@ -45,7 +45,7 @@ namespace MySystem.Areas.Api.Controllers.v1
             JsonData data = JsonMapper.ToObject(value);
             JsonData data = JsonMapper.ToObject(value);
             Dictionary<string, object> Obj = new Dictionary<string, object>();
             Dictionary<string, object> Obj = new Dictionary<string, object>();
             int Id = int.Parse(function.CheckInt(data["Id"].ToString()));
             int Id = int.Parse(function.CheckInt(data["Id"].ToString()));
-            PageInfo query = RedisDbconn.Instance.Get<PageInfo>("PageInfo:" + Id) ?? new PageInfo();
+            PageInfo query = new PageInfoService().Query(Id);
             Obj.Add("Title", query.Title); //标题
             Obj.Add("Title", query.Title); //标题
             Obj.Add("Contents", query.Contents); //内容
             Obj.Add("Contents", query.Contents); //内容
             return Obj;
             return Obj;

+ 1 - 10
Areas/Api/Controllers/v1/MainServer/PosMachinesController.cs

@@ -42,7 +42,7 @@ namespace MySystem.Areas.Api.Controllers.v1
             int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
             int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
             List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
             List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
             MerchantInfo merchant = MerchantInfoDbconn.Instance.Get(BindMerchantId) ?? new MerchantInfo();
             MerchantInfo merchant = MerchantInfoDbconn.Instance.Get(BindMerchantId) ?? new MerchantInfo();
-            List<PosMachines> query = RedisDbconn.Instance.GetList<PosMachines>("PosMachines:" + BindMerchantId, PageNum, PageSize);
+            List<PosMachines> query = new PosMachinesService().List(new List<FieldItem>(), " and BindMerchantId=" + BindMerchantId, PageNum, PageSize);
             foreach (var subdata in query)
             foreach (var subdata in query)
             {
             {
                 Dictionary<string, object> curData = new Dictionary<string, object>();
                 Dictionary<string, object> curData = new Dictionary<string, object>();
@@ -129,15 +129,6 @@ namespace MySystem.Areas.Api.Controllers.v1
             string CheckKey = "_" + BindMerchantId;
             string CheckKey = "_" + BindMerchantId;
             List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
             List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
             List<int> query = RedisDbconn.Instance.GetList<int>("MerchantQrCodeList:" + BindMerchantId, 1, 1000);
             List<int> query = RedisDbconn.Instance.GetList<int>("MerchantQrCodeList:" + BindMerchantId, 1, 1000);
-            if (PageNum == 1)
-            {
-                query = query.Take(PageSize).ToList();
-            }
-            else
-            {
-                int skipNum = PageSize * (PageNum - 1);
-                query = query.Skip(skipNum).Take(PageSize).ToList();
-            }
             foreach (int MerchantQrCodeId in query)
             foreach (int MerchantQrCodeId in query)
             {
             {
                 MerchantQrCode subdata = RedisDbconn.Instance.Get<MerchantQrCode>("MerchantQrCode:" + MerchantQrCodeId) ?? new MerchantQrCode();
                 MerchantQrCode subdata = RedisDbconn.Instance.Get<MerchantQrCode>("MerchantQrCode:" + MerchantQrCodeId) ?? new MerchantQrCode();

+ 132 - 0
Services/ConsumerProfitService.cs

@@ -0,0 +1,132 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using MySystem.MainModels;
+using Library;
+using LitJson;
+
+namespace MySystem
+{
+    public class ConsumerProfitService
+    {
+        string _conn = "";
+        public ConsumerProfitService()
+        {
+            _conn = ConfigurationManager.AppSettings["SqlConnStr"].ToString();
+        }
+
+        /// <summary>
+        /// 查询列表
+        /// </summary>
+        /// <param name="fields">查询条件(单个字段)</param>
+        /// <param name="condition">查询条件(sql语句)</param>
+        /// <param name="page">页码</param>
+        /// <param name="limit">每页条数</param>
+        /// <returns></returns>
+        public List<ConsumerProfit> List(List<FieldItem> fields, string condition, int page = 1, int limit = 30)
+        {
+            Dictionary<string, object> obj = new DbService(AppConfig.Base.mainTables, _conn).IndexData("ConsumerProfit", fields, "Id desc", "0", page, limit, condition);
+            List<ConsumerProfit> diclist = obj["data"] as List<ConsumerProfit>;
+            return diclist;
+        }
+
+        /// <summary>
+        /// 查询一条记录
+        /// </summary>
+        /// <param name="Id">主键Id</param>
+        /// <returns></returns>
+        public ConsumerProfit Query(int Id)
+        {
+            WebCMSEntities db = new WebCMSEntities();
+            ConsumerProfit editData = db.ConsumerProfit.FirstOrDefault(m => m.Id == Id) ?? new ConsumerProfit();
+            db.Dispose();
+            return editData;
+        }
+
+        /// <summary>
+        /// 添加数据
+        /// </summary>
+        /// <param name="Fields">要设置的字段</param>
+        /// <returns></returns>
+        public int Add(Dictionary<string, object> Fields)
+        {
+            return new DbService(AppConfig.Base.mainTables, _conn).Add("ConsumerProfit", Fields, 0);
+        }
+
+        /// <summary>
+        /// 修改数据
+        /// </summary>
+        /// <param name="Fields">要设置的字段</param>
+        /// <param name="Id">主键Id</param>
+        public void Edit(Dictionary<string, object> Fields, int Id)
+        {
+            new DbService(AppConfig.Base.mainTables, _conn).Edit("ConsumerProfit", Fields, Id);
+        }
+
+        /// <summary>
+        /// 删除数据
+        /// </summary>
+        /// <param name="Id">主键Id</param>
+        public void Delete(int Id)
+        {
+            new DbService(AppConfig.Base.mainTables, _conn).Delete("ConsumerProfit", Id);
+        }
+
+        /// <summary>
+        /// 排序
+        /// </summary>
+        /// <param name="Id">主键Id</param>
+        /// <param name="Sort">排序序号</param>
+        public void Sort(int Id, int Sort)
+        {
+            new DbService(AppConfig.Base.mainTables, _conn).Sort("ConsumerProfit", Sort, Id);
+        }
+
+        /// <summary>
+        /// 导入数据
+        /// </summary>
+        /// <param name="ExcelData">json数据</param>
+        public void Import(string ExcelData)
+        {
+            WebCMSEntities db = new WebCMSEntities();
+            JsonData list = JsonMapper.ToObject(ExcelData);
+            for (int i = 1; i < list.Count;i++ )
+            {
+                JsonData dr = list[i];
+                
+                db.ConsumerProfit.Add(new ConsumerProfit()
+                {
+                    CreateDate = DateTime.Now,
+                    UpdateDate = DateTime.Now,
+                    
+                });
+                db.SaveChanges();
+            }
+            db.Dispose();
+        }
+
+        /// <summary>
+        /// 导出excel表格
+        /// </summary>
+        /// <param name="fields">查询条件(单个字段)</param>
+        /// <param name="condition">查询条件(sql语句)</param>
+        /// <returns></returns>
+        public Dictionary<string, object> ExportExcel(List<FieldItem> fields, string condition)
+        {
+            Dictionary<string, object> obj = new DbService(AppConfig.Base.mainTables, _conn).IndexData("ConsumerProfit", fields, "Id desc", "0", 1, 20000, condition, "Id", false);
+            List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
+            foreach (Dictionary<string, object> dic in diclist)
+            {
+            }
+
+            Dictionary<string, object> result = new Dictionary<string, object>();
+            result.Add("Status", "1");
+            result.Add("Info", "Excel报表-" + DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss") + ".xlsx");
+            result.Add("Obj", diclist);
+            Dictionary<string, object> ReturnFields = new Dictionary<string, object>();
+
+            result.Add("Fields", ReturnFields);
+            return result;
+        }
+    }
+}

+ 132 - 0
Services/IndexIconListService.cs

@@ -0,0 +1,132 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using MySystem.MainModels;
+using Library;
+using LitJson;
+
+namespace MySystem
+{
+    public class IndexIconListService
+    {
+        string _conn = "";
+        public IndexIconListService()
+        {
+            _conn = ConfigurationManager.AppSettings["SqlConnStr"].ToString();
+        }
+
+        /// <summary>
+        /// 查询列表
+        /// </summary>
+        /// <param name="fields">查询条件(单个字段)</param>
+        /// <param name="condition">查询条件(sql语句)</param>
+        /// <param name="page">页码</param>
+        /// <param name="limit">每页条数</param>
+        /// <returns></returns>
+        public List<IndexIconList> List(List<FieldItem> fields, string condition, int page = 1, int limit = 30)
+        {
+            Dictionary<string, object> obj = new DbService(AppConfig.Base.mainTables, _conn).IndexData("IndexIconList", fields, "Id desc", "0", page, limit, condition);
+            List<IndexIconList> diclist = obj["data"] as List<IndexIconList>;
+            return diclist;
+        }
+
+        /// <summary>
+        /// 查询一条记录
+        /// </summary>
+        /// <param name="Id">主键Id</param>
+        /// <returns></returns>
+        public IndexIconList Query(int Id)
+        {
+            WebCMSEntities db = new WebCMSEntities();
+            IndexIconList editData = db.IndexIconList.FirstOrDefault(m => m.Id == Id) ?? new IndexIconList();
+            db.Dispose();
+            return editData;
+        }
+
+        /// <summary>
+        /// 添加数据
+        /// </summary>
+        /// <param name="Fields">要设置的字段</param>
+        /// <returns></returns>
+        public int Add(Dictionary<string, object> Fields)
+        {
+            return new DbService(AppConfig.Base.mainTables, _conn).Add("IndexIconList", Fields, 0);
+        }
+
+        /// <summary>
+        /// 修改数据
+        /// </summary>
+        /// <param name="Fields">要设置的字段</param>
+        /// <param name="Id">主键Id</param>
+        public void Edit(Dictionary<string, object> Fields, int Id)
+        {
+            new DbService(AppConfig.Base.mainTables, _conn).Edit("IndexIconList", Fields, Id);
+        }
+
+        /// <summary>
+        /// 删除数据
+        /// </summary>
+        /// <param name="Id">主键Id</param>
+        public void Delete(int Id)
+        {
+            new DbService(AppConfig.Base.mainTables, _conn).Delete("IndexIconList", Id);
+        }
+
+        /// <summary>
+        /// 排序
+        /// </summary>
+        /// <param name="Id">主键Id</param>
+        /// <param name="Sort">排序序号</param>
+        public void Sort(int Id, int Sort)
+        {
+            new DbService(AppConfig.Base.mainTables, _conn).Sort("IndexIconList", Sort, Id);
+        }
+
+        /// <summary>
+        /// 导入数据
+        /// </summary>
+        /// <param name="ExcelData">json数据</param>
+        public void Import(string ExcelData)
+        {
+            WebCMSEntities db = new WebCMSEntities();
+            JsonData list = JsonMapper.ToObject(ExcelData);
+            for (int i = 1; i < list.Count;i++ )
+            {
+                JsonData dr = list[i];
+                
+                db.IndexIconList.Add(new IndexIconList()
+                {
+                    CreateDate = DateTime.Now,
+                    UpdateDate = DateTime.Now,
+                    
+                });
+                db.SaveChanges();
+            }
+            db.Dispose();
+        }
+
+        /// <summary>
+        /// 导出excel表格
+        /// </summary>
+        /// <param name="fields">查询条件(单个字段)</param>
+        /// <param name="condition">查询条件(sql语句)</param>
+        /// <returns></returns>
+        public Dictionary<string, object> ExportExcel(List<FieldItem> fields, string condition)
+        {
+            Dictionary<string, object> obj = new DbService(AppConfig.Base.mainTables, _conn).IndexData("IndexIconList", fields, "Id desc", "0", 1, 20000, condition, "Id", false);
+            List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
+            foreach (Dictionary<string, object> dic in diclist)
+            {
+            }
+
+            Dictionary<string, object> result = new Dictionary<string, object>();
+            result.Add("Status", "1");
+            result.Add("Info", "Excel报表-" + DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss") + ".xlsx");
+            result.Add("Obj", diclist);
+            Dictionary<string, object> ReturnFields = new Dictionary<string, object>();
+
+            result.Add("Fields", ReturnFields);
+            return result;
+        }
+    }
+}

+ 129 - 0
Services/MerchantForMobileService.cs

@@ -0,0 +1,129 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using MySystem.MainModels;
+using Library;
+using LitJson;
+
+namespace MySystem
+{
+    public class MerchantForMobileService
+    {
+        string _conn = "";
+        public MerchantForMobileService()
+        {
+            _conn = ConfigurationManager.AppSettings["SqlConnStr"].ToString();
+        }
+
+        /// <summary>
+        /// 查询列表
+        /// </summary>
+        /// <param name="fields">查询条件(单个字段)</param>
+        /// <param name="condition">查询条件(sql语句)</param>
+        /// <param name="page">页码</param>
+        /// <param name="limit">每页条数</param>
+        /// <returns></returns>
+        public List<MerchantForMobile> List(List<FieldItem> fields, string condition, int page = 1, int limit = 30)
+        {
+            Dictionary<string, object> obj = new DbService(AppConfig.Base.mainTables, _conn).IndexData("MerchantForMobile", fields, "Id desc", "0", page, limit, condition);
+            List<MerchantForMobile> diclist = obj["data"] as List<MerchantForMobile>;
+            return diclist;
+        }
+
+        /// <summary>
+        /// 查询一条记录
+        /// </summary>
+        /// <param name="Id">主键Id</param>
+        /// <returns></returns>
+        public MerchantForMobile Query(string Mobile)
+        {
+            WebCMSEntities db = new WebCMSEntities();
+            MerchantForMobile editData = db.MerchantForMobile.FirstOrDefault(m => m.Mobile == Mobile) ?? new MerchantForMobile();
+            db.Dispose();
+            return editData;
+        }
+
+        /// <summary>
+        /// 添加数据
+        /// </summary>
+        /// <param name="Fields">要设置的字段</param>
+        /// <returns></returns>
+        public int Add(Dictionary<string, object> Fields)
+        {
+            return new DbService(AppConfig.Base.mainTables, _conn).Add("MerchantForMobile", Fields, 0);
+        }
+
+        /// <summary>
+        /// 修改数据
+        /// </summary>
+        /// <param name="Fields">要设置的字段</param>
+        /// <param name="Id">主键Id</param>
+        public void Edit(Dictionary<string, object> Fields, int Id)
+        {
+            new DbService(AppConfig.Base.mainTables, _conn).Edit("MerchantForMobile", Fields, Id);
+        }
+
+        /// <summary>
+        /// 删除数据
+        /// </summary>
+        /// <param name="Id">主键Id</param>
+        public void Delete(int Id)
+        {
+            new DbService(AppConfig.Base.mainTables, _conn).Delete("MerchantForMobile", Id);
+        }
+
+        /// <summary>
+        /// 排序
+        /// </summary>
+        /// <param name="Id">主键Id</param>
+        /// <param name="Sort">排序序号</param>
+        public void Sort(int Id, int Sort)
+        {
+            new DbService(AppConfig.Base.mainTables, _conn).Sort("MerchantForMobile", Sort, Id);
+        }
+
+        /// <summary>
+        /// 导入数据
+        /// </summary>
+        /// <param name="ExcelData">json数据</param>
+        public void Import(string ExcelData)
+        {
+            WebCMSEntities db = new WebCMSEntities();
+            JsonData list = JsonMapper.ToObject(ExcelData);
+            for (int i = 1; i < list.Count;i++ )
+            {
+                JsonData dr = list[i];
+                
+                db.MerchantForMobile.Add(new MerchantForMobile()
+                {                    
+                });
+                db.SaveChanges();
+            }
+            db.Dispose();
+        }
+
+        /// <summary>
+        /// 导出excel表格
+        /// </summary>
+        /// <param name="fields">查询条件(单个字段)</param>
+        /// <param name="condition">查询条件(sql语句)</param>
+        /// <returns></returns>
+        public Dictionary<string, object> ExportExcel(List<FieldItem> fields, string condition)
+        {
+            Dictionary<string, object> obj = new DbService(AppConfig.Base.mainTables, _conn).IndexData("MerchantForMobile", fields, "Id desc", "0", 1, 20000, condition, "Id", false);
+            List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
+            foreach (Dictionary<string, object> dic in diclist)
+            {
+            }
+
+            Dictionary<string, object> result = new Dictionary<string, object>();
+            result.Add("Status", "1");
+            result.Add("Info", "Excel报表-" + DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss") + ".xlsx");
+            result.Add("Obj", diclist);
+            Dictionary<string, object> ReturnFields = new Dictionary<string, object>();
+
+            result.Add("Fields", ReturnFields);
+            return result;
+        }
+    }
+}

+ 137 - 0
Services/MerchantQrCodeService.cs

@@ -0,0 +1,137 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using MySystem.MainModels;
+using Library;
+using LitJson;
+
+namespace MySystem
+{
+    public class MerchantQrCodeService
+    {
+        string _conn = "";
+        public MerchantQrCodeService()
+        {
+            _conn = ConfigurationManager.AppSettings["SqlConnStr"].ToString();
+        }
+
+        /// <summary>
+        /// 查询列表
+        /// </summary>
+        /// <param name="fields">查询条件(单个字段)</param>
+        /// <param name="condition">查询条件(sql语句)</param>
+        /// <param name="page">页码</param>
+        /// <param name="limit">每页条数</param>
+        /// <returns></returns>
+        public List<MerchantQrCode> List(List<FieldItem> fields, string condition, int page = 1, int limit = 30)
+        {
+            Dictionary<string, object> obj = new DbService(AppConfig.Base.mainTables, _conn).IndexData("MerchantQrCode", fields, "Id desc", "0", page, limit, condition);
+            List<MerchantQrCode> diclist = obj["data"] as List<MerchantQrCode>;
+            return diclist;
+        }
+
+        /// <summary>
+        /// 查询一条记录
+        /// </summary>
+        /// <param name="Id">主键Id</param>
+        /// <returns></returns>
+        public MerchantQrCode Query(string SnNo)
+        {
+            WebCMSEntities db = new WebCMSEntities();
+            MerchantQrCode editData = db.MerchantQrCode.FirstOrDefault(m => m.SnNo == SnNo) ?? new MerchantQrCode();
+            db.Dispose();
+            return editData;
+        }
+
+        public MerchantQrCode Query(int Id)
+        {
+            WebCMSEntities db = new WebCMSEntities();
+            MerchantQrCode editData = db.MerchantQrCode.FirstOrDefault(m => m.Id == Id) ?? new MerchantQrCode();
+            db.Dispose();
+            return editData;
+        }
+
+        /// <summary>
+        /// 添加数据
+        /// </summary>
+        /// <param name="Fields">要设置的字段</param>
+        /// <returns></returns>
+        public int Add(Dictionary<string, object> Fields)
+        {
+            return new DbService(AppConfig.Base.mainTables, _conn).Add("MerchantQrCode", Fields, 0);
+        }
+
+        /// <summary>
+        /// 修改数据
+        /// </summary>
+        /// <param name="Fields">要设置的字段</param>
+        /// <param name="Id">主键Id</param>
+        public void Edit(Dictionary<string, object> Fields, int Id)
+        {
+            new DbService(AppConfig.Base.mainTables, _conn).Edit("MerchantQrCode", Fields, Id);
+        }
+
+        /// <summary>
+        /// 删除数据
+        /// </summary>
+        /// <param name="Id">主键Id</param>
+        public void Delete(int Id)
+        {
+            new DbService(AppConfig.Base.mainTables, _conn).Delete("MerchantQrCode", Id);
+        }
+
+        /// <summary>
+        /// 排序
+        /// </summary>
+        /// <param name="Id">主键Id</param>
+        /// <param name="Sort">排序序号</param>
+        public void Sort(int Id, int Sort)
+        {
+            new DbService(AppConfig.Base.mainTables, _conn).Sort("MerchantQrCode", Sort, Id);
+        }
+
+        /// <summary>
+        /// 导入数据
+        /// </summary>
+        /// <param name="ExcelData">json数据</param>
+        public void Import(string ExcelData)
+        {
+            WebCMSEntities db = new WebCMSEntities();
+            JsonData list = JsonMapper.ToObject(ExcelData);
+            for (int i = 1; i < list.Count;i++ )
+            {
+                JsonData dr = list[i];
+                
+                db.MerchantQrCode.Add(new MerchantQrCode()
+                {                    
+                });
+                db.SaveChanges();
+            }
+            db.Dispose();
+        }
+
+        /// <summary>
+        /// 导出excel表格
+        /// </summary>
+        /// <param name="fields">查询条件(单个字段)</param>
+        /// <param name="condition">查询条件(sql语句)</param>
+        /// <returns></returns>
+        public Dictionary<string, object> ExportExcel(List<FieldItem> fields, string condition)
+        {
+            Dictionary<string, object> obj = new DbService(AppConfig.Base.mainTables, _conn).IndexData("MerchantQrCode", fields, "Id desc", "0", 1, 20000, condition, "Id", false);
+            List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
+            foreach (Dictionary<string, object> dic in diclist)
+            {
+            }
+
+            Dictionary<string, object> result = new Dictionary<string, object>();
+            result.Add("Status", "1");
+            result.Add("Info", "Excel报表-" + DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss") + ".xlsx");
+            result.Add("Obj", diclist);
+            Dictionary<string, object> ReturnFields = new Dictionary<string, object>();
+
+            result.Add("Fields", ReturnFields);
+            return result;
+        }
+    }
+}

+ 132 - 0
Services/PageInfoService.cs

@@ -0,0 +1,132 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using MySystem.Models;
+using Library;
+using LitJson;
+
+namespace MySystem
+{
+    public class PageInfoService
+    {
+        string _conn = "";
+        public PageInfoService()
+        {
+            _conn = ConfigurationManager.AppSettings["BsSqlConnStr"].ToString();
+        }
+
+        /// <summary>
+        /// 查询列表
+        /// </summary>
+        /// <param name="fields">查询条件(单个字段)</param>
+        /// <param name="condition">查询条件(sql语句)</param>
+        /// <param name="page">页码</param>
+        /// <param name="limit">每页条数</param>
+        /// <returns></returns>
+        public List<PageInfo> List(List<FieldItem> fields, string condition, int page = 1, int limit = 30)
+        {
+            Dictionary<string, object> obj = new DbService(AppConfig.Base.bsTables, _conn).IndexData("PageInfo", fields, "Id desc", "0", page, limit, condition);
+            List<PageInfo> diclist = obj["data"] as List<PageInfo>;
+            return diclist;
+        }
+
+        /// <summary>
+        /// 查询一条记录
+        /// </summary>
+        /// <param name="Id">主键Id</param>
+        /// <returns></returns>
+        public PageInfo Query(int Id)
+        {
+            WebCMSEntities db = new WebCMSEntities();
+            PageInfo editData = db.PageInfo.FirstOrDefault(m => m.Id == Id) ?? new PageInfo();
+            db.Dispose();
+            return editData;
+        }
+
+        /// <summary>
+        /// 添加数据
+        /// </summary>
+        /// <param name="Fields">要设置的字段</param>
+        /// <returns></returns>
+        public int Add(Dictionary<string, object> Fields)
+        {
+            return new DbService(AppConfig.Base.bsTables, _conn).Add("PageInfo", Fields, 0);
+        }
+
+        /// <summary>
+        /// 修改数据
+        /// </summary>
+        /// <param name="Fields">要设置的字段</param>
+        /// <param name="Id">主键Id</param>
+        public void Edit(Dictionary<string, object> Fields, int Id)
+        {
+            new DbService(AppConfig.Base.bsTables, _conn).Edit("PageInfo", Fields, Id);
+        }
+
+        /// <summary>
+        /// 删除数据
+        /// </summary>
+        /// <param name="Id">主键Id</param>
+        public void Delete(int Id)
+        {
+            new DbService(AppConfig.Base.bsTables, _conn).Delete("PageInfo", Id);
+        }
+
+        /// <summary>
+        /// 排序
+        /// </summary>
+        /// <param name="Id">主键Id</param>
+        /// <param name="Sort">排序序号</param>
+        public void Sort(int Id, int Sort)
+        {
+            new DbService(AppConfig.Base.bsTables, _conn).Sort("PageInfo", Sort, Id);
+        }
+
+        /// <summary>
+        /// 导入数据
+        /// </summary>
+        /// <param name="ExcelData">json数据</param>
+        public void Import(string ExcelData)
+        {
+            WebCMSEntities db = new WebCMSEntities();
+            JsonData list = JsonMapper.ToObject(ExcelData);
+            for (int i = 1; i < list.Count;i++ )
+            {
+                JsonData dr = list[i];
+                
+                db.PageInfo.Add(new PageInfo()
+                {
+                    CreateDate = DateTime.Now,
+                    UpdateDate = DateTime.Now,
+                    
+                });
+                db.SaveChanges();
+            }
+            db.Dispose();
+        }
+
+        /// <summary>
+        /// 导出excel表格
+        /// </summary>
+        /// <param name="fields">查询条件(单个字段)</param>
+        /// <param name="condition">查询条件(sql语句)</param>
+        /// <returns></returns>
+        public Dictionary<string, object> ExportExcel(List<FieldItem> fields, string condition)
+        {
+            Dictionary<string, object> obj = new DbService(AppConfig.Base.bsTables, _conn).IndexData("PageInfo", fields, "Id desc", "0", 1, 20000, condition, "Id", false);
+            List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
+            foreach (Dictionary<string, object> dic in diclist)
+            {
+            }
+
+            Dictionary<string, object> result = new Dictionary<string, object>();
+            result.Add("Status", "1");
+            result.Add("Info", "Excel报表-" + DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss") + ".xlsx");
+            result.Add("Obj", diclist);
+            Dictionary<string, object> ReturnFields = new Dictionary<string, object>();
+
+            result.Add("Fields", ReturnFields);
+            return result;
+        }
+    }
+}

+ 132 - 0
Services/PosMachinesService.cs

@@ -0,0 +1,132 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using MySystem.MainModels;
+using Library;
+using LitJson;
+
+namespace MySystem
+{
+    public class PosMachinesService
+    {
+        string _conn = "";
+        public PosMachinesService()
+        {
+            _conn = ConfigurationManager.AppSettings["SqlConnStr"].ToString();
+        }
+
+        /// <summary>
+        /// 查询列表
+        /// </summary>
+        /// <param name="fields">查询条件(单个字段)</param>
+        /// <param name="condition">查询条件(sql语句)</param>
+        /// <param name="page">页码</param>
+        /// <param name="limit">每页条数</param>
+        /// <returns></returns>
+        public List<PosMachines> List(List<FieldItem> fields, string condition, int page = 1, int limit = 30)
+        {
+            Dictionary<string, object> obj = new DbService(AppConfig.Base.mainTables, _conn).IndexData("PosMachines", fields, "Id desc", "0", page, limit, condition);
+            List<PosMachines> diclist = obj["data"] as List<PosMachines>;
+            return diclist;
+        }
+
+        /// <summary>
+        /// 查询一条记录
+        /// </summary>
+        /// <param name="Id">主键Id</param>
+        /// <returns></returns>
+        public PosMachines Query(int Id)
+        {
+            WebCMSEntities db = new WebCMSEntities();
+            PosMachines editData = db.PosMachines.FirstOrDefault(m => m.Id == Id) ?? new PosMachines();
+            db.Dispose();
+            return editData;
+        }
+
+        /// <summary>
+        /// 添加数据
+        /// </summary>
+        /// <param name="Fields">要设置的字段</param>
+        /// <returns></returns>
+        public int Add(Dictionary<string, object> Fields)
+        {
+            return new DbService(AppConfig.Base.mainTables, _conn).Add("PosMachines", Fields, 0);
+        }
+
+        /// <summary>
+        /// 修改数据
+        /// </summary>
+        /// <param name="Fields">要设置的字段</param>
+        /// <param name="Id">主键Id</param>
+        public void Edit(Dictionary<string, object> Fields, int Id)
+        {
+            new DbService(AppConfig.Base.mainTables, _conn).Edit("PosMachines", Fields, Id);
+        }
+
+        /// <summary>
+        /// 删除数据
+        /// </summary>
+        /// <param name="Id">主键Id</param>
+        public void Delete(int Id)
+        {
+            new DbService(AppConfig.Base.mainTables, _conn).Delete("PosMachines", Id);
+        }
+
+        /// <summary>
+        /// 排序
+        /// </summary>
+        /// <param name="Id">主键Id</param>
+        /// <param name="Sort">排序序号</param>
+        public void Sort(int Id, int Sort)
+        {
+            new DbService(AppConfig.Base.mainTables, _conn).Sort("PosMachines", Sort, Id);
+        }
+
+        /// <summary>
+        /// 导入数据
+        /// </summary>
+        /// <param name="ExcelData">json数据</param>
+        public void Import(string ExcelData)
+        {
+            WebCMSEntities db = new WebCMSEntities();
+            JsonData list = JsonMapper.ToObject(ExcelData);
+            for (int i = 1; i < list.Count;i++ )
+            {
+                JsonData dr = list[i];
+                
+                db.PosMachines.Add(new PosMachines()
+                {
+                    CreateDate = DateTime.Now,
+                    UpdateDate = DateTime.Now,
+                    
+                });
+                db.SaveChanges();
+            }
+            db.Dispose();
+        }
+
+        /// <summary>
+        /// 导出excel表格
+        /// </summary>
+        /// <param name="fields">查询条件(单个字段)</param>
+        /// <param name="condition">查询条件(sql语句)</param>
+        /// <returns></returns>
+        public Dictionary<string, object> ExportExcel(List<FieldItem> fields, string condition)
+        {
+            Dictionary<string, object> obj = new DbService(AppConfig.Base.mainTables, _conn).IndexData("PosMachines", fields, "Id desc", "0", 1, 20000, condition, "Id", false);
+            List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
+            foreach (Dictionary<string, object> dic in diclist)
+            {
+            }
+
+            Dictionary<string, object> result = new Dictionary<string, object>();
+            result.Add("Status", "1");
+            result.Add("Info", "Excel报表-" + DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss") + ".xlsx");
+            result.Add("Obj", diclist);
+            Dictionary<string, object> ReturnFields = new Dictionary<string, object>();
+
+            result.Add("Fields", ReturnFields);
+            return result;
+        }
+    }
+}