public MessageModel <List <TB_OPERATE> > getOperateByUser(string mflag) { MessageModel <List <TB_OPERATE> > result = new MessageModel <List <TB_OPERATE> >(); var token = HttpContext.Request.Headers["Authorization"].ToString().Replace("Bearer ", ""); var usermodel = userbll.GetUserByToken(token); if (usermodel == null) { result.data = null; result.code = System.Net.HttpStatusCode.OK; result.success = false; result.msg = "暂无数据"; return(result); } var modellist = new PowerMan().getOperateByUser(usermodel, mflag); if (modellist.Count > 0) { result.data = modellist; result.code = System.Net.HttpStatusCode.OK; result.success = true; result.msg = "获取成功"; } else { result.data = null; result.code = System.Net.HttpStatusCode.OK; result.success = false; result.msg = "暂无数据"; } return(result); }
public string UserGetList(int page, int limit, string loginName, string userName, string unitName) { TableModel <List <TB_USER> > result = new TableModel <List <TB_USER> >(); if (page <= 0 || limit <= 0) { result.Data = null; result.Code = System.Net.HttpStatusCode.OK; result.Success = false; result.Msg = "参数错误"; result.Count = 0; //return result; } var token = HttpContext.Request.Headers["Authorization"].ToString().Replace("Bearer ", ""); var usermodel = userbll.GetUserByToken(token); if (usermodel == null) { result.Data = null; result.Count = 0; result.Code = System.Net.HttpStatusCode.OK; result.Success = false; result.Msg = "暂无数据"; //return result; } bool power = PowerMan.GetUserPagePower(usermodel, "user"); if (!power) { result.Data = null; result.Code = System.Net.HttpStatusCode.OK; result.Success = false; result.Msg = "无权访问"; result.Count = 0; //return result; } ArrayList list = new ArrayList(); try { string strWhere = userbll.User_GetSqlWhere(loginName, userName, unitName); int total = 0; var userlist = userbll.Query(strWhere, page, limit, "sort", ref total); DataSet ds_rolelog = rolebll.User_Getrolelog(); if (userlist.Count > 0) { foreach (var item in userlist) { item.roleName = rolebll.User_GetRoleName(item.USERID.ToString()); bool bHaveLog = false; DataRow[] dr = ds_rolelog.Tables[0].Select("oid='" + item.USERID.ToString() + "'"); if (dr.Any()) { bHaveLog = true; } item.BHAVELOG = bHaveLog?"1":"0"; } result.Data = userlist; result.Count = userbll.GetTotal(strWhere); result.Code = System.Net.HttpStatusCode.OK; result.Success = true; result.Msg = "获取成功"; var r = Newtonsoft.Json.JsonConvert.SerializeObject(result); return(r); } else { result.Data = null; result.Count = 0; result.Code = System.Net.HttpStatusCode.OK; result.Success = false; result.Msg = "暂无数据"; //return result; } return(Newtonsoft.Json.JsonConvert.SerializeObject(result)); } catch (Exception ex) { throw ex; } }