diff --git a/Learun.Framework.Ultimate V7/Doc文档/数字化智慧校园基础信息接口V1.0.docx b/Learun.Framework.Ultimate V7/Doc文档/数字化智慧校园基础信息接口V1.0.docx
index 8d7eaece8..b9d605afb 100644
--- a/Learun.Framework.Ultimate V7/Doc文档/数字化智慧校园基础信息接口V1.0.docx
+++ b/Learun.Framework.Ultimate V7/Doc文档/数字化智慧校园基础信息接口V1.0.docx
@@ -15,7 +15,7 @@ V1.0
调用方式:
-标准http get请求
+标准http get请求,数据接口需要在header中传参 token,否则无数据返回。
返回数据类型:
标准json
返回数据结构
@@ -34,8 +34,24 @@ data
业务数据(object)
业务数据
+获取TOKEN
+地址:http://部署地址/arrangelessonlogin/gettoken?sysid=1 sysid向管理员获取
+ 属性
+ 返回值
+ 备注
+code
+200(int)
+200成功 其余失败
+info
+响应成功(string)
+状态描述
+data
+业务数据(object)
+业务数据
+
+
部门接口
-地址:http://部署地址/arrangelesson/department
+地址:http://部署地址/arrangelessonlogin/department
主要业务数据 其余字段可忽略
属性
返回值
@@ -71,7 +87,7 @@ F_OuterPhone
教师信息接口
-地址:http://部署地址/arrangelesson/allteacher
+地址:http://部署地址/arrangelessonlogin/allteacher
主要业务数据 其余字段可忽略
属性
返回值
@@ -108,7 +124,7 @@ mobile
学生信息接口
-地址:http://部署地址/arrangelesson/allstudent
+地址:http://部署地址/arrangelessonlogin/allstudent
主要业务数据 其余字段可忽略
属性
返回值
@@ -164,7 +180,7 @@ ClassNo
系部接口
-地址:http://部署地址/arrangelesson/alldept
+地址:http://部署地址/arrangelessonlogin/alldept
主要业务数据 其余字段可忽略
属性
返回值
@@ -184,7 +200,7 @@ DeptName
否
专业接口
-地址:http://部署地址/arrangelesson/allmajor
+地址:http://部署地址/arrangelessonlogin/allmajor
主要业务数据 其余字段可忽略
属性
返回值
@@ -207,7 +223,7 @@ DeptNo
校区接口
-地址:http://部署地址/arrangelesson/allschool
+地址:http://部署地址/arrangelessonlogin/allschool
主要业务数据 其余字段可忽略
属性
返回值
@@ -223,7 +239,7 @@ F_FullName
否
班级接口
-地址:http://部署地址/arrangelesson/allclass
+地址:http://部署地址/arrangelessonlogin/allclass
主要业务数据 其余字段可忽略
属性
返回值
@@ -255,7 +271,7 @@ Grade
用户接口
-地址:http://部署地址/arrangelesson/alluser
+地址:http://部署地址/arrangelessonlogin/alluser
主要业务数据 其余字段可忽略
属性
返回值
@@ -292,7 +308,7 @@ Year
课程接口
-地址:http://部署地址/arrangelesson/alllesson
+地址:http://部署地址/arrangelessonlogin/alllesson
主要业务数据 其余字段可忽略
属性
返回值
@@ -323,7 +339,7 @@ F_SchoolId
必修开课计划接口
-地址:http://部署地址/arrangelesson/allclasslesson
+地址:http://部署地址/arrangelessonlogin/allclasslesson
所需参数:AcademicYearNo=19-20&Semester=1
参数名称
值
@@ -381,7 +397,7 @@ LessonTime
学生选修选课接口
-地址:http://部署地址/arrangelesson/allelelectivelesson
+地址:http://部署地址/arrangelessonlogin/allelelectivelesson
所需参数:AcademicYearNo=19-20&Semester=1
参数名称
值
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 dfb9b4671..80e571ae9 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
@@ -311,6 +311,7 @@
+
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/Arrangelesson.cs b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/Arrangelesson.cs
index fecee5d5c..3fbc201df 100644
--- a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/Arrangelesson.cs
+++ b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/Arrangelesson.cs
@@ -8,7 +8,7 @@ using Nancy;
namespace Learun.Application.WebApi.Modules
{
- public class Arrangelesson : BaseNoAuthentication
+ public class Arrangelesson : BaseApi
{
public Arrangelesson()
: base("/arrangelesson/")
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/ArrangelessonLogin.cs b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/ArrangelessonLogin.cs
index 17fa6e943..60b8aac39 100644
--- a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/ArrangelessonLogin.cs
+++ b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/ArrangelessonLogin.cs
@@ -4,7 +4,9 @@ using System.Linq;
using System.Web;
using Learun.Application.Organization;
using Learun.Application.TwoDevelopment.EducationalAdministration;
+using Learun.Util;
using Nancy;
+using static Learun.Application.WebApi.Until.MyEnum;
namespace Learun.Application.WebApi.Modules
{
@@ -13,6 +15,7 @@ namespace Learun.Application.WebApi.Modules
public ArrangelessonLogin()
: base("/arrangelessonlogin/")
{
+ Get["/gettoken"] = GetToken;
Get["/lessontype"] = GetLessonTypes;
Get["/classtype"] = GetClassType;
Get["/student"] = GetStudents;
@@ -71,6 +74,14 @@ namespace Learun.Application.WebApi.Modules
private StuSelectLessonListOfElectiveIBLL stuSelectLessonListOfElectiveIbll =
new StuSelectLessonListOfElectiveBLL();
+ private Response GetToken(dynamic _)
+ {
+ string sid = Request.Query["sysid"];
+ var sys = EnumAttribute.GetVal(typeof(ThrSys), sid.ToInt());
+ if (sys.IsEmpty()) return Fail("参数错误!");
+ var token=DESEncrypt.Encrypt(sys);
+ return Success(token);
+ }
private Response TranTest(dynamic _)
{
return Success("ok");
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/BaseNoAuthenticationNoLogin.cs b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/BaseNoAuthenticationNoLogin.cs
index 4dc1d7185..7bd9cf331 100644
--- a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/BaseNoAuthenticationNoLogin.cs
+++ b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/BaseNoAuthenticationNoLogin.cs
@@ -5,7 +5,8 @@ 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;
+using System.Linq;
+using static Learun.Application.WebApi.Until.MyEnum;
namespace Learun.Application.WebApi
{
@@ -96,7 +97,7 @@ namespace Learun.Application.WebApi
///
public Response Success(string info)
{
- ResParameter res = new ResParameter { code = ResponseCode.success, info = info, data = new object { } };
+ ResParameter res = new ResParameter { code = ResponseCode.success, info = "响应成功", data = info };
return Response.AsText(res.ToJson()).WithContentType("application/json");
}
///
@@ -226,10 +227,6 @@ namespace Learun.Application.WebApi
#endregion
#region 权限验证
- public UserInfo userInfo;
- public string loginMark;
- public string token;
-
///
/// 前置拦截器
@@ -238,50 +235,20 @@ namespace Learun.Application.WebApi
///
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")
- {// 登录接口,默认页面接口不做权限验证处理
+ if (path == "/arrangelessonlogin/gettoken")
+ {// token接口,默认页面接口不做权限验证处理
return null;
}
+ var rToken = ctx.Request.Headers["token"].FirstOrDefault();
+ if(rToken.IsEmpty()) return this.FailNoLogin("权限校验失败!");
- 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;
- }
+ var tss = EnumAttribute.GetVsS(typeof(ThrSys));
+
+ var Requesttoken = DESEncrypt.Decrypt(rToken);
+ if(!tss.Contains(Requesttoken)) return this.FailNoLogin("权限校验失败!!");
+
+
return null;
}
#endregion
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 29cd5b37a..afddb2c46 100644
--- a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/TransferApi.cs
+++ b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/TransferApi.cs
@@ -462,11 +462,7 @@ namespace Learun.Application.WebApi
public string PersonPicturePath { get; set; }
}
- public enum loginins
- {
- school,
- CODE,
- }
+
#endregion
}
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Until/MyEnum.cs b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Until/MyEnum.cs
new file mode 100644
index 000000000..c46e0bf5a
--- /dev/null
+++ b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Until/MyEnum.cs
@@ -0,0 +1,21 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Learun.Application.WebApi.Until
+{
+ public class MyEnum
+ {
+
+ public enum ThrSys
+ {
+ [Description("超星")]
+ ChaoXin=31233
+ }
+
+
+ }
+}
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 bf4f4bc97..5017ee9c0 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
@@ -42,6 +42,19 @@ namespace Learun.Util
return null;
}
+ public static string GetVal(Type enumType,int value)
+ {
+ try
+ {
+ var name = enumType.GetEnumName(value);
+ return name;
+ }
+ catch (Exception e)
+ {
+ return "";
+ }
+ }
+
///
/// 返回枚举项的描述信息。
///