Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
ygopro-arena-api
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
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
MyCard
ygopro-arena-api
Commits
a8eb29eb
Commit
a8eb29eb
authored
Oct 14, 2017
by
ganjingcun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
过滤选项
parent
70894af1
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
5 deletions
+12
-5
routes/api.js
routes/api.js
+12
-5
No files found.
routes/api.js
View file @
a8eb29eb
...
...
@@ -819,13 +819,13 @@ router.get('/votes', function (req, res) {
var
username
=
req
.
query
.
username
;
var
type
=
req
.
query
.
type
;
var
arena
=
null
//1 athletic 2 entertain
var
status
=
undefined
if
(
type
===
'
1
'
)
{
arena
=
'
athletic
'
status
=
true
}
if
(
type
===
'
2
'
)
{
arena
=
'
entertain
'
status
=
false
}
var
from_date
=
req
.
query
.
from_date
;
...
...
@@ -839,6 +839,9 @@ router.get('/votes', function (req, res) {
var
offset
=
(
page_no
-
1
)
*
page_num
var
sql
=
`SELECT count(*) from votes `
if
(
status
!==
undefined
)
{
sql
=
`SELECT count(*) from votes where status=
${
status
}
`
}
console
.
log
(
sql
);
...
...
@@ -848,6 +851,10 @@ router.get('/votes', function (req, res) {
var
sql2
=
`SELECT * from votes order by create_time desc limit
${
page_num
}
offset
${
offset
}
`
if
(
status
!==
undefined
)
{
var
sql2
=
`SELECT * from votes where status=
${
status
}
order by create_time desc limit
${
page_num
}
offset
${
offset
}
`
}
console
.
log
(
sql2
)
client
.
query
(
sql2
,
function
(
err
,
result
)
{
...
...
@@ -965,7 +972,7 @@ router.get('/vote', function (req, res) {
}
if
(
validRow
.
length
>
0
)
{
var
index
=
_
.
random
(
0
,
validRow
.
length
)
var
index
=
_
.
random
(
0
,
validRow
.
length
)
res
.
json
({
data
:
validRow
[
index
]
});
...
...
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