Commit 312e27fa by 刘春刚

checkSign

parent 3ed49d75
...@@ -23,7 +23,10 @@ class CheckSign ...@@ -23,7 +23,10 @@ class CheckSign
$params = $request->all(); $params = $request->all();
// $secretKey = config('api.sign.secret_key');
//
// $dealSign = md5('secret='.$secretKey.'&t='.$params['t']);
// var_dump($dealSign);
if (isset($params['debug_http']) && $params['debug_http'] == 911){ if (isset($params['debug_http']) && $params['debug_http'] == 911){
return $next($request); return $next($request);
...@@ -44,17 +47,17 @@ class CheckSign ...@@ -44,17 +47,17 @@ class CheckSign
return Response()->json(['code' => Constants::PARAMETER_ERROR, 'msg' => '参数错误,时间戳已过期!', 'params' => $params]); return Response()->json(['code' => Constants::PARAMETER_ERROR, 'msg' => '参数错误,时间戳已过期!', 'params' => $params]);
} }
$secretKey = config('api.sign.check_sign');
$secretKey = config('api.sign.secret_key');
if(empty($secretKey)){ if(empty($secretKey)){
return Response()->json(['code' => Constants::PARAMETER_ERROR, 'msg' => '参数错误,后台密钥丢失', 'params' => $params]); return Response()->json(['code' => Constants::PARAMETER_ERROR, 'msg' => '参数错误,后台密钥丢失', 'params' => $params]);
} }
$dealSign = md5('secret='.$secretKey.'&t='.$params['t']); $dealSign = md5('secret='.$secretKey.'&t='.$params['t']);
// var_dump($dealSign);exit();
if($dealSign != $params['sign']){ if($dealSign != $params['sign']){
return Response()->json(['code' => Constants::PARAMETER_ERROR, 'msg' => '签名错误', 'params' => $params]); return Response()->json(['code' => Constants::PARAMETER_ERROR, 'msg' => '签名错误', 'params' => $params]);
} }
return $next($request); return $next($request);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment