Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
H
hilo-group
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
hujiebin
hilo-group
Commits
469ec7ae
Commit
469ec7ae
authored
Jun 25, 2023
by
hujiebin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feature/encrypt
parent
6e2e4198
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
0 deletions
+12
-0
middleHandle.go
route/middleHandle.go
+11
-0
router.go
route/router.go
+1
-0
No files found.
route/middleHandle.go
View file @
469ec7ae
...
...
@@ -5,6 +5,7 @@ import (
"git.hilo.cn/hilo-common/mycontext"
"git.hilo.cn/hilo-common/mylogrus"
"git.hilo.cn/hilo-common/resource/config"
"git.hilo.cn/hilo-common/utils"
"github.com/gin-gonic/gin"
"hilo-group/myerr/bizerr"
"hilo-group/req"
...
...
@@ -133,3 +134,13 @@ func LoggerHandle(c *gin.Context) {
latency
:=
end
.
Sub
(
start
)
mycontext
.
CreateMyContext
(
c
.
Keys
)
.
Log
.
Infof
(
"request end fullPath:%v,url:%v, method: %v, traceId:%v, latency:%v userId:%v"
,
c
.
FullPath
(),
reqUri
,
method
,
traceId
,
latency
,
userId
)
}
// 加密Handle
func
EncryptHandle
(
c
*
gin
.
Context
)
{
if
value
,
ok
:=
c
.
Get
(
mycontext
.
APP_VERSION
);
ok
{
if
high
,
_
:=
utils
.
CompareVersion
(
value
.
(
string
),
"> 3.9.0"
);
high
{
c
.
Set
(
mycontext
.
InnerEncrypt
,
true
)
}
}
c
.
Next
()
}
route/router.go
View file @
469ec7ae
...
...
@@ -17,6 +17,7 @@ import (
func
InitRouter
()
*
gin
.
Engine
{
var
r
=
gin
.
Default
()
r
.
Use
(
EncryptHandle
)
r
.
GET
(
"/group-swagger/*any"
,
ginSwagger
.
WrapHandler
(
swaggerFiles
.
Handler
))
...
...
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