Commit 627d0175 by luyt

other:1.cors注释2.list接口添加total

1 parent cd686904
...@@ -42,10 +42,12 @@ class TrackService extends Service { ...@@ -42,10 +42,12 @@ class TrackService extends Service {
limit: +params.pageSize || 10, limit: +params.pageSize || 10,
offset: +params.page || 1, offset: +params.page || 1,
}); });
const blogListAndCount = await app.model.Track.findAndCountAll();
return { return {
code: 200, code: 200,
message: '查询成功', message: '查询成功',
data: blogPageList || [], data: blogPageList || [],
total: blogListAndCount,
}; };
} }
} }
......
...@@ -20,10 +20,10 @@ module.exports = appInfo => { ...@@ -20,10 +20,10 @@ module.exports = appInfo => {
}, },
domainWhiteList: [ '*' ], domainWhiteList: [ '*' ],
}; };
config.cors = { // config.cors = {
origin: '*', // origin: '*',
allowMethods: 'GET,HEAD,PUT,POST,DELETE,PATCH,OPTIONS', // allowMethods: 'GET,HEAD,PUT,POST,DELETE,PATCH,OPTIONS',
}; // };
config.sequelize = { config.sequelize = {
dialect: 'mysql', // support: mysql, mariadb, postgres, mssql dialect: 'mysql', // support: mysql, mariadb, postgres, mssql
......
...@@ -7,10 +7,10 @@ module.exports = { ...@@ -7,10 +7,10 @@ module.exports = {
// enable: true, // enable: true,
// } // }
// 跨域配置 // 跨域配置
cors: { // cors: {
enable: true, // enable: true,
package: 'egg-cors', // package: 'egg-cors',
}, // },
sequelize: { sequelize: {
enable: true, enable: true,
package: 'egg-sequelize', package: 'egg-sequelize',
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!