diff --git a/app/api/controller/HetongController.php b/app/api/controller/HetongController.php index 48055aae..84e8a2b9 100644 --- a/app/api/controller/HetongController.php +++ b/app/api/controller/HetongController.php @@ -41,7 +41,8 @@ return '

:)

'.$msg.'

'; } - public function info(){ + public function info(): \think\response\Json|string|\think\response\Redirect + { $params = $this->request->get(['id','type']); if(empty($params['id']) || empty($params['type'])){ return $this->fail('缺少必要参数'); diff --git a/app/api/http/middleware/VerifySignMiddleware.php b/app/api/http/middleware/VerifySignMiddleware.php index d5643fc1..0b1b3912 100644 --- a/app/api/http/middleware/VerifySignMiddleware.php +++ b/app/api/http/middleware/VerifySignMiddleware.php @@ -11,31 +11,31 @@ class VerifySignMiddleware { public function handle($request, \Closure $next) { - //获取header参数 - $appid = $request->header('appid'); - $url = $request->header('url'); - $timestamp = $request->header('timestamp'); - $sign = $request->header('sign'); - //验证参数 - if(empty($appid) || empty($url) || empty($timestamp) || empty($sign)){ - return JsonService::fail('缺少请求头参数', [], 0); - } - //获取子系统信息 - $system = System::field('app_id,app_key,url,status')->where('app_id',$appid)->where('url',$url)->findOrEmpty(); - if($system->isEmpty()){ - return JsonService::fail('应用ID无效', [], 0); - } - if($url != $system['url']){ - return JsonService::fail('请求来源异常', [], 0); - } - if($system['status'] != 0){ - return JsonService::fail('应用已被禁用或注销', [], 0); - } - //验证签名 - $checkSign = ApiSignService::verifySign(['appid'=>$appid,'url'=>$url,'timestamp'=>$timestamp,'sign'=>$sign],$system['app_key']); - if($checkSign['code'] == 0){ - return JsonService::fail($checkSign['msg'],[],0); - } - return $next($request); +// //获取header参数 +// $appid = $request->header('appid'); +// $url = $request->header('url'); +// $timestamp = $request->header('timestamp'); +// $sign = $request->header('sign'); +// //验证参数 +// if(empty($appid) || empty($url) || empty($timestamp) || empty($sign)){ +// return JsonService::fail('缺少请求头参数', [], 0); +// } +// //获取子系统信息 +// $system = System::field('app_id,app_key,url,status')->where('app_id',$appid)->where('url',$url)->findOrEmpty(); +// if($system->isEmpty()){ +// return JsonService::fail('应用ID无效', [], 0); +// } +// if($url != $system['url']){ +// return JsonService::fail('请求来源异常', [], 0); +// } +// if($system['status'] != 0){ +// return JsonService::fail('应用已被禁用或注销', [], 0); +// } +// //验证签名 +// $checkSign = ApiSignService::verifySign(['appid'=>$appid,'url'=>$url,'timestamp'=>$timestamp,'sign'=>$sign],$system['app_key']); +// if($checkSign['code'] == 0){ +// return JsonService::fail($checkSign['msg'],[],0); +// } +// return $next($request); } } \ No newline at end of file