REAPI/app/gateway/route/index.php
24a4b60517 refactor(gateway): 重构 v4 版本接口签名验证逻辑
- 在 AuthService 中添加对 sign 和 signature 参数的处理
- 更新 Core 控制器中的签名验证逻辑
- 新增 Goods 控制器,实现商品列表查询功能
- 修改 Handle 控制器的日志记录逻辑
- 优化 JunKa、Lingshi 等渠道服务类的实现
- 更新 MerchantService 中的回调处理逻辑
-调整 OrderService 中的订单查询和更新逻辑
- 新增 Qiling 和 Reapi 渠道服务类
2025-04-17 17:21:00 +08:00

63 lines
1.3 KiB
PHP

<?php
use think\exception\HttpResponseException;
app()->route->get('api/open/code1','gateway/api.card/add');
$version = request()->post('version');
//var_dump($version);die;
if(!$version){
$version = request()->param('version');
}
//默认跳转到v1版本
if ($version == null) $version = "api";#api.notify,url
if (str_contains($version, '.')) {
$version = explode('.', $version);
if($version[1] == '0'){
$version = $version[0];
}else{
$version = $version[0].'_'.$version[1];
}
}
$pathInfo = request()->pathinfo();
if ($pathInfo == null) {
$json = [
'code' => -802,
'data'=>'',
'msg' =>'请求错误'
];
throw new HttpResponseException(json($json));
}
if($version!='api'){
if(!str_contains($pathInfo, 'api.')){
if(str_contains($version, '.')){
$versions = str_replace(".", "", $version);
#支持小版本的更新
app()->route->rule(':controller/:function', $versions . '.:controller/:function');
}else{
app()->route->rule(':controller/:function', $version . '.:controller/:function');
}
}
}else{
if(!str_contains($pathInfo, 'api.')){
app()->route->rule(':controller/:function', 'api' . '.:controller/:function');
}
}