Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
Ygopro Arena Revive
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 Revive
Commits
cc784dd1
Commit
cc784dd1
authored
Jul 09, 2021
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add /api/homepageCount
parent
72963a50
Pipeline
#4033
passed with stages
in 5 minutes and 23 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
0 deletions
+38
-0
src/app.controller.ts
src/app.controller.ts
+6
-0
src/app.service.ts
src/app.service.ts
+16
-0
src/dto/HomePageMatchCount.dto.ts
src/dto/HomePageMatchCount.dto.ts
+16
-0
No files found.
src/app.controller.ts
View file @
cc784dd1
...
@@ -30,6 +30,7 @@ import cryptoRandomString from 'crypto-random-string';
...
@@ -30,6 +30,7 @@ import cryptoRandomString from 'crypto-random-string';
import
{
join
}
from
'
path
'
;
import
{
join
}
from
'
path
'
;
import
{
ApiBody
,
ApiConsumes
,
ApiTags
}
from
'
@nestjs/swagger
'
;
import
{
ApiBody
,
ApiConsumes
,
ApiTags
}
from
'
@nestjs/swagger
'
;
import
{
FileUploadDto
}
from
'
./dto/FileUploadDto
'
;
import
{
FileUploadDto
}
from
'
./dto/FileUploadDto
'
;
import
{
HomePageMatchCountDto
}
from
'
./dto/HomePageMatchCount.dto
'
;
@
Controller
(
'
api
'
)
@
Controller
(
'
api
'
)
@
ApiTags
(
'
arena
'
)
@
ApiTags
(
'
arena
'
)
...
@@ -265,4 +266,9 @@ export class AppController {
...
@@ -265,4 +266,9 @@ export class AppController {
async
getFirstWinActivity
(@
Query
(
'
username
'
)
username
:
string
)
{
async
getFirstWinActivity
(@
Query
(
'
username
'
)
username
:
string
)
{
return
await
this
.
appService
.
getFirstWinActivity
(
username
);
return
await
this
.
appService
.
getFirstWinActivity
(
username
);
}
}
@
Get
(
'
homepageCount
'
)
async
getLastMonthBattleCount
():
Promise
<
HomePageMatchCountDto
>
{
return
this
.
appService
.
getLastMonthBattleCount
();
}
}
}
src/app.service.ts
View file @
cc784dd1
...
@@ -37,6 +37,7 @@ import { DeckInfoOrHistory } from './entities/mycard/DeckInfoOrHistory';
...
@@ -37,6 +37,7 @@ import { DeckInfoOrHistory } from './entities/mycard/DeckInfoOrHistory';
import
{
EloService
}
from
'
./elo/elo.service
'
;
import
{
EloService
}
from
'
./elo/elo.service
'
;
import
{
CardInfoService
}
from
'
./card-info/card-info.service
'
;
import
{
CardInfoService
}
from
'
./card-info/card-info.service
'
;
import
{
AthleticCheckerService
}
from
'
./athletic-checker/athletic-checker.service
'
;
import
{
AthleticCheckerService
}
from
'
./athletic-checker/athletic-checker.service
'
;
import
{
HomePageMatchCountDto
}
from
'
./dto/HomePageMatchCount.dto
'
;
const
attrOffset
=
1010
;
const
attrOffset
=
1010
;
const
raceOffset
=
1020
;
const
raceOffset
=
1020
;
...
@@ -1761,4 +1762,19 @@ export class AppService {
...
@@ -1761,4 +1762,19 @@ export class AppService {
).
toString
();
).
toString
();
return
activity
;
return
activity
;
}
}
async
getLastMonthBattleCount
()
{
const
lastMonth
=
moment
().
subtract
(
1
,
'
month
'
);
const
fromTime
=
moment
(
lastMonth
);
fromTime
.
set
({
day
:
1
,
hour
:
0
,
minute
:
0
,
second
:
0
});
const
toTime
=
moment
(
fromTime
).
add
(
1
,
'
month
'
);
//this.log.log(`${fromTime} - ${toTime}`);
const
count
=
await
this
.
mcdb
.
getRepository
(
BattleHistory
).
count
({
where
:
{
end_time
:
MoreThanOrEqual
(
fromTime
.
toDate
()),
start_time
:
LessThanOrEqual
(
toTime
.
toDate
()),
},
});
return
new
HomePageMatchCountDto
(
count
);
}
}
}
src/dto/HomePageMatchCount.dto.ts
0 → 100644
View file @
cc784dd1
import
moment
from
'
moment
'
;
export
class
HomePageMatchCountDto
{
count
:
number
;
year
:
number
;
month
:
number
;
//date: Date;
constructor
(
count
:
number
)
{
this
.
count
=
count
;
const
now
=
moment
();
const
lastMonth
=
now
.
subtract
(
1
,
'
month
'
);
//this.date = lastMonth.toDate();
this
.
year
=
lastMonth
.
year
();
this
.
month
=
lastMonth
.
month
()
+
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