|
@@ -506,6 +506,214 @@ namespace MySystem.Areas.Api.Controllers.v1
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
+ #region 首页-客小爽产品-机具管理-已绑定机具列表
|
|
|
+ // [Authorize]
|
|
|
+ public JsonResult MyMachinesForBind2(string value)
|
|
|
+ {
|
|
|
+ value = DesDecrypt(value);
|
|
|
+ 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 = main1db.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 = main1db.MerchantAddInfo.FirstOrDefault(m => m.Id == subdata.BindMerchantId) ?? new MerchantAddInfo();
|
|
|
+ curData.Add("BindedMerchant", merchant.CertMerchantName);
|
|
|
+ curData.Add("IsLeader", 0);
|
|
|
+ dataList.Add(curData);
|
|
|
+ }
|
|
|
+ return dataList;
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region 首页-客小爽产品-机具管理-总机具列表
|
|
|
+ // [Authorize]
|
|
|
+ public JsonResult MyMachines2(string value)
|
|
|
+ {
|
|
|
+ value = DesDecrypt(value);
|
|
|
+ JsonData data = JsonMapper.ToObject(value);
|
|
|
+ Dictionary<string, object> Other = new Dictionary<string, object>();
|
|
|
+ List<Dictionary<string, object>> dataList = MyMachines2Do(value, out Other);
|
|
|
+ return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList, Other = Other });
|
|
|
+ }
|
|
|
+ public List<Dictionary<string, object>> MyMachines2Do(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 = main1db.PosMachines.Where(m => m.Status > -1 && m.BuyUserId == UserId && m.BrandId == BrandId);
|
|
|
+ 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>();
|
|
|
+ int IsLeader = 0;//是否为大盟主机(0-否 1-是)
|
|
|
+ curData.Add("PosSn", subdata.PosSn); //SN编号
|
|
|
+ curData.Add("PosSnType", RelationClass.GetPosSnTypeInfo(subdata.PosSnType)); //机具类型
|
|
|
+ curData.Add("Id", subdata.Id); //Id
|
|
|
+ curData.Add("CreateDate", subdata.TransferTime == null ? "" : subdata.TransferTime.Value.ToString("yyyy-MM-dd HH:mm:ss")); //CreateDate
|
|
|
+ StoreHouse store = StoreHouseDbconn.Instance.Get(subdata.StoreId) ?? new StoreHouse();
|
|
|
+ curData.Add("FromStore", store.StoreName); //来自仓库
|
|
|
+ decimal Deposit = 299;
|
|
|
+ if (BrandId == 6)
|
|
|
+ {
|
|
|
+ Deposit = 249;
|
|
|
+ }
|
|
|
+ if (!string.IsNullOrEmpty(subdata.PrizeParams))
|
|
|
+ {
|
|
|
+ Deposit = decimal.Parse(function.CheckNum(subdata.PrizeParams));
|
|
|
+ }
|
|
|
+ curData.Add("Deposit", Deposit);
|
|
|
+ curData.Add("IsLeader", IsLeader);
|
|
|
+ dataList.Add(curData);
|
|
|
+ }
|
|
|
+ return dataList;
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region 首页-客小爽产品-机具管理-未绑定机具列表
|
|
|
+ // [Authorize]
|
|
|
+ public JsonResult MyMachinesForUnBind2(string value)
|
|
|
+ {
|
|
|
+ value = DesDecrypt(value);
|
|
|
+ JsonData data = JsonMapper.ToObject(value);
|
|
|
+ Dictionary<string, object> Other = new Dictionary<string, object>();
|
|
|
+ List<Dictionary<string, object>> dataList = MyMachinesForUnBind2Do(value, out Other);
|
|
|
+ return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList, Other = Other });
|
|
|
+ }
|
|
|
+ public List<Dictionary<string, object>> MyMachinesForUnBind2Do(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 = main1db.PosMachines.Where(m => m.Status > -1 && m.BuyUserId == UserId && m.BindingState == 0);
|
|
|
+ if (!string.IsNullOrEmpty(SnNo))
|
|
|
+ {
|
|
|
+ query = query.Where(m => m.PosSn == SnNo && m.PosSnType == 0);
|
|
|
+ }
|
|
|
+ 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>();
|
|
|
+ int IsLeader = 0;
|
|
|
+ curData.Add("PosSn", subdata.PosSn); //SN编号
|
|
|
+ curData.Add("PosSnType", RelationClass.GetPosSnTypeInfo(subdata.PosSnType)); //机具类型
|
|
|
+ curData.Add("Id", subdata.Id); //Id
|
|
|
+ if (subdata.RecycEndDate != null)
|
|
|
+ {
|
|
|
+ TimeSpan ts = subdata.RecycEndDate.Value - DateTime.Now;
|
|
|
+ curData.Add("ActDays", ts.TotalDays.ToString("f0")); //活动剩余天数
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ curData.Add("ActDays", 0); //活动剩余天数
|
|
|
+ }
|
|
|
+ curData.Add("CreateDate", subdata.CreateDate.Value.ToString("yyyy-MM-dd")); //机具初始日期
|
|
|
+ curData.Add("EndDate", subdata.RecycEndDate == null ? "" : subdata.RecycEndDate.Value.ToString("yyyy-MM-dd")); //截止日期
|
|
|
+ decimal Deposit = 299;
|
|
|
+ if (BrandId == 6)
|
|
|
+ {
|
|
|
+ Deposit = 249;
|
|
|
+ }
|
|
|
+ if (!string.IsNullOrEmpty(subdata.PrizeParams))
|
|
|
+ {
|
|
|
+ Deposit = decimal.Parse(function.CheckNum(subdata.PrizeParams));
|
|
|
+ }
|
|
|
+ curData.Add("Deposit", Deposit);
|
|
|
+ curData.Add("IsLeader", IsLeader);
|
|
|
+ dataList.Add(curData);
|
|
|
+ }
|
|
|
+ return dataList;
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
#region 检查签名是否合法,合法返回1,不合法返回提示信息
|