public string ModifyRole(string loginIdentifer, string roleJSONString) { JavaScriptObject obj2 = new JavaScriptObject(); obj2.Add("Result", false); obj2.Add("Message", ""); LoginUser loginUser = GlobalAppModule.GetLoginUser(loginIdentifer); if (loginUser == null) { obj2["Message"] = "未登录"; return(JavaScriptConvert.SerializeObject(obj2)); } if (loginUser.LoginTimeout) { obj2["Message"] = "登录超时"; return(JavaScriptConvert.SerializeObject(obj2)); } loginUser.LastOperateTime = DateTime.Now; try { JavaScriptObject obj3 = (JavaScriptObject)JavaScriptConvert.DeserializeObject(roleJSONString); if (obj3 == null) { obj2["Message"] = "参数格式错误"; return(JavaScriptConvert.SerializeObject(obj2)); } try { Role role = RoleModule.GetRole(long.Parse(obj3["ID"].ToString())); role.RoleName = obj3["角色名"].ToString(); role.IsAllow = 1; role.Weight = 1; long existsId = RoleModule.GetRoleId(role.RoleName); if (existsId > 0 && existsId != role.Id) { obj2["Message"] = "此角色已经存在!"; return(JavaScriptConvert.SerializeObject(obj2)); } string str = "修改失败"; if (RoleModule.ModifyRole(role)) { str = "修改成功"; obj2["Result"] = true; } obj2["Message"] = str; } catch (Exception exception) { obj2["Message"] = exception.Message; } } catch (Exception exception2) { obj2["Message"] = exception2.Message; } try { SysLog log = new SysLog(); log.LogUserId = loginUser.UserId; log.LogUserName = loginUser.LoginName; log.LogAddress = ToolsWeb.GetIP(context.Request); log.LogTime = DateTime.Now; log.LogType = "修改角色"; log.LogContent = obj2["Message"].ToString() + "|" + roleJSONString; SysLogModule.Add(log); } catch { } return(JavaScriptConvert.SerializeObject(obj2)); }