浏览代码

添加商户激活状态

DuGuYang 2 年之前
父节点
当前提交
42f43506b5

+ 1 - 1
Areas/Api/Controllers/BaseController.cs

@@ -22,7 +22,7 @@ namespace MySystem.Areas.Api.Controllers
         {
             _accessor = accessor;
         }
-        public Models.Main1.WebCMSEntities bsdb = new Models.Main1.WebCMSEntities();
+        public Models.Bs.WebCMSEntities bsdb = new Models.Bs.WebCMSEntities();
         public Models.Main1.WebCMSEntities main1db = new Models.Main1.WebCMSEntities();
         public Models.Main2.WebCMSEntities main2db = new Models.Main2.WebCMSEntities();
 

+ 3 - 3
Areas/Api/Controllers/PublicMethodController.cs

@@ -30,7 +30,7 @@ namespace MySystem.Areas.Api.Controllers
             return File(stream.ToArray(), "image/gif");
         }
         #endregion
-        
+
         #region 图片验证码
         public FileContentResult PictureCode(string Tag = "")
         {
@@ -216,7 +216,7 @@ namespace MySystem.Areas.Api.Controllers
         public JsonResult LayUIUpload([FromForm] IFormCollection rf, string Path = "", string Resize = "")
         {
             IFormFile imgFile = rf.Files[0];
-            string Icon = MySystemLib.SystemPublicFuction.GetFilePath(imgFile, Path + "/" + DateTime.Now.Year + "/" + DateTime.Now.Month + "/" + DateTime.Now.Day + "/",false);
+            string Icon = MySystemLib.SystemPublicFuction.GetFilePath(imgFile, Path + "/" + DateTime.Now.Year + "/" + DateTime.Now.Month + "/" + DateTime.Now.Day + "/", false);
             string piccut = "";
             if (!string.IsNullOrEmpty(Resize) && (imgFile.FileName.ToLower().EndsWith(".png") || imgFile.FileName.EndsWith(".jpg")))
             {
@@ -229,7 +229,7 @@ namespace MySystem.Areas.Api.Controllers
                 System.IO.File.Delete(function.getPath(Icon));
             }
             else
-            { 
+            {
                 piccut = Icon;
             }
             return Json(new AppResultJson() { Status = "1", Info = "", Data = piccut });

+ 9 - 1
Areas/Api/Controllers/v1/Main1/MerchantAddInfoController.cs

@@ -204,6 +204,7 @@ namespace MySystem.Areas.Api.Controllers.v1.Main1
             string AliPID = data["AliPID"].ToString(); //支付宝PID
             string WeChatNo = data["WeChatNo"].ToString(); //微信商户号
             string SubjectType = data["SubjectType"].ToString(); //主体类型(1 企业 2 个体)
+            string IsAct = data["IsAct"].ToString(); //激活状态(0 未激活 1 已激活)
             int pageSize = int.Parse(function.CheckInt(data["page_size"].ToString()));
             int pageNum = int.Parse(function.CheckInt(data["page_num"].ToString()));
             string condition = "";
@@ -236,6 +237,11 @@ namespace MySystem.Areas.Api.Controllers.v1.Main1
                 if (SubjectType == "2") SubjectType = "SUBJECT_TYPE_INDIVIDUAL"; //个体工商户
                 condition += " and SubjectType='" + SubjectType + "'";
             }
+            if (!string.IsNullOrEmpty(IsAct))
+            {
+                var Ids = MerchantInfoUtil.QueryIsActMerchantId(int.Parse(IsAct));
+                condition += " and Id in (" + Ids + ")";
+            }
             List<RelationData> relationData = new List<RelationData>();
             List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
             Other = new Dictionary<string, object>();
@@ -246,8 +252,10 @@ namespace MySystem.Areas.Api.Controllers.v1.Main1
                 Dictionary<string, object> curData = new Dictionary<string, object>();
                 //商户Id
                 var MerchantId = int.Parse(subdata["Id"].ToString());
-                var userInfo = UsersService.Query(MerchantInfoService.Query(MerchantId).UserId);
+                var merInfo = MerchantInfoService.Query(MerchantId);
+                var userInfo = UsersService.Query(merInfo.UserId);
                 curData.Add("MerchantId", subdata["Id"].ToString()); //商户Id
+                curData.Add("IsAct", merInfo.IsAct); //激活状态(0 未激活 1 已激活)
                 curData.Add("MerchantName", subdata["CertMerchantName"].ToString()); //商户名称
                 curData.Add("Mobile", subdata["MobilePhone"].ToString()); //手机号码
                 curData.Add("MakerCode", userInfo.MakerCode); //所属创客

+ 9 - 1
Areas/Api/Controllers/v1/Main2/MerchantAddInfoController.cs

@@ -224,6 +224,7 @@ namespace MySystem.Areas.Api.Controllers.v1.Main2
             string MakerCode = data["MakerCode"].ToString(); //所属创客
             string MatchNo = data["MatchNo"].ToString(); //商户号
             string SubjectType = data["SubjectType"].ToString(); //主体类型(1 企业 2 个体 3 小微)
+            string IsAct = data["IsAct"].ToString(); //激活状态(0 未激活 1 已激活)
             int pageSize = int.Parse(function.CheckInt(data["page_size"].ToString()));
             int pageNum = int.Parse(function.CheckInt(data["page_num"].ToString()));
             string condition = "";
@@ -253,6 +254,11 @@ namespace MySystem.Areas.Api.Controllers.v1.Main2
                 if (SubjectType == "3") SubjectType = "SUBJECT_TYPE_SMALL"; //小微
                 condition += " and SubjectType='" + SubjectType + "'";
             }
+            if (!string.IsNullOrEmpty(IsAct))
+            {
+                var Ids = MerchantInfoUtil.QueryIsActMerchantId(int.Parse(IsAct));
+                condition += " and Id in (" + Ids + ")";
+            }
             List<RelationData> relationData = new List<RelationData>();
             List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
             Other = new Dictionary<string, object>();
@@ -263,8 +269,10 @@ namespace MySystem.Areas.Api.Controllers.v1.Main2
                 Dictionary<string, object> curData = new Dictionary<string, object>();
                 //商户Id
                 var MerchantId = int.Parse(subdata["Id"].ToString());
-                var userInfo = UsersService.Query(MerchantInfoService.Query(MerchantId).UserId);
+                var merInfo = MerchantInfoService.Query(MerchantId);
+                var userInfo = UsersService.Query(merInfo.UserId);
                 curData.Add("MerchantId", subdata["Id"].ToString()); //商户Id
+                curData.Add("IsAct", merInfo.IsAct); //激活状态(0 未激活 1 已激活)
                 curData.Add("MerchantName", subdata["CertMerchantName"].ToString()); //商户名称
                 curData.Add("Mobile", subdata["MobilePhone"].ToString()); //手机号码
                 curData.Add("MakerCode", userInfo.MakerCode); //所属创客

+ 99 - 1
Util/Base/BaseClass.cs

@@ -1,4 +1,8 @@
 
+using System.Collections.Generic;
+using System.Linq;
+using MySystem.Models.Bs;
+using System.Data;
 namespace MySystem
 {
     /// <summary>
@@ -6,6 +10,100 @@ namespace MySystem
     /// </summary>
     public class BaseClass
     {
-        
+
+        public Models.Bs.WebCMSEntities bsdb = new Models.Bs.WebCMSEntities();
+
+        #region 
+        public string GetRightJson()
+        {
+            string result = "[";
+            List<RightDic> list = bsdb.RightDic.ToList();
+            List<RightDic> Level1 = list.Where(m => m.RightLevel == 1).ToList();
+            foreach (RightDic sub1 in Level1)
+            {
+                result += "{title: '" + sub1.Name + "', id: '" + sub1.Id + "', spread: false, children: [";
+                List<RightDic> Level2 = list.Where(m => m.RightLevel == 2 && m.Id.StartsWith(sub1.Id)).ToList();
+                if (Level2.Count > 0)
+                {
+                    foreach (RightDic sub2 in Level2)
+                    {
+                        result += "{title: '" + sub2.Name + "', id: '" + sub2.Id + "', spread: false, children: [";
+                        List<RightDic> Level3 = list.Where(m => m.RightLevel == 3 && m.Id.StartsWith(sub2.Id)).ToList();
+                        if (Level3.Count > 0)
+                        {
+                            foreach (RightDic sub3 in Level3)
+                            {
+                                result += "{title: '" + sub3.Name + "', id: '" + sub3.Id + "', spread: false, children: [";
+                                string rightString = ForOperateRight(sub3.Id);
+                                if (!string.IsNullOrEmpty(rightString))
+                                {
+                                    result += rightString;
+                                }
+                                else
+                                {
+                                    result += "{title: '基本权限', id: '" + sub3.Id + "_base'}";
+                                }
+                                result += "]},";
+                            }
+                            result = result.TrimEnd(',');
+                        }
+                        else
+                        {
+                            string rightString = ForOperateRight(sub2.Id);
+                            if (!string.IsNullOrEmpty(rightString))
+                            {
+                                result += rightString;
+                            }
+                            else
+                            {
+                                result += "{title: '基本权限', id: '" + sub2.Id + "_base'}";
+                            }
+                        }
+                        result += "]},";
+                    }
+                    result = result.TrimEnd(',');
+                }
+                else
+                {
+                    result += ForOperateRight(sub1.Id);
+                    string rightString = ForOperateRight(sub1.Id);
+                    if (!string.IsNullOrEmpty(rightString))
+                    {
+                        result += rightString;
+                    }
+                    else
+                    {
+                        result += "{title: '基本权限', id: '" + sub1.Id + "_base'}";
+                    }
+                }
+                result += "]},";
+            }
+            result = result.TrimEnd(',');
+            result += "]";
+            return result;
+        }
+        //读取当前菜单有哪些权限
+        public string ForOperateRight(string Id)
+        {
+            string result = "";
+            List<MenuRight> rights = bsdb.MenuRight.Where(m => m.MenuId.StartsWith(Id)).OrderBy(m => m.MenuId).ToList();
+            foreach (MenuRight right in rights)
+            {
+                result += "{title: '" + right.Name + "', id: '" + right.MenuId + "'},";
+            }
+            RightDic rightDic = bsdb.RightDic.FirstOrDefault(m => m.Id == Id) ?? new RightDic();
+            if (!string.IsNullOrEmpty(rightDic.OtherRight))
+            {
+                string[] OtherRightList = rightDic.OtherRight.Split('\n');
+                foreach (string SubOtherRight in OtherRightList)
+                {
+                    string[] SubOtherRightData = SubOtherRight.Split('_');
+                    result += "{title: '" + SubOtherRightData[1] + "', id: '" + Id + "_" + SubOtherRightData[0] + "'},";
+                }
+            }
+            result = result.TrimEnd(',');
+            return result;
+        }
+        #endregion
     }
 }

+ 27 - 2
Util/Main1/MerchantInfoUtil.cs

@@ -50,7 +50,7 @@ namespace MySystem.Service.Main1
         {
             var info = "";
             List<RelationData> relationData = new List<RelationData>();
-            var merAddInfo = MerchantAddInfoService.List(relationData," and SubjectType='" + SubjectType + "'",1,999999);
+            var merAddInfo = MerchantAddInfoService.List(relationData, " and SubjectType='" + SubjectType + "'", 1, 999999);
             if (merAddInfo.Count > 0)
             {
                 var merIds = "";
@@ -74,7 +74,32 @@ namespace MySystem.Service.Main1
         {
             var info = "";
             List<RelationData> relationData = new List<RelationData>();
-            var merInfo = MerchantInfoService.List(relationData," and Sort=1",1,9999999);
+            var merInfo = MerchantInfoService.List(relationData, " and Sort=1", 1, 9999999);
+            if (merInfo.Count > 0)
+            {
+                var merIds = "";
+                foreach (Dictionary<string, object> dic in merInfo)
+                {
+                    var MerchantId = int.Parse(dic["Id"].ToString());
+                    merIds += MerchantId + ",";
+                }
+                info = merIds.TrimEnd(',');
+            }
+            return info;
+        }
+        #endregion
+
+        #region 获取是否激活商户Id
+        /// <summary>
+        /// 获取是否激活商户Id
+        /// </summary>
+        /// <param name="IsAct">激活状态(0 未激活 1 已激活)</param>
+        /// <returns></returns>
+        public static string QueryIsActMerchantId(int IsAct)
+        {
+            var info = "";
+            List<RelationData> relationData = new List<RelationData>();
+            var merInfo = MerchantInfoService.List(relationData, " and IsAct=" + IsAct + "", 1, 9999999);
             if (merInfo.Count > 0)
             {
                 var merIds = "";

+ 25 - 0
Util/Main2/MerchantInfoUtil.cs

@@ -88,6 +88,31 @@ namespace MySystem.Service.Main2
         }
         #endregion
 
+        #region 获取是否激活商户Id
+        /// <summary>
+        /// 获取是否激活商户Id
+        /// </summary>
+        /// <param name="IsAct">激活状态(0 未激活 1 已激活)</param>
+        /// <returns></returns>
+        public static string QueryIsActMerchantId(int IsAct)
+        {
+            var info = "";
+            List<RelationData> relationData = new List<RelationData>();
+            var merInfo = MerchantInfoService.List(relationData, " and IsAct=" + IsAct + "", 1, 9999999);
+            if (merInfo.Count > 0)
+            {
+                var merIds = "";
+                foreach (Dictionary<string, object> dic in merInfo)
+                {
+                    var MerchantId = int.Parse(dic["Id"].ToString());
+                    merIds += MerchantId + ",";
+                }
+                info = merIds.TrimEnd(',');
+            }
+            return info;
+        }
+        #endregion
+
         #region 主体类型
         /// <summary>
         /// 主体类型