using System; using System.Collections.Generic; using System.Configuration; using System.Net.Http; using Learun.Application.Base.SystemModule; using Learun.Cache.Base; using Learun.Cache.Factory; using Learun.Util; using Learun.Util.Operat; using System.Web.Mvc; using Learun.Application.Organization; using Learun.Application.TwoDevelopment.EducationalAdministration; using Quanjiang.DigitalScholl.WebLicense; using Learun.Application.TwoDevelopment.LogisticsManagement; using System.Linq; using Learun.Application.OA; using Learun.Application.TwoDevelopment.LR_Desktop; using Learun.Application.TwoDevelopment.Permission; using Learun.Application.WorkFlow; using Learun.Application.OA.Schedule; namespace Learun.Application.Web.Controllers { /// /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园 /// Copyright (c) 2013-2018 北京泉江科技有限公司 /// 创建人:陈彬彬 /// 日 期:2017.03.09 /// 描 述:主页控制器 /// public class HomeController : MvcControllerBase { private EmpInfoIBLL empInfoIbll = new EmpInfoBLL(); private CompanyIBLL companyIbll = new CompanyBLL(); private QingJu_UserAccountIBLL qjAccountIbll = new QingJu_UserAccountBLL(); private StuInfoBasicIBLL stuInfoBasicIbll = new StuInfoBasicBLL(); private DatabaseInitIBLL databaseInitIBLL = new DatabaseInitBLL(); private DepartmentIBLL departmentIBLL = new DepartmentBLL(); private DgreeIBLL dgreeIBLL = new DgreeBLL(); private PostIBLL postIBLL = new PostBLL(); private UserIBLL userIBLL = new UserBLL(); private CdDeptIBLL cdDeptIBLL = new CdDeptBLL(); private CdMajorIBLL majorIBLL = new CdMajorBLL(); private LessonInfoIBLL infoIBLL = new LessonInfoBLL(); private ClassroomBuildingIBLL classroomBuildingIBLL = new ClassroomBuildingBLL(); private ClassroomInfoIBLL classroomInfoIBLL = new ClassroomInfoBLL(); private ClassInfoIBLL classInfoIBLL = new ClassInfoBLL(); private ArrangeLessonTermIBLL arrangeLessonTermIBLL = new ArrangeLessonTermBLL(); private ArrangeExamTermIBLL arrangeExamTermIBLL = new ArrangeExamTermBLL(); private StuScoreIBLL stuScoreIBLL = new StuScoreBLL(); private StuInfoFreshIBLL stuInfoFreshIBLL = new StuInfoFreshBLL(); private AccommodationIBLL accdormitoryIBLL = new AccommodationBLL(); private NWFProcessIBLL nWFProcessIBLL = new NWFProcessBLL(); private NoticeIBLL newsIBLL = new NoticeBLL(); private SYS_ReceiveMessageIBLL sYS_ReceiveMessageIBLL = new SYS_ReceiveMessageBLL(); private Sys_ReceiveFileIBLL sys_ReceiveFileIBLL = new Sys_ReceiveFileBLL(); private Sys_UpdateRecordIBLL sys_UpdateRecordIBLL = new Sys_UpdateRecordBLL(); private Perm_FunctionIBLL perm_FunctionIBLL = new Perm_FunctionBLL(); private ICache redisCache = CacheFactory.CaChe(); private Sys_DefaultPwdConfigIBLL sys_DefaultPwdConfigIBLL = new Sys_DefaultPwdConfigBLL(); private ScheduleIBLL scheduleIBLL = new ScheduleBLL(); private MessageRindIBLL messageRindIBLL = new MessageRindBLL(); #region 视图功能 public ActionResult ChangePwd() { return View(); } #region 统一身份认证2.0 public ActionResult SSOApplication() { var userinfo = LoginUserInfo.Get(); ViewBag.FunctionList = perm_FunctionIBLL.GetListByUserId(userinfo.userId); return View(); } /// /// 跳转网站 /// /// public ActionResult GoToApplication() { string redi = Request.QueryString["redi"]; if (!string.IsNullOrEmpty(redi)) { var userinfo = LoginUserInfo.Get(); if (userinfo != null) { var perm_application = perm_FunctionIBLL.GetPerm_FunctionEntity(Request.QueryString["appid"]); if (perm_application != null) { //写入当前请求所登录的用户 var code = Util.CommonHelper.RndNum(9); redisCache.Write(code, userinfo.account, TimeSpan.FromMinutes(10)); var url = perm_application.FInterfaceUrl; if (url.Contains("?")) { url += "&appkey=" + DESEncrypt.Encrypt(code, "bjqjsso"); } else { url += "?appkey=" + DESEncrypt.Encrypt(code, "bjqjsso"); } return Redirect(url); } else return RedirectToAction("Index"); } else { return RedirectToAction("Index"); } } return View(); } #endregion public ActionResult NeedToDoForm() { var userinfo = LoginUserInfo.Get(); Pagination paginationobj = new Pagination() { rows = 5, page = 1, sidx = "readflag asc,SENDTIME desc ", sord = "desc" }; //未读邮件 ViewBag.UnreadMail = sYS_ReceiveMessageIBLL.GetPageList(paginationobj, "{\"userId\":\"" + userinfo.userId + "\"}").Count(m => m.READFLAG == 0); //办公事项 paginationobj.sidx = "F_CreateDate"; ViewBag.UnreadTask = nWFProcessIBLL.GetMyTaskPageList(userinfo, paginationobj, "{}").Count(); //公告 List outnewslist = new List(); var newsList = newsIBLL.GetPageList(paginationobj, ""); foreach (var newsitemEntity in newsList) { if (!string.IsNullOrEmpty(newsitemEntity.F_SendPostId)) { if (!string.IsNullOrEmpty(userinfo.postIds)) { if (userinfo.postIds.Contains(",")) { foreach (var postid in userinfo.postIds.Split(',')) { if (newsitemEntity.F_SendPostId.Contains(postid)) { outnewslist.Add(newsitemEntity); break; } } } else { if (newsitemEntity.F_SendPostId.Contains(userinfo.postIds)) { outnewslist.Add(newsitemEntity); } } } } else { if (!string.IsNullOrEmpty(newsitemEntity.F_SendDeptId)) { if (newsitemEntity.F_SendDeptId.Contains(userinfo.departmentId)) { outnewslist.Add(newsitemEntity); } } else { outnewslist.Add(newsitemEntity); } } } var readnewslist = newsIBLL.GetList("", userinfo.userId).Where(m => !string.IsNullOrEmpty(m.RNewsId)).Select(m => m.F_NewsId); ViewBag.UnreadNews = outnewslist.Count(m => !readnewslist.Contains(m.F_NewsId)); paginationobj.sidx = "SendTime"; ViewBag.UnreadFile = sys_ReceiveFileIBLL.GetPageListByUserId(paginationobj, "{}", userinfo.userId).Where(a => a.STypeId == 1).Count(); return View(); } public ActionResult GoTo() { var loginUserInfo = LoginUserInfo.Get(); string redi = Request.QueryString["redi"]; if (!string.IsNullOrEmpty(redi)) { string sysid = Request.QueryString["sysid"]; if (!string.IsNullOrEmpty(sysid)) { if (sysid == "kaoshi") { if (!string.IsNullOrEmpty(ConfigurationManager.AppSettings["kaoshisystemurl"])) { return Redirect(ConfigurationManager.AppSettings["kaoshisystemurl"] + "?u=" + DESEncrypt.Encrypt(loginUserInfo.account, ConfigurationManager.AppSettings["SSOPublicSecret"])); } else { return Fail("系统地址未配置"); } } if (sysid == "paike") { if (!string.IsNullOrEmpty(ConfigurationManager.AppSettings["kaoshisystemurl"])) { return Redirect(ConfigurationManager.AppSettings["kaoshisystemurl"] + "?u=" + DESEncrypt.Encrypt(loginUserInfo.account, ConfigurationManager.AppSettings["SSOPublicSecret"])); } else { return Fail("系统地址未配置"); } } return Fail("系统id未找到"); } else { return Fail("系统id未设置"); } } else { return View(); } } public ActionResult GoQingJu() { string redi = Request.QueryString["redi"]; if (!string.IsNullOrEmpty(redi)) { HttpClient client = new HttpClient(); try { var userinfo = LoginUserInfo.Get(); string publickey = ConfigurationManager.AppSettings["SSOPublicSecret"]; string qingJuurl = ConfigurationManager.AppSettings["QingJuurl"]; string qingjuregisterurl = ConfigurationManager.AppSettings["QingJuRegisterurl"]; string defpwd = ConfigurationManager.AppSettings["defaultpwd"]; //读取默认密码配置中已启用的密码 if (sys_DefaultPwdConfigIBLL.GetEnabledEntity() != null) { defpwd = sys_DefaultPwdConfigIBLL.GetEnabledEntity().Pwd; } var qjinfo = qjAccountIbll.GetQingJu_UserAccountEntityByAccount(userinfo.account); if (qjinfo == null || string.IsNullOrEmpty(qjinfo.UserAccount)) { if (userinfo.Description == "教师") { var empinfo = empInfoIbll.GetEmpInfoEntityByEmpNo(userinfo.account); string jsoncontent = "{\"account\":\"" + userinfo.account + "\"," + "\"realname\":\"" + empinfo.EmpName + "\"," + "\"mobile\":\"" + empinfo.mobile + "\"," + "\"idcardno\":\"" + empinfo.IdentityCardNo + "\"," + "\"genderno\":\"" + (empinfo.GenderNo != null ? empinfo.GenderNo.Value.ToString() : "true") + "\"," + "\"school\":\"" + (companyIbll.GetEntity(empinfo.F_CompanyId) != null ? companyIbll.GetEntity(empinfo.F_CompanyId).F_FullName : "") + "\"," + "\"isteacher\":\"true\"" + "}"; HttpContent httpContent = new StringContent(jsoncontent); httpContent.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/json"); string clientData = client.PostAsync(qingjuregisterurl, httpContent).Result.Content.ReadAsStringAsync().Result; var result = Convert.ToBoolean(clientData); if (result) { QingJu_UserAccountEntity qjentity = new QingJu_UserAccountEntity(); qjentity.Create(); qjentity.UserAccount = userinfo.account; qjentity.QUserName = userinfo.account; qjentity.QPass = DESEncrypt.Encrypt(defpwd, publickey); qjAccountIbll.SaveEntity(null, qjentity); return Redirect(qingJuurl + "?u=" + DESEncrypt.Encrypt(userinfo.account, publickey) + "&p=" + DESEncrypt.Encrypt(defpwd, publickey) + "&t=" + DESEncrypt.Encrypt(DateTime.Now.ToString("yyyyMMddHHmmss"), publickey)); } else { //注册失败 return Redirect("/Home/QingJuRegister?e=1"); } } else { var empinfo = stuInfoBasicIbll.GetStuInfoBasicEntityByStuNo(userinfo.account); string jsoncontent = "{\"account\":\"" + userinfo.account + "\"," + "\"realname\":\"" + empinfo.StuName + "\"," + "\"mobile\":\"" + empinfo.mobile + "\"," + "\"idcardno\":\"" + empinfo.IdentityCardNo + "\"," + "\"genderno\":\"" + (empinfo.GenderNo != null ? empinfo.GenderNo.Value.ToString() : "true") + "\"," + "\"school\":\"" + (companyIbll.GetEntity(empinfo.F_SchoolId) != null ? companyIbll.GetEntity(empinfo.F_SchoolId).F_FullName : "") + "\"," + "\"isteacher\":\"false\"" + "}"; HttpContent httpContent = new StringContent(jsoncontent); httpContent.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/json"); string clientData = client.PostAsync(qingjuregisterurl, httpContent).Result.Content.ReadAsStringAsync().Result; var result = Convert.ToBoolean(clientData); if (result) { QingJu_UserAccountEntity qjentity = new QingJu_UserAccountEntity(); qjentity.Create(); qjentity.UserAccount = userinfo.account; qjentity.QUserName = userinfo.account; qjentity.QPass = DESEncrypt.Encrypt(defpwd, publickey); qjAccountIbll.SaveEntity(null, qjentity); return Redirect(qingJuurl + "?u=" + DESEncrypt.Encrypt(userinfo.account, publickey) + "&p=" + DESEncrypt.Encrypt(defpwd, publickey) + "&t=" + DESEncrypt.Encrypt(DateTime.Now.ToString("yyyyMMddHHmmss"), publickey)); } else { //注册失败 return Redirect("/Home/QingJuRegister"); } } } else { qjinfo.QPass = DESEncrypt.Decrypt(qjinfo.QPass, publickey); return Redirect(qingJuurl + "?u=" + DESEncrypt.Encrypt(qjinfo.QUserName, publickey) + "&p=" + DESEncrypt.Encrypt(qjinfo.QPass, publickey) + "&t=" + DESEncrypt.Encrypt(DateTime.Now.ToString("yyyyMMddHHmmss"), publickey)); } } catch (Exception e) { throw ExceptionEx.ThrowBusinessException(e); } } else { return View(); } } public ActionResult QingJuRegister(QingJu_UserAccountEntity up) { string e = Request.QueryString["e"]; if (!string.IsNullOrEmpty(e)) { if (e == "1") { ViewBag.EMessage = "默认帐号自动注册失败,原因:帐号重复,请更换帐号后注册。"; } if (e == "2") { ViewBag.EMessage = "帐号重复,请更换"; } } HttpClient client = new HttpClient(); var userinfo = LoginUserInfo.Get(); string publickey = ConfigurationManager.AppSettings["SSOPublicSecret"]; string qingJuurl = ConfigurationManager.AppSettings["QingJuurl"]; string qingjuregisterurl = ConfigurationManager.AppSettings["QingJuRegisterurl"]; string defpwd = ConfigurationManager.AppSettings["defaultpwd"]; //读取默认密码配置中已启用的密码 if (sys_DefaultPwdConfigIBLL.GetEnabledEntity() != null) { defpwd = sys_DefaultPwdConfigIBLL.GetEnabledEntity().Pwd; } if (up != null && !string.IsNullOrEmpty(up.QUserName)) { if (userinfo.Description == "教师") { var empinfo = empInfoIbll.GetEmpInfoEntityByEmpNo(userinfo.account); string jsoncontent = "{\"account\":\"" + up.QUserName + "\"," + "\"realname\":\"" + empinfo.EmpName + "\"," + "\"mobile\":\"" + empinfo.mobile + "\"," + "\"idcardno\":\"" + empinfo.IdentityCardNo + "\"," + "\"genderno\":\"" + (empinfo.GenderNo != null ? empinfo.GenderNo.Value.ToString() : "true") + "\"," + "\"school\":\"" + (companyIbll.GetEntity(empinfo.F_CompanyId) != null ? companyIbll.GetEntity(empinfo.F_CompanyId).F_FullName : "") + "\"," + "\"isteacher\":\"true\"" + "}"; HttpContent httpContent = new StringContent(jsoncontent); httpContent.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/json"); string clientData = client.PostAsync(qingjuregisterurl, httpContent).Result.Content.ReadAsStringAsync().Result; var result = Convert.ToBoolean(clientData); if (result) { QingJu_UserAccountEntity qjentity = new QingJu_UserAccountEntity(); qjentity.Create(); qjentity.UserAccount = userinfo.account; qjentity.QUserName = up.QUserName; qjentity.QPass = DESEncrypt.Encrypt(defpwd, publickey); qjAccountIbll.SaveEntity(null, qjentity); return Redirect(qingJuurl + "?u=" + DESEncrypt.Encrypt(up.QUserName, publickey) + "&p=" + DESEncrypt.Encrypt(defpwd, publickey) + "&t=" + DESEncrypt.Encrypt(DateTime.Now.ToString("yyyyMMddHHmmss"), publickey)); } else { return Redirect("/Home/QingJuRegister?e=2"); } } else { var empinfo = stuInfoBasicIbll.GetStuInfoBasicEntityByStuNo(userinfo.account); string jsoncontent = "{\"account\":\"" + up.QUserName + "\"," + "\"realname\":\"" + empinfo.StuName + "\"," + "\"mobile\":\"" + empinfo.mobile + "\"," + "\"idcardno\":\"" + empinfo.IdentityCardNo + "\"," + "\"genderno\":\"" + (empinfo.GenderNo != null ? empinfo.GenderNo.Value.ToString() : "true") + "\"," + "\"school\":\"" + (companyIbll.GetEntity(empinfo.F_SchoolId) != null ? companyIbll.GetEntity(empinfo.F_SchoolId).F_FullName : "") + "\"," + "\"isteacher\":\"false\"" + "}"; HttpContent httpContent = new StringContent(jsoncontent); httpContent.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/json"); string clientData = client.PostAsync(qingjuregisterurl, httpContent).Result.Content.ReadAsStringAsync().Result; var result = Convert.ToBoolean(clientData); if (result) { QingJu_UserAccountEntity qjentity = new QingJu_UserAccountEntity(); qjentity.Create(); qjentity.UserAccount = userinfo.account; qjentity.QUserName = up.QUserName; qjentity.QPass = DESEncrypt.Encrypt(defpwd, publickey); qjAccountIbll.SaveEntity(null, qjentity); return Redirect(qingJuurl + "?u=" + DESEncrypt.Encrypt(up.QUserName, publickey) + "&p=" + DESEncrypt.Encrypt(defpwd, publickey) + "&t=" + DESEncrypt.Encrypt(DateTime.Now.ToString("yyyyMMddHHmmss"), publickey)); } else { return Redirect("/Home/QingJuRegister?e=2"); } } } else { return View(); } } /// /// 初始化页面 /// /// [HttpGet] public ActionResult Index() { //授权验证 var lc = LicenseChecker.CheckLicense(); if (!lc.Result) { return Content(""); } //return View("AdminTop"); string learn_UItheme = WebHelper.GetCookie("Learn_ADMS_V6.1_UItheme"); #region 待办 var userinfo = LoginUserInfo.Get(); Pagination paginationobj = new Pagination() { rows = 100, page = 1, sidx = "readflag asc,SENDTIME desc ", sord = "desc" }; //未读邮件 ViewBag.UnreadMail = sYS_ReceiveMessageIBLL.GetPageList(paginationobj, "{\"userId\":\"" + userinfo.userId + "\"}").Count(m => m.READFLAG == 0); //办公事项 paginationobj.sidx = "F_CreateDate"; ViewBag.UnreadTask = nWFProcessIBLL.GetMyTaskPageList(userinfo, paginationobj, "{}").Count(); //公告 List outnewslist = new List(); var newsList = newsIBLL.GetPageList(paginationobj, ""); foreach (var newsitemEntity in newsList) { if (!string.IsNullOrEmpty(newsitemEntity.F_SendPostId)) { if (!string.IsNullOrEmpty(userinfo.postIds)) { if (userinfo.postIds.Contains(",")) { foreach (var postid in userinfo.postIds.Split(',')) { if (newsitemEntity.F_SendPostId.Contains(postid)) { outnewslist.Add(newsitemEntity); break; } } } else { if (newsitemEntity.F_SendPostId.Contains(userinfo.postIds)) { outnewslist.Add(newsitemEntity); } } } } else { if (!string.IsNullOrEmpty(newsitemEntity.F_SendDeptId)) { if (userinfo.departmentId != null && newsitemEntity.F_SendDeptId.Contains(userinfo.departmentId)) { outnewslist.Add(newsitemEntity); } } else { outnewslist.Add(newsitemEntity); } } } var readnewslist = newsIBLL.GetList("", userinfo.userId).Where(m => !string.IsNullOrEmpty(m.RNewsId)).Select(m => m.F_NewsId); ViewBag.UnreadNews = outnewslist.Count(m => !readnewslist.Contains(m.F_NewsId)); paginationobj.sidx = "SendTime"; ViewBag.UnreadFile = sys_ReceiveFileIBLL.GetPageListByUserId(paginationobj, "{}", userinfo.userId).Count(); ViewBag.UnreadNum = ViewBag.UnreadFile + ViewBag.UnreadNews + ViewBag.UnreadTask + ViewBag.UnreadMail; #endregion //获取在线用户人数 ViewBag.OnlineUserNum = 0; var onlineUserResult = sys_UpdateRecordIBLL.GetOnlineUserNum(); if (onlineUserResult != null) { ViewBag.OnlineUserNum = onlineUserResult.OnlineUserNum; } //获取本机ip ViewBag.Ip = GetIP(); ViewBag.ACIp = ConfigurationManager.AppSettings["ACIp"] ?? ""; ViewBag.ACIp2 = ConfigurationManager.AppSettings["ACIp2"] ?? ""; #region 日程提醒 //判断今天是否有日程提醒 var scheduleList = scheduleIBLL.GetListByUserId(userinfo.userId).Where(x => x.F_StartDate <= DateTime.Now && x.F_EndDate >= DateTime.Now); if (scheduleList.Any()) { foreach (var item in scheduleList) { //判断该日程今天是否已提醒过 var st = Convert.ToDateTime(string.Format("{0} {1}", DateTime.Now.ToString("yyyy-MM-dd"), "00:00:00")); var et = Convert.ToDateTime(string.Format("{0} {1}", DateTime.Now.ToString("yyyy-MM-dd"), "23:59:59")); var mrlist = messageRindIBLL.GetList("{\"InstanceId\":\"" + item.F_ScheduleId + "\",\"StartTime\":\"" + st + "\",\"EndTime\":\"" + et + "\"}"); if (!mrlist.Any()) { MessageRemindEntity entity = new MessageRemindEntity(); entity.ReceiptId = item.F_CreateUserId; entity.ReceiptName = item.F_CreateUserName; entity.SenderId = item.F_CreateUserId; entity.SenderName = item.F_CreateUserName; entity.TheTitle = "日程提醒"; entity.TheContent = item.F_ScheduleContent; entity.InstanceId = item.F_ScheduleId; entity.ConnectionUrl = "/LR_OAModule/Schedule/Index?keyValue="; entity.SendTime = DateTime.Now; entity.ReadSigns = false; messageRindIBLL.SaveEntity("", entity); } } } #endregion switch (learn_UItheme) { case "1": return View("AdminDefault"); // 经典版本 case "2": return View("AdminAccordion"); // 风尚版 case "3": return View("AdminWindos"); // 炫动版 case "4": return View("AdminTop"); // 飞扬版 case "5": return View("AdminNavigation"); // 导航版 case "6": return View("AdminTheme5"); // 主题五 default: return View("AdminDefault"); // 经典版本 } } /// /// 获取登录人员信息 /// 主键 /// /// [HttpPost] [AjaxOnly] public ActionResult GetOnlineUserInfo(string keyValue) { return Success(sys_UpdateRecordIBLL.GetOnlineUserInfo()); } /// /// 学生首页 /// /// [HttpGet] public ActionResult HomeOfStudent() { var userInfo = LoginUserInfo.Get(); var StuInfoFreshEntity = stuInfoFreshIBLL.GetStuInfoFreshEntityByStuNo(userInfo.account); if (StuInfoFreshEntity != null) { StuInfoFreshEntity.DeptName = cdDeptIBLL.GetCdDeptEntityByNo(StuInfoFreshEntity.DeptNo)?.DeptName; StuInfoFreshEntity.MajorName = majorIBLL.GetCdMajorEntityByMajorNo(StuInfoFreshEntity.MajorNo)?.MajorName; //是否完善信息 StuInfoFreshEntity.IsStudentEdit = stuInfoFreshIBLL.GetStuInfoFreshFamilyList(StuInfoFreshEntity.ID).Any(); var classInfoEntity = classInfoIBLL.GetClassInfoEntityByClassNo(StuInfoFreshEntity.ClassNo); if (classInfoEntity != null) { StuInfoFreshEntity.ClassName = classInfoEntity.ClassName; StuInfoFreshEntity.ClassTutorNo = classInfoEntity.ClassTutorNo; var empInfoEntity = empInfoIbll.GetEmpInfoEntityByEmpNo(classInfoEntity.ClassTutorNo); if (empInfoEntity != null) { StuInfoFreshEntity.ClassTutorName = empInfoEntity.EmpName; StuInfoFreshEntity.ClassTutorMobile = empInfoEntity.mobile; } } StuInfoFreshEntity.DormitoryName = accdormitoryIBLL.GetDormitoryInfoByPlanStuNo(StuInfoFreshEntity.ID); } var now = DateTime.Now; ViewBag.Year = now.Year; var companyEntity = companyIbll.GetEntity(userInfo.companyId); if (companyEntity != null) { ViewBag.Company = companyEntity.F_FullName; } return View(StuInfoFreshEntity); } /// /// 使用引导 /// /// [HttpGet] public ActionResult Guide() { var userInfo = LoginUserInfo.Get(); ViewBag.userId = userInfo.userId; ViewBag.PublicKey = ConfigurationManager.AppSettings["SSOPublicSecret"]; return View(); } /// /// 桌面导航 /// /// [HttpGet] public ActionResult DesktopNavigation() { //var userInfo = LoginUserInfo.Get(); //ViewBag.userId = userInfo.userId; //ViewBag.PublicKey = ConfigurationManager.AppSettings["SSOPublicSecret"]; return View("DesktopNavigation4"); } /// /// 首页桌面 /// /// [HttpGet] public ActionResult AdminDesktop() { //学生登录后跳转到“学生首页” var userInfo = LoginUserInfo.Get(); if (userInfo.Description == "学生" && userInfo.companyId == "207fa1a9-160c-4943-a89b-8fa4db0547ce") //西昌民族幼儿 { if (stuInfoBasicIbll.GetStuInfoBasicEntityByStuNo(userInfo.account) == null) //新生 { return RedirectToAction("HomeOfStudent"); } else { return Redirect("/UserCenter/Index"); } } //return View("AdminDesktopTop"); string learn_UItheme = WebHelper.GetCookie("Learn_ADMS_V6.1_UItheme"); switch (learn_UItheme) { case "1": return View("AdminDesktop"); // 经典版本 case "2": return View("AdminDesktopAccordion"); // 风尚版 case "3": return View("AdminDesktopWindos"); // 炫动版 case "4": return View("AdminDesktopTop"); // 飞扬版 default: return View("AdminDesktop"); // 经典版本 } } /// /// 首页模板 /// /// [HttpGet] public ActionResult AdminDesktopTemp() { return View(); } #endregion private ICache cache = CacheFactory.CaChe(); #region 清空缓存 /// /// 清空缓存 /// /// [HttpPost] [AjaxOnly] public ActionResult ClearRedis() { for (int i = 0; i < 16; i++) { cache.RemoveAll(i); } return Success("清空成功"); } #endregion #region 解绑微信 /// /// 解绑微信 /// /// [HttpPost] [AjaxOnly] public ActionResult CancelWeiXinBind(string keyValue) { var userId = LoginUserInfo.Get().userId; if (!string.IsNullOrEmpty(keyValue)) { userId = keyValue; } //更新openid userIBLL.UpdateWeixinOpenIdPC(userId, ""); return Success("解绑成功"); } #endregion /// /// 访问功能 /// /// 功能Id /// 功能模块 /// 访问路径 /// [HttpPost] public ActionResult VisitModule(string moduleName, string moduleUrl) { UserInfo userInfo = LoginUserInfo.Get(); LogEntity logEntity = new LogEntity(); logEntity.F_CategoryId = 2; logEntity.F_OperateTypeId = ((int)OperationType.Visit).ToString(); logEntity.F_OperateType = EnumAttribute.GetDescription(OperationType.Visit); logEntity.F_OperateAccount = userInfo.account; logEntity.F_OperateUserId = userInfo.userId; logEntity.F_Module = moduleName; logEntity.F_ExecuteResult = 1; logEntity.F_ExecuteResultJson = "访问地址:" + moduleUrl; logEntity.F_Description = "PC端"; logEntity.WriteLog(); return Success("ok"); } #region 系统数据初始化 public ActionResult DataBaseInit() { return View(); } [HttpPost] public ActionResult DoDataBaseInit() { databaseInitIBLL.InitDatabase(); return Success("初始化成功"); } #endregion #region 获取数据 [HttpGet] public ActionResult GetYearAndSemesteResult() { var result = Common.GetSemesterAndYear(); return Success(result); } [HttpGet] public ActionResult GetDgree(string moduleID) { var result = dgreeIBLL.GetDgreeEntityByModuleID(moduleID); return Success(result); } [HttpGet] public ActionResult GetCompanyDgree() { var result = companyIbll.GetAny(); return Success(result); } [HttpGet] public ActionResult GetDepartment() { var result = departmentIBLL.GetAny(); return Success(result); } [HttpGet] public ActionResult GetPost() { var result = postIBLL.GetAny(); return Success(result); } [HttpGet] public ActionResult GetEmpInfo() { var result = empInfoIbll.GetAny(); return Success(result); } [HttpGet] public ActionResult GetEmpAccount() { var result = userIBLL.GetAny(); return Success(result); } [HttpGet] public ActionResult GetCdDept() { var result = cdDeptIBLL.GetAny(); return Success(result); } [HttpGet] public ActionResult GetMajor() { var result = majorIBLL.GetAny(); return Success(result); } [HttpGet] public ActionResult GetLesson() { var result = infoIBLL.GetAny(); return Success(result); } [HttpGet] public ActionResult GetClassroomBuilding() { var result = classroomBuildingIBLL.GetAny(); return Success(result); } [HttpGet] public ActionResult GetClassroomInfo() { var result = classroomInfoIBLL.GetAny(); return Success(result); } [HttpGet] public ActionResult GetClassInfo() { var result = classInfoIBLL.GetAny(); return Success(result); } [HttpGet] public ActionResult GetStudentInfo() { var result = stuInfoBasicIbll.GetAny(); return Success(result); } [HttpGet] public ActionResult GetStuAccount() { var result = userIBLL.GetStuAny(); return Success(result); } [HttpGet] public ActionResult GetArrangeLesson() { var result = arrangeLessonTermIBLL.GetAny(); return Success(result); } [HttpGet] public ActionResult GetArrangeExam() { var result = arrangeExamTermIBLL.GetAny(); return Success(result); } [HttpGet] public ActionResult GetStuScore() { var result = stuScoreIBLL.GetAny(); return Success(result); } #endregion private string GetIP() { //string ip = string.Empty; //if (!string.IsNullOrEmpty(System.Web.HttpContext.Current.Request.ServerVariables["HTTP_VIA"])) // ip = Convert.ToString(System.Web.HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"]); //if (string.IsNullOrEmpty(ip)) // ip = Convert.ToString(System.Web.HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"]); //return ip; string userIP = "未获取用户IP"; try { if (System.Web.HttpContext.Current == null || System.Web.HttpContext.Current.Request == null || System.Web.HttpContext.Current.Request.ServerVariables == null) { return ""; } string CustomerIP = ""; //CDN加速后取到的IP simone 090805 CustomerIP = System.Web.HttpContext.Current.Request.Headers["Cdn-Src-Ip"]; if (!string.IsNullOrEmpty(CustomerIP)) { return CustomerIP; } CustomerIP = System.Web.HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; if (!String.IsNullOrEmpty(CustomerIP)) { return CustomerIP; } if (System.Web.HttpContext.Current.Request.ServerVariables["HTTP_VIA"] != null) { CustomerIP = System.Web.HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; if (CustomerIP == null) { CustomerIP = System.Web.HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"]; } } else { CustomerIP = System.Web.HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"]; } if (string.Compare(CustomerIP, "unknown", true) == 0 || String.IsNullOrEmpty(CustomerIP)) { return System.Web.HttpContext.Current.Request.UserHostAddress; } return CustomerIP; } catch { } return userIP; } } }