Browse Source

接口增加权限验证

西昌分支
dao 2 months ago
parent
commit
40d6e5edca
5 changed files with 19 additions and 18 deletions
  1. +1
    -4
      Learun.Framework.Ultimate V7/Learun.Application.WebApi/Learun.Application.WebApi.csproj
  2. +12
    -2
      Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/Arrangelesson.cs
  3. +2
    -10
      Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/ArrangelessonLogin.cs
  4. +1
    -1
      Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/BaseNoAuthenticationNoLogin.cs
  5. +3
    -1
      Learun.Framework.Ultimate V7/Learun.Application.WebApi/Until/MyEnum.cs

+ 1
- 4
Learun.Framework.Ultimate V7/Learun.Application.WebApi/Learun.Application.WebApi.csproj View File

@@ -194,10 +194,6 @@
<Compile Include="Modules\ArrangelessonLogin.cs" />
<Compile Include="Modules\BaseNoAuthenticationNoLogin.cs" />
<Compile Include="Modules\UsernologinApi.cs" />
<Compile Include="Modules\VisitmanageApi.cs" />
<Compile Include="Modules\LessonInfoOfElectiveOnlineApi.cs" />
<Compile Include="Modules\RepairReport\RepairReportTeacherApi.cs" />
<Compile Include="Modules\RepairReport\RepairReportStudentApi.cs" />
<Compile Include="Modules\EducationalAdministration\ArrangeExamTermApi.cs" />
<Compile Include="Modules\EducationalAdministration\ArrangeExamTermNewApi.cs" />
<Compile Include="Modules\FunctionApi.cs" />
@@ -378,6 +374,7 @@
<ItemGroup>
<Folder Include="App_Data\" />
<Folder Include="Models\" />
<Folder Include="Modules\RepairReport\" />
</ItemGroup>
<ItemGroup>
<Analyzer Include="..\packages\Microsoft.DependencyValidation.Analyzers.0.10.0\analyzers\dotnet\cs\Microsoft.DependencyValidation.Analyzers.resources.dll" />


+ 12
- 2
Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/Arrangelesson.cs View File

@@ -6,15 +6,18 @@ using System.Web;
using Learun.Application.Base.SystemModule;
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
{
public class Arrangelesson : BaseApi
public class Arrangelesson : BaseNoAuthenticationNoLogin
{
public Arrangelesson()
: base("/arrangelesson/")
{
Get["/gettoken"] = GetToken;
Get["/lessontype"] = GetLessonTypes;
Get["/classtype"] = GetClassType;
Get["/student"] = GetStudents;
@@ -82,7 +85,14 @@ namespace Learun.Application.WebApi.Modules
{
return Success("ok");
}

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 GetAllLesson(dynamic _)
{
var result = lessonInfoIbll.GetAllLesson();


+ 2
- 10
Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/ArrangelessonLogin.cs View File

@@ -10,12 +10,11 @@ using static Learun.Application.WebApi.Until.MyEnum;

namespace Learun.Application.WebApi.Modules
{
public class ArrangelessonLogin : BaseNoAuthenticationNoLogin
public class ArrangelessonLogin : BaseApi
{
public ArrangelessonLogin()
: base("/arrangelessonlogin/")
{
Get["/gettoken"] = GetToken;
Get["/lessontype"] = GetLessonTypes;
Get["/classtype"] = GetClassType;
Get["/student"] = GetStudents;
@@ -74,14 +73,7 @@ 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");


+ 1
- 1
Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/BaseNoAuthenticationNoLogin.cs View File

@@ -236,7 +236,7 @@ namespace Learun.Application.WebApi
private Response BeforeRequest(NancyContext ctx)
{
string path = ctx.ResolvedRoute.Description.Path;
if (path == "/arrangelessonlogin/gettoken")
if (path == "/arrangelesson/gettoken")
{// token接口,默认页面接口不做权限验证处理
return null;
}


+ 3
- 1
Learun.Framework.Ultimate V7/Learun.Application.WebApi/Until/MyEnum.cs View File

@@ -13,7 +13,9 @@ namespace Learun.Application.WebApi.Until
public enum ThrSys
{
[Description("超星")]
ChaoXin=31233
ChaoXin=31233,
[Description("正方")]
ZhengFang = 31234
}




Loading…
Cancel
Save