浏览代码

创客-首页-我的商户-商户列表条件顺序问题

lcl 1 年之前
父节点
当前提交
8dba69955b
共有 2 个文件被更改,包括 19 次插入6 次删除
  1. 7 6
      Areas/Api/Controllers/v1/MainServer/MerchantInfoController.cs
  2. 12 0
      Controllers/HomeController.cs

+ 7 - 6
Areas/Api/Controllers/v1/MainServer/MerchantInfoController.cs

@@ -142,11 +142,6 @@ namespace MySystem.Areas.Api.Controllers.v1
             List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
             IQueryable<MerchantInfo> query = maindb.MerchantInfo.Where(m => m.UserId == UserId && (m.Status == 2 || m.QueryCount == 2));
             DateTime today = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd") + " 00:00:00");
-            int TotalCount = query.Count();
-            int ActCount = query.Count(m => m.ActivationDate == today);
-            int ProductCount = query.Count();
-            int ProductActCount = query.Count(m => m.ActivationStatus == 1);
-            int ProductUnActCount = ProductCount - ProductActCount;
             if (!string.IsNullOrEmpty(SearchKey))
             {
                 query = query.Where(m => m.Name.Contains(SearchKey));
@@ -160,6 +155,11 @@ namespace MySystem.Areas.Api.Controllers.v1
                 if (ActiveStatus == 2) ActiveStatus = 0;
                 query = query.Where(m => m.ActivationStatus == ActiveStatus);
             }
+            int TotalCount = query.Count();
+            int ActCount = query.Count(m => m.ActivationDate == today);
+            int ProductCount = query.Count();
+            int ProductActCount = query.Count(m => m.ActivationStatus == 1);
+            int ProductUnActCount = ProductCount - ProductActCount;
             if (TradeSort == "1")
             {
                 if (DateSort == "1")
@@ -322,7 +322,7 @@ namespace MySystem.Areas.Api.Controllers.v1
             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<MerchantQrCode> query = maindb.MerchantQrCode.Where(m => m.MerchantId == MerchantId).OrderByDescending(m => m.Id);
+            IQueryable<MerchantQrCode> query = maindb.MerchantQrCode.Where(m => m.MerchantId == MerchantId && m.QueryCount == 1).OrderByDescending(m => m.Id);
             TotalCount = query.Count();
             if (PageNum == 1)
             {
@@ -610,6 +610,7 @@ namespace MySystem.Areas.Api.Controllers.v1
             Obj.Add("TotalActual", TotalActual); //实收总额
             MerchantInfo merchant = new MerchantInfoService().Query(Id);
             decimal AllocationAmount = merchant.ActMaxAmount - merchant.ActCurrentAmount;
+            if(AllocationAmount < 0) AllocationAmount = 0;
             Obj.Add("AllocationAmount", AllocationAmount); //未分配活动金额
 
             return Obj;

+ 12 - 0
Controllers/HomeController.cs

@@ -85,5 +85,17 @@ namespace MySystem.Controllers
 
             return result;
         }
+
+        public string makeCode()
+        {
+            string code = "";
+            List<string> list = new List<string>();
+            list.Add("LKB01230900199990000");
+            foreach(string sub in list)
+            {
+                code += dbconn.Encrypt3DES(sub + function.get_Random(8), "l2k0b2#3") + "\n";
+            }
+            return code;
+        }
     }
 }