Пример #1
0
 public object GetAuthorizeInfo([FromBody] JObject json)
 {
     try
     {
         string  res        = json.Value <string>("json");
         dynamic dy         = JsonConvert.DeserializeObject <ExpandoObject>(res);
         string  registcode = dy.registcode;
         //获取用户基本信息
         MenuAuthorizeBLL           authorizeBLL = new MenuAuthorizeBLL();
         List <MenuAuthorizeEntity> data         = authorizeBLL.GetListByRegistCode(registcode);
         return(new { Code = 0, data.Count, Info = "获取数据成功", data });
     }
     catch (Exception ex)
     {
         return(new { Code = -1, Info = "获取数据失败", ex.Message });
     }
 }
Пример #2
0
        public object GetAuthorizeInfo([FromBody] JObject json)
        {
            try
            {
                string res = json.Value <string>("json");
                MenuConfigRequestModel dy = JsonConvert.DeserializeObject <MenuConfigRequestModel>(res);
                string registcode         = dy.registcode;
                string userId             = dy.userId;
                //获取用户基本信息
                MenuAuthorizeBLL           authorizeBLL = new MenuAuthorizeBLL();
                List <MenuAuthorizeEntity> data         = authorizeBLL.GetListByRegistCode(registcode);
                if (!string.IsNullOrWhiteSpace(userId))
                {
                    UserEntity          user         = new UserBLL().GetEntity(userId);
                    var                 userRoleIds  = user.RoleId.Split(',');
                    TCRuleBLL           tCRuleBLL    = new TCRuleBLL();
                    List <TCRuleEntity> ruleEntities = tCRuleBLL.GetList(data.Select(p => p.Id).ToList());
                    if (data != null && data.Count > 0)
                    {
                        data.ForEach(m =>
                        {
                            List <TCRuleEntity> ts = ruleEntities.Where(x => x.AuthorizCodeId == m.Id).ToList();
                            try
                            {
                                m.ThemeType = ts.FirstOrDefault(p => p.InfoType == 1 && userRoleIds.Any(x => p.RuleIds.Contains(x))) == null ? m.ThemeType : Convert.ToInt32(ts.FirstOrDefault(p => p.InfoType == 1 && userRoleIds.Any(x => p.RuleIds.Contains(x))).InfoValue);
                            }
                            catch (Exception)
                            {
                                m.ThemeType = m.ThemeType;
                            }
                            m.CulturalUrl = ts.FirstOrDefault(p => p.InfoType == 2 && userRoleIds.Any(x => p.RuleIds.Contains(x))) == null ? m.CulturalUrl : ts.FirstOrDefault(p => p.InfoType == 2 && userRoleIds.Any(x => p.RuleIds.Contains(x))).InfoValue;
                            m.IndexUrl    = ts.FirstOrDefault(p => p.InfoType == 3 && userRoleIds.Any(x => p.RuleIds.Contains(x))) == null ? m.IndexUrl : ts.FirstOrDefault(p => p.InfoType == 3 && userRoleIds.Any(x => p.RuleIds.Contains(x))).InfoValue;
                        });
                    }
                }

                return(new { Code = 0, data.Count, Info = "获取数据成功", data });
            }
            catch (Exception ex)
            {
                return(new { Code = -1, Info = "获取数据失败", ex.Message });
            }
        }