Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
apaas-meshproxy
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gzga-jzapi
apaas-meshproxy
Commits
e28571a8
Commit
e28571a8
authored
Nov 04, 2020
by
leitao.zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
调用记录
parent
b4d4ebcc
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
23 deletions
+32
-23
src/dao/service_request_record.go
src/dao/service_request_record.go
+14
-11
src/service/field.go
src/service/field.go
+18
-12
No files found.
src/dao/service_request_record.go
View file @
e28571a8
...
...
@@ -5,17 +5,20 @@ import (
)
type
ServiceRequestRecord
struct
{
//Id int `json:"id" xorm:"id"`
ServiceId
int
`json:"service_id" xorm:"service_id"`
ApplyId
int
`json:"apply_id" xorm:"apply_id"`
UserId
string
`json:"user_id" xorm:"user_id"`
RequestTime
time
.
Time
`json:"request_time" xorm:"request_time created"`
DateDay
int
`json:"date_day" xorm:"date_day"`
DateMonth
int
`json:"date_month" xorm:"date_month"`
DateYear
int
`json:"date_year" xorm:"date_year"`
Status
int
`json:"status" xorm:"status"`
Error
string
`json:"error" xorm:"error"`
ReqUrl
string
`json:"req_url" xorm:"req_url"`
Id
int64
`json:"id" xorm:"pk default nextval('service_request_record_id_pk'::regclass) autoincr BIGINT"`
ServiceId
int64
`json:"service_id" xorm:"BIGINT"`
ApplyId
int64
`json:"apply_id" xorm:"BIGINT"`
UserId
string
`json:"user_id" xorm:"VARCHAR(50)"`
RequestTime
time
.
Time
`json:"request_time" xorm:"DATETIME"`
DateDay
int
`json:"date_day" xorm:"SMALLINT"`
DateMonth
int
`json:"date_month" xorm:"SMALLINT"`
DateYear
int
`json:"date_year" xorm:"SMALLINT"`
Status
int
`json:"status" xorm:"SMALLINT"`
Error
string
`json:"error" xorm:"TEXT"`
ReqUrl
string
`json:"req_url" xorm:"VARCHAR"`
ApiId
int64
`json:"api_id" xorm:"BIGINT"`
ApplyOid
string
`json:"apply_oid" xorm:"VARCHAR"`
ServiceOid
string
`json:"service_oid" xorm:"VARCHAR"`
}
func
(
s
ServiceRequestRecord
)
TableName
()
string
{
...
...
src/service/field.go
View file @
e28571a8
...
...
@@ -89,26 +89,32 @@ func GetExpire() time.Duration {
//记录调用痕迹
func
RecordCall
(
proxyData
model
.
ProxyData
,
status
int
,
res
[]
byte
)
{
acc
:=
dao
.
ServiceRequestRecord
{}
db
,
err
:=
client
.
GetConnect
()
if
err
!=
nil
{
fmt
.
Println
(
err
.
Error
())
return
}
acc
:=
dao
.
ServiceRequestRecord
{
Id
:
0
,
ServiceId
:
proxyData
.
ServiceId
,
ApplyId
:
proxyData
.
ApplyId
,
UserId
:
proxyData
.
ApplyUserId
,
RequestTime
:
time
.
Now
(),
DateDay
:
time
.
Now
()
.
Day
(),
DateMonth
:
int
(
time
.
Now
()
.
Month
()),
DateYear
:
time
.
Now
()
.
Year
(),
Status
:
status
,
Error
:
""
,
ReqUrl
:
proxyData
.
ReqUrl
,
ApiId
:
proxyData
.
ApiId
,
ApplyOid
:
proxyData
.
ApplyOid
,
ServiceOid
:
proxyData
.
ServiceOid
,
}
//错误信息
if
status
!=
200
{
acc
.
Error
=
string
(
res
)
}
acc
.
RequestTime
=
time
.
Now
()
acc
.
ApplyId
=
cast
.
ToInt
(
proxyData
.
ApplyId
)
acc
.
UserId
=
proxyData
.
ApplyUserId
acc
.
ServiceId
=
cast
.
ToInt
(
proxyData
.
ServiceId
)
acc
.
ReqUrl
=
proxyData
.
ReqUrl
acc
.
DateDay
=
time
.
Now
()
.
Day
()
fmt
.
Println
(
time
.
Now
()
.
Month
()
.
String
())
acc
.
DateMonth
=
int
(
time
.
Now
()
.
Month
())
acc
.
DateYear
=
time
.
Now
()
.
Year
()
acc
.
Status
=
status
if
_
,
err
=
db
.
Insert
(
&
acc
);
err
!=
nil
{
fmt
.
Println
(
err
)
...
...
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