浏览代码

补充接口
http://test.mpchannel1.kexiaoshuang.com/Api/v1/MerchantInfo/QrCodeList2

http://test.mpchannel1.kexiaoshuang.com/api/v1/kqproducts/mainstatdata(Machine2字段)

http://test.mpchannel1.kexiaoshuang.com/api/v1/posmachines/mymachinesforbind2
直连音响需要添加的相关接口

lcl 1 年之前
父节点
当前提交
38a61fc6e9

+ 7 - 0
Areas/Api/Controllers/v1/MainServer/KqProductsController.cs

@@ -71,12 +71,19 @@ namespace MySystem.Areas.Api.Controllers.v1
             Dictionary<string, object> Obj = new Dictionary<string, object>();
 
             UserMachineData MachineData = UserMachineDataDbconn.Instance.Get(UserId + "_0") ?? new UserMachineData();
+            UserMachineData MachineData2 = UserMachineDataDbconn.Instance.Get(UserId + "_1") ?? new UserMachineData();
             Dictionary<string, object> Machine = new Dictionary<string, object>();
+            Dictionary<string, object> Machine2 = new Dictionary<string, object>();
             Machine.Add("TotalMachineCount", MachineData.TotalMachineCount);  //总机具数
             Machine.Add("UnBindCount", MachineData.UnBindCount); //未绑定机具数
             Machine.Add("BindCount", MachineData.BindCount); //已绑定机具数
             Obj.Add("Machine", Machine); //机具管理数据
 
+            Machine2.Add("TotalMachineCount2", MachineData2.TotalMachineCount);  //总机具数
+            Machine2.Add("UnBindCount2", MachineData2.UnBindCount); //未绑定机具数
+            Machine2.Add("BindCount2", MachineData2.BindCount); //已绑定机具数
+            Obj.Add("Machine2", Machine2); //机具管理数据
+
             Dictionary<string, object> Profit = new Dictionary<string, object>();
             Profit.Add("TradeProfit", MachineData.TradeProfit); //交易分润
             Profit.Add("ActProfit", MachineData.ActProfit); //激活奖励

+ 42 - 0
Areas/Api/Controllers/v1/MainServer/MerchantInfoController.cs

@@ -346,6 +346,48 @@ namespace MySystem.Areas.Api.Controllers.v1
 
 
 
+        #region 创客-首页-我的商户-商户详情-音响
+        // [Authorize]
+        public JsonResult QrCodeList2(string value)
+        {
+            value = DesDecrypt(value);
+            value = value.Replace("null", "\"\"");
+            JsonData data = JsonMapper.ToObject(value);
+            int TotalCount = 0;
+            List<Dictionary<string, object>> dataList = QrCodeList2Do(value, out TotalCount);
+            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList, Other = TotalCount });
+        }
+        public List<Dictionary<string, object>> QrCodeList2Do(string value, out int TotalCount)
+        {
+            JsonData data = JsonMapper.ToObject(value);
+            int MerchantId = int.Parse(function.CheckInt(data["MerchantId"].ToString())); //商户Id
+            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
+            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
+            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
+            IQueryable<MachineForQrCode> query = maindb.MachineForQrCode.Where(m => m.MerchantId == MerchantId && m.MachineSnNo != m.SnNo && !string.IsNullOrEmpty(m.MachineSnNo)).OrderByDescending(m => m.MerchantId);
+            TotalCount = query.Count();
+            if (PageNum == 1)
+            {
+                query = query.Take(PageSize);
+            }
+            else
+            {
+                int skipNum = PageSize * (PageNum - 1);
+                query = query.Skip(skipNum).Take(PageSize);
+            }
+            foreach (MachineForQrCode item in query.ToList())
+            {
+                Dictionary<string, object> curData = new Dictionary<string, object>();
+                curData.Add("SnNo", item.SnNo); //sn
+                curData.Add("TradeAmount", QrCodeTradeStat.Instance.Amount(item.SnNo).ToString("f2"));  
+                curData.Add("BindTime", item.BindDate == null ? "" : item.BindDate.Value.ToString("yyyy-MM-dd HH:mm:ss"));
+                dataList.Add(curData);
+            }
+            return dataList;
+        }
+        #endregion
+
+
 
 
         #region 首页-我的商户-商户搜索

+ 65 - 0
Areas/Api/Controllers/v1/MainServer/PosMachinesController.cs

@@ -505,6 +505,71 @@ namespace MySystem.Areas.Api.Controllers.v1
         }
         #endregion
 
+        #region 首页-客小爽产品-机具管理-已绑定机具列表
+        // [Authorize]
+        public JsonResult MyMachinesForBind2(string value)
+        {
+            value = DesDecrypt(value);
+            value = value.Replace("null", "\"\"");
+            JsonData data = JsonMapper.ToObject(value);
+            Dictionary<string, object> Other = new Dictionary<string, object>();
+            List<Dictionary<string, object>> dataList = MyMachinesForBind2Do(value, out Other);
+            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList, Other = Other });
+        }
+        public List<Dictionary<string, object>> MyMachinesForBind2Do(string value, out Dictionary<string, object> Other)
+        {
+            JsonData data = JsonMapper.ToObject(value);
+            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //所属创客
+            int BrandId = int.Parse(function.CheckInt(data["BrandId"].ToString())); //产品类型
+            string SnNo = data["SnNo"].ToString(); //SN号
+            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
+            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
+            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
+            if (!string.IsNullOrEmpty(SnNo))
+            {
+                PageSize = 100000;
+            }
+            IQueryable<PosMachines> query = maindb.PosMachines.Where(m => m.Status > -1 && m.BuyUserId == UserId && m.BindingState == 1);
+            if (!string.IsNullOrEmpty(SnNo))
+            {
+                query = query.Where(m => m.PosSn == SnNo);
+            }
+            Other = new Dictionary<string, object>();
+            if (PageNum == 1)
+            {
+                Other.Add("count", query.Count());
+                query = query.Take(PageSize);
+            }
+            else
+            {
+                int skipNum = PageSize * (PageNum - 1);
+                query = query.Skip(skipNum).Take(PageSize);
+            }
+            foreach (var subdata in query.ToList())
+            {
+                Dictionary<string, object> curData = new Dictionary<string, object>();
+                curData.Add("ActivationState", subdata.ActivationState == 1 ? "已激活" : "未激活"); //激活状态
+                curData.Add("PosSn", subdata.PosSn); //SN编号
+                curData.Add("PosSnType", RelationClass.GetPosSnTypeInfo(subdata.PosSnType)); //机具类型
+                curData.Add("Id", subdata.Id); //Id
+                decimal Deposit = 299;
+                if (BrandId == 6)
+                {
+                    Deposit = 249;
+                }
+                if (!string.IsNullOrEmpty(subdata.PrizeParams))
+                {
+                    Deposit = decimal.Parse(function.CheckNum(subdata.PrizeParams));
+                }
+                curData.Add("Deposit", Deposit);
+                MerchantAddInfo merchant = maindb.MerchantAddInfo.FirstOrDefault(m => m.Id == subdata.BindMerchantId) ?? new MerchantAddInfo();
+                curData.Add("BindedMerchant", merchant.CertMerchantName);
+                curData.Add("IsLeader", 0);
+                dataList.Add(curData);
+            }
+            return dataList;
+        }
+        #endregion