116 lines
3.9 KiB
C#
116 lines
3.9 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Runtime.CompilerServices;
|
|
using Microsoft.CSharp.RuntimeBinder;
|
|
using Nancy;
|
|
using Nancy.ModelBinding;
|
|
using Newtonsoft.Json;
|
|
|
|
namespace HxBusiness
|
|
{
|
|
// Token: 0x02000002 RID: 2
|
|
public class APIContainer : NancyModule
|
|
{
|
|
// Token: 0x06000001 RID: 1 RVA: 0x00002050 File Offset: 0x00000250
|
|
public APIContainer()
|
|
{
|
|
Dictionary<int, string> dictionary = new Dictionary<int, string>();
|
|
this.Get("api/get", delegate(dynamic parameters)
|
|
{
|
|
if (APIContainer.<>o__0.<>p__0 == null)
|
|
{
|
|
APIContainer.<>o__0.<>p__0 = CallSite<Func<CallSite, APIContainer, object, object>>.Create(Binder.InvokeMember(CSharpBinderFlags.InvokeSimpleName, "GetStr", null, typeof(APIContainer), new CSharpArgumentInfo[]
|
|
{
|
|
CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.UseCompileTimeType, null),
|
|
CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null)
|
|
}));
|
|
}
|
|
return APIContainer.<>o__0.<>p__0.Target(APIContainer.<>o__0.<>p__0, this, parameters);
|
|
}, null, null);
|
|
this.Post("api/sendpermission", delegate(dynamic parameters)
|
|
{
|
|
if (APIContainer.<>o__0.<>p__1 == null)
|
|
{
|
|
APIContainer.<>o__0.<>p__1 = CallSite<Func<CallSite, APIContainer, object, object>>.Create(Binder.InvokeMember(CSharpBinderFlags.InvokeSimpleName, "UpdateTraffic", null, typeof(APIContainer), new CSharpArgumentInfo[]
|
|
{
|
|
CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.UseCompileTimeType, null),
|
|
CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null)
|
|
}));
|
|
}
|
|
return APIContainer.<>o__0.<>p__1.Target(APIContainer.<>o__0.<>p__1, this, parameters);
|
|
}, null, null);
|
|
}
|
|
|
|
// Token: 0x06000002 RID: 2 RVA: 0x000020A0 File Offset: 0x000002A0
|
|
private object GetStr(dynamic o)
|
|
{
|
|
object result;
|
|
try
|
|
{
|
|
if (APIContainer.<>o__1.<>p__1 == null)
|
|
{
|
|
APIContainer.<>o__1.<>p__1 = CallSite<Func<CallSite, object, string>>.Create(Binder.Convert(CSharpBinderFlags.None, typeof(string), typeof(APIContainer)));
|
|
}
|
|
Func<CallSite, object, string> target = APIContainer.<>o__1.<>p__1.Target;
|
|
CallSite <>p__ = APIContainer.<>o__1.<>p__1;
|
|
if (APIContainer.<>o__1.<>p__0 == null)
|
|
{
|
|
APIContainer.<>o__1.<>p__0 = CallSite<Func<CallSite, object, string, object>>.Create(Binder.GetIndex(CSharpBinderFlags.None, typeof(APIContainer), new CSharpArgumentInfo[]
|
|
{
|
|
CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null),
|
|
CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.UseCompileTimeType | CSharpArgumentInfoFlags.Constant, null)
|
|
}));
|
|
}
|
|
string str = target(<>p__, APIContainer.<>o__1.<>p__0.Target(APIContainer.<>o__1.<>p__0, this.Request.Query, "id"));
|
|
result = "test Api" + str;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
result = ex.ToString();
|
|
}
|
|
return result;
|
|
}
|
|
|
|
// Token: 0x06000003 RID: 3 RVA: 0x0000217C File Offset: 0x0000037C
|
|
private object UpdateTraffic(dynamic o)
|
|
{
|
|
ResponseModel responseModel = new ResponseModel();
|
|
try
|
|
{
|
|
string[] array = new string[]
|
|
{
|
|
"280",
|
|
"282"
|
|
};
|
|
SendModel sendModel = this.Bind<SendModel>();
|
|
string str = JsonConvert.SerializeObject(sendModel);
|
|
WriteTxt.SaveLog1("接收到授权请求!" + str, "api日志", "插件日志");
|
|
bool flag = sendModel.interchangePointCode.Equals(array[0]) || sendModel.interchangePointCode.Equals(array[1]);
|
|
if (flag)
|
|
{
|
|
responseModel.code = 0;
|
|
responseModel.msg = "成功";
|
|
responseModel.data = "";
|
|
}
|
|
else
|
|
{
|
|
responseModel.code = -2;
|
|
responseModel.msg = "交汇点地标不存在!";
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
responseModel.code = -1;
|
|
responseModel.data = "服务器错误:" + ex.ToString();
|
|
}
|
|
return JsonConvert.SerializeObject(responseModel);
|
|
}
|
|
|
|
// Token: 0x06000004 RID: 4 RVA: 0x00002278 File Offset: 0x00000478
|
|
public object Root(dynamic o)
|
|
{
|
|
return null;
|
|
}
|
|
}
|
|
}
|