Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
杨树贤
/
LC_soapi
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
7b68309b
authored
Jan 07, 2020
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
添加响应函数
parent
7df494af
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
2 deletions
pkg/app/response.go
pkg/logger/log.go → pkg/logging/log.go
pkg/logger/log_report.go → pkg/logging/log_report.go
pkg/app/response.go
0 → 100644
View file @
7b68309b
package
app
import
(
"github.com/gin-gonic/gin"
)
type
Gin
struct
{
C
*
gin
.
Context
}
type
Response
struct
{
Code
int
`json:"code"`
Msg
string
`json:"msg"`
Data
interface
{}
`json:"data"`
}
// Response setting gin.JSON
func
(
g
*
Gin
)
Response
(
errCode
int
,
errMsg
string
,
data
interface
{})
{
g
.
C
.
JSON
(
200
,
Response
{
Code
:
errCode
,
Msg
:
errMsg
,
Data
:
data
,
})
return
}
pkg/logg
er
/log.go
→
pkg/logg
ing
/log.go
View file @
7b68309b
File moved
pkg/logg
er
/log_report.go
→
pkg/logg
ing
/log_report.go
View file @
7b68309b
package
logger
import
(
"LC_soapi/pkg/util"
"fmt"
"time"
)
...
...
@@ -17,11 +19,15 @@ type ErrorLog struct {
}
//上报请求日志
func
ReportErrorLog
(
msg
string
,
code
int
)
{
func
ReportErrorLog
(
msg
string
,
code
int
,
method
string
)
{
var
errLog
ErrorLog
caller
:=
util
.
GetCaller
(
2
);
fmt
.
Println
(
caller
)
errLog
.
TimeStamp
=
int
(
time
.
Now
()
.
Unix
())
errLog
.
DateTimeStr
=
time
.
Now
()
.
Format
(
"2006-01-02 15:04:05"
)
errLog
.
App
=
"Search"
errLog
.
ServerIp
=
"
2123
"
errLog
.
ServerIp
=
"
127.0.0.1
"
}
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