From 53ba192d138726767c79d1e5ad38de3163022cfb Mon Sep 17 00:00:00 2001 From: ndbs Date: Mon, 12 Aug 2024 16:22:38 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=AF=B9=E6=8E=A5=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E9=AA=8C=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Learun.Application.WebApi.csproj | 2 + .../Modules/ArrangelessonLogin.cs | 346 ++++++++++++++++++ .../Modules/BaseNoAuthenticationNoLogin.cs | 290 +++++++++++++++ .../Modules/TransferApi.cs | 6 +- .../Learun.Util/Attributes/EnumAttribute.cs | 19 + 5 files changed, 662 insertions(+), 1 deletion(-) create mode 100644 Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/ArrangelessonLogin.cs create mode 100644 Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/BaseNoAuthenticationNoLogin.cs diff --git a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Learun.Application.WebApi.csproj b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Learun.Application.WebApi.csproj index af48bee46..dfb9b4671 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Learun.Application.WebApi.csproj +++ b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Learun.Application.WebApi.csproj @@ -220,6 +220,8 @@ + + diff --git a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/ArrangelessonLogin.cs b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/ArrangelessonLogin.cs new file mode 100644 index 000000000..17fa6e943 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/ArrangelessonLogin.cs @@ -0,0 +1,346 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using Learun.Application.Organization; +using Learun.Application.TwoDevelopment.EducationalAdministration; +using Nancy; + +namespace Learun.Application.WebApi.Modules +{ + public class ArrangelessonLogin : BaseNoAuthenticationNoLogin + { + public ArrangelessonLogin() + : base("/arrangelessonlogin/") + { + Get["/lessontype"] = GetLessonTypes; + Get["/classtype"] = GetClassType; + Get["/student"] = GetStudents; + Get["/lessonsortdetail"] = GetLessonSortDetails; + Get["/lessonsort"] = GetLessonSorts; + Get["/classlesson"] = GetClassLessons; + Get["/bukaolist"] = GetBuKaoList; + //以下接口需要传值学年学期 + Get["/school"] = GetSchools; + Get["/dept"] = GetDepts; + Get["/major"] = GetMajors; + Get["/classroom"] = GetClassrooms; + Get["/lesson"] = GetLessons; + Get["/teacher"] = GetTeachers; + Get["/class"] = GetClasses; + Get["/stu"] = GetStus; + //以下返回全部 + Get["/department"] = GetDepartment; + Get["/allteacher"] = GetAllTeachers; + Get["/allstudent"] = GetAllStudents; + Get["/alldept"] = GetAllDept; + Get["/allmajor"] = GetAllMajor; + Get["/alllesson"] = GetAllLesson; + Get["/allclass"] = GetAllClass; + Get["/alluser"] = GetAllUsers; + Get["/allschool"] = GetAllSchools; + Get["/allclasslesson"] = GetAllClassLesson; + Get["/allelelectivelesson"] = GetAllElectiveLesson; + + //以下接口不往ArrangeLessonSync里记录已传数据 + Get["/schoolNotRecord"] = GetSchoolsNotRecord; + Get["/deptNotRecord"] = GetDeptsNotRecord; + Get["/majorNotRecord"] = GetMajorsNotRecord; + Get["/classroomNotRecord"] = GetClassroomsNotRecord; + Get["/lessonNotRecord"] = GetLessonsNotRecord; + Get["/teacherNotRecord"] = GetTeachersNotRecord; + Get["/classNotRecord"] = GetClassesNotRecord; + Get["/stuNotRecord"] = GetStusNotRecord; + Get["trantest"] = TranTest; + //按条件重置基础数据同步状态 + Get["/initbasicdata"] = InitBasicData; + + } + private readonly ArrangeLessonTermIBLL arrangeLessonTermIBLL = new ArrangeLessonTermBLL(); + private readonly StuScoreIBLL stuScoreIBLL = new StuScoreBLL(); + private DepartmentIBLL departmentIBLL = new DepartmentBLL(); + EmpInfoIBLL empInfoIbll = new EmpInfoBLL(); + private StuInfoBasicIBLL stuInfoBasicIbll = new StuInfoBasicBLL(); + CdDeptIBLL cdDeptIbll = new CdDeptBLL(); + CdMajorIBLL cdMajorIbll = new CdMajorBLL(); + private LessonInfoIBLL lessonInfoIbll = new LessonInfoBLL(); + ClassInfoIBLL classInfoIbll = new ClassInfoBLL(); + UserIBLL userIbll = new UserBLL(); + private CompanyIBLL companyIbll = new CompanyBLL(); + + private StuSelectLessonListOfElectiveIBLL stuSelectLessonListOfElectiveIbll = + new StuSelectLessonListOfElectiveBLL(); + + private Response TranTest(dynamic _) + { + return Success("ok"); + } + + private Response GetAllLesson(dynamic _) + { + var result = lessonInfoIbll.GetAllLesson(); + return Success(result); + } + private Response GetAllClass(dynamic _) + { + var result = classInfoIbll.GetAllClass(); + return Success(result); + } + private Response GetAllTeachers(dynamic _) + { + var result = empInfoIbll.GetAllList().Where(m => m.CheckMark == true).ToList(); + return Success(result); + } + private Response GetAllSchools(dynamic _) + { + var result = companyIbll.GetList(); + return Success(result); + } + private Response GetAllClassLesson(dynamic _) + { + string AcademicYearNo = Request.Query["AcademicYearNo"]; + string Semester = Request.Query["Semester"]; + var result = arrangeLessonTermIBLL.GetAllClassLesson(AcademicYearNo, Semester); + return Success(result); + } + private Response InitBasicData(dynamic _) + { + string AcademicYearNo = Request.Query["AcademicYearNo"]; + string Semester = Request.Query["Semester"]; + string BaseTable = Request.Query["BaseTable"]; + if (string.IsNullOrEmpty(AcademicYearNo) || string.IsNullOrEmpty(Semester)) + { + return Fail("学年学期参数不能为空"); + } + if (string.IsNullOrEmpty(BaseTable)) + { + return Fail("基础表参数不能为空"); + } + ArrangeLessonTermEntity arrangeLessonTermEntity = new ArrangeLessonTermEntity(); + arrangeLessonTermEntity.AcademicYearNo = AcademicYearNo; + arrangeLessonTermEntity.Semester = Semester; + arrangeLessonTermEntity.SyncBasicTable = BaseTable; + arrangeLessonTermIBLL.InitAsyncDataByCondition(arrangeLessonTermEntity); + return Success("操作成功"); + } + private Response GetAllElectiveLesson(dynamic _) + { + string AcademicYearNo = Request.Query["AcademicYearNo"]; + string Semester = Request.Query["Semester"]; + var result = stuSelectLessonListOfElectiveIbll.GetAllElectiveLesson(AcademicYearNo, Semester); + return Success(result); + } + private Response GetAllUsers(dynamic _) + { + var result = userIbll.GetAllList().Where(m => !m.F_Account.Contains("System") && m.F_DeleteMark == 0 && m.F_EnabledMark == 1).Select(m => new + { + m.F_UserId, + m.F_CompanyId, + m.F_DepartmentId, + F_Description = m.F_Description == "教师" ? "2" : "3", + ClassNo = stuInfoBasicIbll.GetStuInfoBasicEntityByStuNo(m.F_Account)?.ClassNo, + m.F_RealName, + m.F_Account, + Year = "20" + stuInfoBasicIbll.GetStuInfoBasicEntityByStuNo(m.F_Account)?.Grade, + m.F_IdentityCardNo + }); + return Success(result); + } + private Response GetAllStudents(dynamic _) + { + var result = stuInfoBasicIbll.GetAllList(); + return Success(result); + } + private Response GetDepartment(dynamic _) + { + var result = departmentIBLL.GetAllList(); + return Success(result); + } + private Response GetAllDept(dynamic _) + { + var result = cdDeptIbll.GetAllList(); + return Success(result); + } + private Response GetAllMajor(dynamic _) + { + var result = cdMajorIbll.GetAllList(); + return Success(result); + } + private Response GetLessonTypes(dynamic _) + { + var result = arrangeLessonTermIBLL.GetLessonTypes(); + return Success(result); + } + private Response GetDepts(dynamic _) + { + string AcademicYearNo = Request.Query["AcademicYearNo"]; + string Semester = Request.Query["Semester"]; + var result = arrangeLessonTermIBLL.GetDepts(AcademicYearNo, Semester); + return Success(result); + } + private Response GetDeptsNotRecord(dynamic _) + { + string AcademicYearNo = Request.Query["AcademicYearNo"]; + string Semester = Request.Query["Semester"]; + var result = arrangeLessonTermIBLL.GetDeptsNotRecord(AcademicYearNo, Semester); + return Success(result); + } + + private Response GetSchools(dynamic _) + { + string AcademicYearNo = Request.Query["AcademicYearNo"]; + string Semester = Request.Query["Semester"]; + var result = arrangeLessonTermIBLL.GetSchools(AcademicYearNo, Semester); + return Success(result); + } + private Response GetSchoolsNotRecord(dynamic _) + { + string AcademicYearNo = Request.Query["AcademicYearNo"]; + string Semester = Request.Query["Semester"]; + var result = arrangeLessonTermIBLL.GetSchoolsNotRecord(AcademicYearNo, Semester); + return Success(result); + } + + private Response GetClassLessons(dynamic _) + { + var result = arrangeLessonTermIBLL.GetClassLessons().Select(m => new + { + m.AcademicYearNo, + m.Semester, + m.DeptNo, + m.MajorNo, + m.LessonNo, + m.TeachClassNo, + m.EmpNo, + m.LessonSortNo + }); + return Success(result); + } + public Response GetStudents(dynamic _) + { + var result = arrangeLessonTermIBLL.GetStudents(); + return Success(result); + } + public Response GetMajors(dynamic _) + { + string AcademicYearNo = Request.Query["AcademicYearNo"]; + string Semester = Request.Query["Semester"]; + var result = arrangeLessonTermIBLL.GetMajors(AcademicYearNo, Semester); + return Success(result); + } + public Response GetMajorsNotRecord(dynamic _) + { + string AcademicYearNo = Request.Query["AcademicYearNo"]; + string Semester = Request.Query["Semester"]; + var result = arrangeLessonTermIBLL.GetMajorsNotRecord(AcademicYearNo, Semester); + return Success(result); + } + + public Response GetClassrooms(dynamic _) + { + string AcademicYearNo = Request.Query["AcademicYearNo"]; + string Semester = Request.Query["Semester"]; + var result = arrangeLessonTermIBLL.GetClassrooms(AcademicYearNo, Semester); + return Success(result); + } + public Response GetClassroomsNotRecord(dynamic _) + { + string AcademicYearNo = Request.Query["AcademicYearNo"]; + string Semester = Request.Query["Semester"]; + var result = arrangeLessonTermIBLL.GetClassroomsNotRecord(AcademicYearNo, Semester); + return Success(result); + } + + public Response GetClassType(dynamic _) + { + var result = arrangeLessonTermIBLL.GetClassType(); + return Success(result); + } + public Response GetLessons(dynamic _) + { + string AcademicYearNo = Request.Query["AcademicYearNo"]; + string Semester = Request.Query["Semester"]; + var result = arrangeLessonTermIBLL.GetLessons(AcademicYearNo, Semester); + return Success(result); + } + public Response GetLessonsNotRecord(dynamic _) + { + string AcademicYearNo = Request.Query["AcademicYearNo"]; + string Semester = Request.Query["Semester"]; + var result = arrangeLessonTermIBLL.GetLessonsNotRecord(AcademicYearNo, Semester); + return Success(result); + } + public Response GetLessonSortDetails(dynamic _) + { + var result = arrangeLessonTermIBLL.GetLessonSortDetails(); + return Success(result); + } + public Response GetLessonSorts(dynamic _) + { + var result = arrangeLessonTermIBLL.GetLessonSorts(); + return Success(result); + } + + public Response GetTeachers(dynamic _) + { + string AcademicYearNo = Request.Query["AcademicYearNo"]; + string Semester = Request.Query["Semester"]; + var result = arrangeLessonTermIBLL.GetTeachers(AcademicYearNo, Semester); + return Success(result); + } + public Response GetTeachersNotRecord(dynamic _) + { + string AcademicYearNo = Request.Query["AcademicYearNo"]; + string Semester = Request.Query["Semester"]; + var result = arrangeLessonTermIBLL.GetTeachersNotRecord(AcademicYearNo, Semester); + return Success(result); + } + + public Response GetClasses(dynamic _) + { + string AcademicYearNo = Request.Query["AcademicYearNo"]; + string Semester = Request.Query["Semester"]; + var result = arrangeLessonTermIBLL.GetClasses(AcademicYearNo, Semester); + return Success(result); + } + public Response GetClassesNotRecord(dynamic _) + { + string AcademicYearNo = Request.Query["AcademicYearNo"]; + string Semester = Request.Query["Semester"]; + var result = arrangeLessonTermIBLL.GetClassesNotRecord(AcademicYearNo, Semester); + return Success(result); + } + + public Response GetStus(dynamic _) + { + string AcademicYearNo = Request.Query["AcademicYearNo"]; + string Semester = Request.Query["Semester"]; + var result = arrangeLessonTermIBLL.GetStus(AcademicYearNo, Semester); + return Success(result); + } + + public Response GetStusNotRecord(dynamic _) + { + string AcademicYearNo = Request.Query["AcademicYearNo"]; + string Semester = Request.Query["Semester"]; + var result = arrangeLessonTermIBLL.GetStusNotRecord(AcademicYearNo, Semester); + return Success(result); + } + /// + /// 补考名单数据 + /// + /// + /// + private Response GetBuKaoList(dynamic _) + { + var allList = new List(); + var notPassList = stuScoreIBLL.GetStuScoreNotPassList(); + allList.AddRange(notPassList); + var notPassTwoList = stuScoreIBLL.GetStuScoreNotPassTwoList(); + allList.AddRange(notPassTwoList); + + var result = allList.Select(x => new { x.BuKaoFlag, x.AcademicYearNo, x.Semester, x.StuId, x.StuName, x.LessonId, x.LessonName, x.ClassId, x.ClassName, x.EmpId, x.EmpName }).OrderBy(x => x.BuKaoFlag).ThenByDescending(x => x.AcademicYearNo).ThenByDescending(x => x.Semester).ThenBy(x => x.StuId); + return Success(result); + } + } +} \ No newline at end of file diff --git a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/BaseNoAuthenticationNoLogin.cs b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/BaseNoAuthenticationNoLogin.cs new file mode 100644 index 000000000..4dc1d7185 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/BaseNoAuthenticationNoLogin.cs @@ -0,0 +1,290 @@ +using Learun.Application.Base.SystemModule; +using Learun.Loger; +using Learun.Util; +using Learun.Util.Operat; +using Nancy; +using Nancy.ModelBinding; +using System;//D:\Item\repos\DigitalScholl\Learun.Framework.Ultimate V7\Learun.Application.WebApi\Modules\TransferApi.cs +using static Learun.Application.WebApi.TransferApi; + +namespace Learun.Application.WebApi +{ + /// + /// 版 本 Learun-ADMS V7.0.0 数字化智慧校园 + /// Copyright (c) 2013-2018 北京泉江科技有限公司 + /// 创建人:数字化智慧校园-框架开发组 + /// 日 期:2017.05.12 + /// 描 述:Nancy-Api基础模块 + /// + public class BaseNoAuthenticationNoLogin : NancyModule + { + #region 构造函数 + public BaseNoAuthenticationNoLogin() + : base() + { + Before += BeforeRequest; + OnError += OnErroe; + } + public BaseNoAuthenticationNoLogin(string baseUrl) + : base(baseUrl) + { + Before += BeforeRequest; + OnError += OnErroe; + } + #endregion + + #region 获取请求数据 + /// + /// 获取请求数据 + /// + /// + /// + public T GetReqData() where T : class + { + try + { + ReqParameter req = this.Bind>(); + return req.data.ToObject(); + } + catch (Exception) + { + throw; + } + + } + /// + /// 获取请求数据 + /// + /// + public string GetReqData() + { + try + { + ReqParameter req = this.Bind>(); + return req.data; + } + catch (Exception) + { + throw; + } + + } + /// + /// 获取请求数据 + /// + /// + /// + public T GetReq() where T : class + { + try + { + T req = this.Bind(); + return req; + } + catch (Exception) + { + throw; + } + } + #endregion + + #region 响应接口 + /// + /// 成功响应数据 + /// + /// + /// + public Response Success(string info) + { + ResParameter res = new ResParameter { code = ResponseCode.success, info = info, data = new object { } }; + return Response.AsText(res.ToJson()).WithContentType("application/json"); + } + /// + /// 成功响应数据 + /// + /// + /// + /// + public Response Success(object data) + { + ResParameter res = new ResParameter { code = ResponseCode.success, info = "响应成功", data = data }; + return Response.AsText(res.ToJson()).WithContentType("application/json"); + } + /// + /// 成功响应数据 + /// + /// + /// + /// + public Response Success(T data) where T : class + { + ResParameter res = new ResParameter { code = ResponseCode.success, info = "响应成功", data = data }; + return Response.AsText(res.ToJson()).WithContentType("application/json"); + } + /// + /// 成功响应数据 + /// + /// + /// + /// + public Response SuccessString(string data) + { + ResParameter res = new ResParameter { code = ResponseCode.success, info = "响应成功", data = data }; + return Response.AsText(res.ToJson()).WithContentType("application/json"); + } + /// + /// 接口响应失败 + /// + /// + /// + public Response Fail(string info) + { + ResParameter res = new ResParameter { code = ResponseCode.fail, info = info, data = new object { } }; + return Response.AsText(res.ToJson()).WithContentType("application/json"); + } + public Response FailNoLogin(string info) + { + ResParameter res = new ResParameter { code = ResponseCode.nologin, info = info, data = new object { } }; + return Response.AsText(res.ToJson()).WithContentType("application/json"); + } + #endregion + + + #region 异常抓取 + /// + /// 日志对象实体 + /// + private Log _logger; + /// + /// 日志操作 + /// + public Log Logger + { + get { return _logger ?? (_logger = LogFactory.GetLogger(this.GetType().ToString())); } + } + /// + /// 监听接口异常 + /// + /// 连接上下信息 + /// 异常信息 + /// + private Response OnErroe(NancyContext ctx, Exception ex) + { + try + { + this.WriteLog(ctx, ex); + } + catch (Exception) + { + } + string msg = "提示:" + ex.Message; + return Response.AsText(new ResParameter { code = ResponseCode.exception, info = msg }.ToJson()).WithContentType("application/json").WithStatusCode(HttpStatusCode.OK); + } + /// + /// 写入日志(log4net) + /// + /// 提供使用 + private void WriteLog(NancyContext context, Exception ex) + { + if (context == null) + return; + string path = context.ResolvedRoute.Description.Path; + var log = LogFactory.GetLogger("workflowapi"); + Exception Error = ex; + LogMessage logMessage = new LogMessage(); + logMessage.OperationTime = DateTime.Now; + logMessage.Url = path; + logMessage.Class = "learunwebapi"; + logMessage.Ip = Net.Ip; + logMessage.Host = Net.Host; + logMessage.Browser = Net.Browser; + if (Error.InnerException == null) + { + logMessage.ExceptionInfo = Error.Message; + logMessage.ExceptionSource = Error.Source; + logMessage.ExceptionRemark = Error.StackTrace; + } + else + { + logMessage.ExceptionInfo = Error.InnerException.Message; + logMessage.ExceptionSource = Error.InnerException.Source; + logMessage.ExceptionRemark = Error.InnerException.StackTrace; + } + string strMessage = new LogFormat().ExceptionFormat(logMessage); + log.Error(strMessage); + + LogEntity logEntity = new LogEntity(); + logEntity.F_CategoryId = 4; + logEntity.F_OperateTypeId = ((int)OperationType.Exception).ToString(); + logEntity.F_OperateType = EnumAttribute.GetDescription(OperationType.Exception); + logEntity.F_OperateAccount = logMessage.UserName; + logEntity.F_ExecuteResult = -1; + logEntity.F_ExecuteResultJson = strMessage; + logEntity.F_Description = "移动端"; + logEntity.WriteLog(); + } + #endregion + + #region 权限验证 + public UserInfo userInfo; + public string loginMark; + public string token; + + + /// + /// 前置拦截器 + /// + /// + /// + private Response BeforeRequest(NancyContext ctx) + { + //var Requesttoken = DESEncrypt.Decrypt(Request.Headers["token"].ToString()); + var Requesttoken = DESEncrypt.Decrypt(Request.Query["token"].ToString()); + + var a = EnumAttribute.GetVsS(typeof(loginins)); + + //if (Requesttoken == loginins.school) + //{ + + //} + ctx.Request.Url.Query = Learun.Util.WebHelper.Formatstr(ctx.Request.Url.Query); + foreach (var p in ctx.Parameters) + { + if (p.ParameterType == typeof(string)) + { + if (ctx.Parameters[p.ParameterName] != null) + { + ctx.Parameters[p.ParameterName] = Learun.Util.WebHelper.Formatstr(ctx.Parameters[p.ParameterName].ToString()); + } + } + } + string path = ctx.ResolvedRoute.Description.Path; + //验证登录状态 + ReqParameter req = this.Bind(); + loginMark = req.loginMark; + token = req.token; + if (path == "/learun/adms/user/login" || path == "/learun/adms/user/loginbyIdCard" || path == "/" || path == "/bgimg" || path == "/learun/adms/user/img" || path == "/learun/adms/desktop/img" || path == "/learun/adms/user/imgfordc" || path == "/learun/adms/timetable/timeTableData" || path == "/quanjiang/sso/authorize" || path == "/learun/nologin/adms/annexes/upload" || path == "/learun/adms/annexes/wxlist" || path == "/learun/visitmanage/save" || path == "/learun/visitmanage/getweixinaccess_token") + {// 登录接口,默认页面接口不做权限验证处理 + return null; + } + + OperatorResult res = OperatorHelper.Instance.IsOnLine(req.token, req.loginMark); + if (res.stateCode == -1) + { + return this.FailNoLogin("未找到登录信息"); + } + if (res.stateCode == 0) + { + return this.FailNoLogin("登录信息已过期"); + } + else + { + // 获取登录者信息 + userInfo = res.userInfo; + } + return null; + } + #endregion + + } +} \ No newline at end of file diff --git a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/TransferApi.cs b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/TransferApi.cs index c05bc3d76..29cd5b37a 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/TransferApi.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/TransferApi.cs @@ -462,7 +462,11 @@ namespace Learun.Application.WebApi public string PersonPicturePath { get; set; } } - + public enum loginins + { + school, + CODE, + } #endregion } diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Util/Learun.Util/Attributes/EnumAttribute.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Util/Learun.Util/Attributes/EnumAttribute.cs index 3b53557b6..bf4f4bc97 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Util/Learun.Util/Attributes/EnumAttribute.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Util/Learun.Util/Attributes/EnumAttribute.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.ComponentModel; using System.Reflection; @@ -40,5 +41,23 @@ namespace Learun.Util } return null; } + + /// + /// 返回枚举项的描述信息。 + /// + /// 要获取描述信息的枚举项。 + /// 枚举想的描述信息。 + public static List GetVsS(Type value) + { + var ls = new List(); + var vs = Enum.GetValues(value); + foreach (var item in vs) + { + ls.Add(item.ToString()); + } + + return ls; + + } } }