Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
media-api
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
刘春刚
media-api
Commits
312e27fa
Commit
312e27fa
authored
Apr 01, 2020
by
刘春刚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
checkSign
parent
3ed49d75
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
3 deletions
+6
-3
CheckSign.php
app/Http/Middleware/CheckSign.php
+6
-3
No files found.
app/Http/Middleware/CheckSign.php
View file @
312e27fa
...
@@ -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
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment