예제 #1
0
        /// <summary>
        /// 获取列表
        /// </summary>
        /// <param name="infotype"></param>
        /// <param name="authId"></param>
        /// <returns></returns>
        public ActionResult GetTCRuleList(int infotype, string authId)
        {
            TCRuleBLL bll  = new TCRuleBLL();
            var       data = bll.GetList(infotype, authId);

            return(Json(data, JsonRequestBehavior.AllowGet));
        }
예제 #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 });
            }
        }