Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
new-api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
d427e849
authored
Jan 13, 2024
by
CaIon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: 数据看板限制用户只能查询跨度一个月的数据
parent
724858f2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
0 deletions
+8
-0
controller/usedata.go
+8
-0
No files found.
controller/usedata.go
View file @
d427e849
...
@@ -31,6 +31,14 @@ func GetUserQuotaDates(c *gin.Context) {
...
@@ -31,6 +31,14 @@ func GetUserQuotaDates(c *gin.Context) {
userId
:=
c
.
GetInt
(
"id"
)
userId
:=
c
.
GetInt
(
"id"
)
startTimestamp
,
_
:=
strconv
.
ParseInt
(
c
.
Query
(
"start_timestamp"
),
10
,
64
)
startTimestamp
,
_
:=
strconv
.
ParseInt
(
c
.
Query
(
"start_timestamp"
),
10
,
64
)
endTimestamp
,
_
:=
strconv
.
ParseInt
(
c
.
Query
(
"end_timestamp"
),
10
,
64
)
endTimestamp
,
_
:=
strconv
.
ParseInt
(
c
.
Query
(
"end_timestamp"
),
10
,
64
)
// 判断时间跨度是否超过 1 个月
if
endTimestamp
-
startTimestamp
>
2592000
{
c
.
JSON
(
http
.
StatusOK
,
gin
.
H
{
"success"
:
false
,
"message"
:
"时间跨度不能超过 1 个月"
,
})
return
}
dates
,
err
:=
model
.
GetQuotaDataByUserId
(
userId
,
startTimestamp
,
endTimestamp
)
dates
,
err
:=
model
.
GetQuotaDataByUserId
(
userId
,
startTimestamp
,
endTimestamp
)
if
err
!=
nil
{
if
err
!=
nil
{
c
.
JSON
(
http
.
StatusOK
,
gin
.
H
{
c
.
JSON
(
http
.
StatusOK
,
gin
.
H
{
...
...
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