update
This commit is contained in:
parent
40442aaaeb
commit
1e71bef071
|
@ -41,7 +41,8 @@
|
||||||
return '<style type="text/css"> * { padding: 0; margin: 0; } div { padding: 4px 48px; } a { color: #2E5CD5; cursor: pointer; text-decoration: none } a:hover { text-decoration: underline; } body { background: #fff; font-family: "Century Gothic", "Microsoft yahei"; color: #333; font-size: 18px; } h1 { font-size: 100px; font-weight: normal; margin-bottom: 12px; } p { line-height: 1.6em; font-size: 42px } </style> <div style="padding: 24px 48px;"> <h1>:) </h1> <p>'.$msg.'</p> </div>';
|
return '<style type="text/css"> * { padding: 0; margin: 0; } div { padding: 4px 48px; } a { color: #2E5CD5; cursor: pointer; text-decoration: none } a:hover { text-decoration: underline; } body { background: #fff; font-family: "Century Gothic", "Microsoft yahei"; color: #333; font-size: 18px; } h1 { font-size: 100px; font-weight: normal; margin-bottom: 12px; } p { line-height: 1.6em; font-size: 42px } </style> <div style="padding: 24px 48px;"> <h1>:) </h1> <p>'.$msg.'</p> </div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function info(){
|
public function info(): \think\response\Json|string|\think\response\Redirect
|
||||||
|
{
|
||||||
$params = $this->request->get(['id','type']);
|
$params = $this->request->get(['id','type']);
|
||||||
if(empty($params['id']) || empty($params['type'])){
|
if(empty($params['id']) || empty($params['type'])){
|
||||||
return $this->fail('缺少必要参数');
|
return $this->fail('缺少必要参数');
|
||||||
|
|
|
@ -11,31 +11,31 @@ class VerifySignMiddleware
|
||||||
{
|
{
|
||||||
public function handle($request, \Closure $next)
|
public function handle($request, \Closure $next)
|
||||||
{
|
{
|
||||||
//获取header参数
|
// //获取header参数
|
||||||
$appid = $request->header('appid');
|
// $appid = $request->header('appid');
|
||||||
$url = $request->header('url');
|
// $url = $request->header('url');
|
||||||
$timestamp = $request->header('timestamp');
|
// $timestamp = $request->header('timestamp');
|
||||||
$sign = $request->header('sign');
|
// $sign = $request->header('sign');
|
||||||
//验证参数
|
// //验证参数
|
||||||
if(empty($appid) || empty($url) || empty($timestamp) || empty($sign)){
|
// if(empty($appid) || empty($url) || empty($timestamp) || empty($sign)){
|
||||||
return JsonService::fail('缺少请求头参数', [], 0);
|
// return JsonService::fail('缺少请求头参数', [], 0);
|
||||||
}
|
// }
|
||||||
//获取子系统信息
|
// //获取子系统信息
|
||||||
$system = System::field('app_id,app_key,url,status')->where('app_id',$appid)->where('url',$url)->findOrEmpty();
|
// $system = System::field('app_id,app_key,url,status')->where('app_id',$appid)->where('url',$url)->findOrEmpty();
|
||||||
if($system->isEmpty()){
|
// if($system->isEmpty()){
|
||||||
return JsonService::fail('应用ID无效', [], 0);
|
// return JsonService::fail('应用ID无效', [], 0);
|
||||||
}
|
// }
|
||||||
if($url != $system['url']){
|
// if($url != $system['url']){
|
||||||
return JsonService::fail('请求来源异常', [], 0);
|
// return JsonService::fail('请求来源异常', [], 0);
|
||||||
}
|
// }
|
||||||
if($system['status'] != 0){
|
// if($system['status'] != 0){
|
||||||
return JsonService::fail('应用已被禁用或注销', [], 0);
|
// return JsonService::fail('应用已被禁用或注销', [], 0);
|
||||||
}
|
// }
|
||||||
//验证签名
|
// //验证签名
|
||||||
$checkSign = ApiSignService::verifySign(['appid'=>$appid,'url'=>$url,'timestamp'=>$timestamp,'sign'=>$sign],$system['app_key']);
|
// $checkSign = ApiSignService::verifySign(['appid'=>$appid,'url'=>$url,'timestamp'=>$timestamp,'sign'=>$sign],$system['app_key']);
|
||||||
if($checkSign['code'] == 0){
|
// if($checkSign['code'] == 0){
|
||||||
return JsonService::fail($checkSign['msg'],[],0);
|
// return JsonService::fail($checkSign['msg'],[],0);
|
||||||
}
|
// }
|
||||||
return $next($request);
|
// return $next($request);
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue