首页 > 其他分享 >路由

路由

时间:2024-01-25 11:13:34浏览次数:28  
标签:TRESTdanwei funcname classname router POST method 路由

路由

api.router.pas

/// <author>2024-1-25</author>
unit api.router;

interface

uses
  global, net.CrossHttpServer, yn.log, Classes, StrUtils, SysUtils;

type
  TMyProc = procedure(req: TRequest; res: TResponse) of object;

procedure router(const className, funcName: string; req: TRequest; res: TResponse);   /// 路由

implementation

procedure router(const className, funcName: string; req: TRequest; res: TResponse);
var
  m: TMethod;
  f: TMyProc;
  p: TPersistentClass;
begin
  try
    p := FindClass(className);
    if p = nil then
      exit;
    m.Data := Pointer(p);
    m.Code := p.MethodAddress(funcName);
    if Assigned(m.Code) then
    begin
      f := TMyProc(m);
      f(req, res);
    end;
  except
    on E: Exception do
    begin
      WriteLog('api.router.router()' + E.Message);
    end;
  end;
end;

end.

  router.json

{
	"tables":
	[
		{
			"classname":"TRESTtables",
			"method":"POST",
			"funcname":"select"
		}
	],
	"danwei":
	[
		{
			"classname":"TRESTdanwei",
			"method":"POST",
			"funcname":"select"
		},
		{
			"classname":"TRESTdanwei",
			"method":"POST",
			"funcname":"select2"
		},
		{
			"classname":"TRESTdanwei",
			"method":"POST",
			"funcname":"insert"
		},
		{
			"classname":"TRESTdanwei",
			"method":"POST",
			"funcname":"update"
		},
		{
			"classname":"TRESTdanwei",
			"method":"POST",
			"funcname":"delete"
		}
	],
	"multipart":
	[
		{
			"classname":"TRESTmultipart",
			"method":"POST",
			"funcname":"downfile"
		},
		{
			"classname":"TRESTmultipart",
			"method":"POST",
			"funcname":"upfile"
		}
	],
	"bin":
	[
		{
			"classname":"TBINolev",
			"method":"POST",
			"funcname":"select"
		},
		{
			"classname":"TBINolev",
			"method":"POST",
			"funcname":"execsql"
		},
		{
			"classname":"TBINolev",
			"method":"POST",
			"funcname":"save"
		},
		{
			"classname":"TBINolev",
			"method":"POST",
			"funcname":"spopen"
		}
	],
	"binfile":
	[
		{
			"classname":"TBINfiletran",
			"method":"POST",
			"funcname":"upfile"
		},
		{
			"classname":"TBINfiletran",
			"method":"POST",
			"funcname":"downfile"
		}
	]
}

  

标签:TRESTdanwei,funcname,classname,router,POST,method,路由
From: https://www.cnblogs.com/hnxxcxg/p/17986721

相关文章

  • 静态路由基本配置
    拓扑:配置:查看代码[R1]discurrent-configuration[V200R003C00]#sysnameR1#boardadd0/12SA#snmp-agentlocal-engineid800007DB03000000000000snmp-agent#clocktimezoneChina-Standard-Timeminus08:00:00#portallocal-serverloadportalpage.......
  • gin框架路由讲解
     点击关注......
  • angular 16 路由守卫更新
    在angular16中守卫使用方式进行了更新,route守卫被弃用(取消了CanActivate的使用),新增了功能性守卫(CanActivateFn),支持inject注入,官网提供了一个新的类型exportdeclaretypeCanDeactivateFn<T>=(component:T,currentRoute:ActivatedRouteSnapshot,currentState:Route......
  • thinkphp 资源路由
    资源路由usethink\facade\Route;//资源路由thinkphp提供了一个命令方便开发者快速生成一个资源控制器//执行phpthinkmake:controllerBlogBlog是控制器类文件名字//标识index类型get路由blog//标识create类型get路由blog/create//标识save类型......
  • thinkphp 路由分组 url生成
    路由分组route/app.php//路由分组相同规则的路由方一起分组//Route::group('blog',function(){//Route::rule(':id','blog/index');//Route::rule('index','blog/login');//});//或者//Route::group(function(){/......
  • 重写SpringCloudGateway路由查找算法,性能提升100倍!
    如果你也在做SpringCloudGateway网关开发,希望这篇文章能给你带来一些启发背景先说背景,某油项目,通过SpringCloudGateway配置了1.6万个路由规则,实际接口调用过程中,会偶现部分接口从发起请求到业务应用处理间隔了大概5秒的时间,经排查后发现是SpringCloudGateway底层在查找对应的R......
  • thinkphp 路由参数 域名 miss设置
    路由的使用在route/app.php文件里设置路由usethink\facade\Route;//rule()//还有其他的快捷方式Route::GETPOSTPUTDELETEPATCHHEADOPTIONSANY//Route::rule('index/:id','Login/index','GET|POST')->https();//Route::get('index/:......
  • TPLINK路由器重启脚本(软件版本3.0.0)
    ​ 家中的两个路由器全都是TPLink路由器,由于总出现时间一长就网卡的原因,写了这个重启脚本在每天凌晨五点的时候对路由器进行自动重启使用方法:​ self.logindata的值为登录时的json数据​ 打开F12控制台,复制登陆的json数据包并填入self.logindataimportrequestsfromdatet......
  • 华为二层交换机与路由器对接上网配置实验
    二层交换机与路由器对接上网配置示例组网图形图1二层交换机与路由器对接上网组网图二层交换机简介配置注意事项组网需求配置思路操作步骤配置文件相关信息二层交换机简介二层交换机指的是仅能够进行二层转发,不能进行三层转发的交换机。也就是说仅支持二层特性,不支持......
  • 华为三层交换机与路由器配置上网示例——学会这个,你就是IT界大佬
    特性配置案例适用的产品和版本说明本手册适用于通过命令行配置的框式交换机和盒式交换机(S300、S500、S2700、S3700、S5700、S6700、S7700、S7900、S9700共用一套)的多个版本,每个案例所支持的产品和版本不同,每个案例适用产品和版本请参看具体页面中的“配置注意事项”。若无特殊说明,......