Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
陆宇天
/
tracking-backend
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit f59952e6
authored
Jun 29, 2022
by
luyt
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
feat:调整分页逻辑
1 parent
627d0175
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
4 deletions
app/service/trackService.js
config/config.default.js
app/service/trackService.js
View file @
f59952e
...
...
@@ -35,19 +35,21 @@ class TrackService extends Service {
// console.log('params: ', params);
const
{
app
}
=
this
;
// 分页
const
page
=
+
params
.
page
||
1
;
const
pageSize
=
+
params
.
pageSize
||
10
;
const
blogPageList
=
await
app
.
model
.
Track
.
findAll
({
// order: [
// [ 'id', 'desc' ],
// ],
limit
:
+
params
.
pageSize
||
10
,
offset
:
+
params
.
page
||
1
,
limit
:
pageSize
,
offset
:
(
page
-
1
)
*
pageSize
,
});
const
blogListAndCount
=
await
app
.
model
.
Track
.
findAndCountAll
();
return
{
code
:
200
,
message
:
'查询成功'
,
data
:
blogPageList
||
[],
total
:
blogListAndCount
,
total
:
blogListAndCount
.
count
,
};
}
}
...
...
config/config.default.js
View file @
f59952e
...
...
@@ -27,7 +27,7 @@ module.exports = appInfo => {
config
.
sequelize
=
{
dialect
:
'mysql'
,
// support: mysql, mariadb, postgres, mssql
timezone
:
'+08:00'
,
// 时区问题
//
timezone: '+08:00', // 时区问题
database
:
'track_info'
,
host
:
'192.168.3.210'
,
port
:
3308
,
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment