Skip to content

Commit 12a02f3

Browse files
author
pedro
committed
fix: 修复sequelize升级带来的版本问题
1 parent 89231ff commit 12a02f3

4 files changed

Lines changed: 18 additions & 17 deletions

File tree

app/config/setting.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,17 @@ exports.apiDir = "app/api";
88

99
exports.accessExp = 60 * 60; // 1h 单位秒
1010

11+
// 暂不启用
1112
exports.pluginPath = {
1213
// plugin name
13-
poem: {
14-
// determine a plugin work or not
15-
enable: true,
16-
// path of the plugin that relatived the workdir
17-
path: "app/plugins/poem",
18-
// other config
19-
limit: 2
20-
}
14+
// poem: {
15+
// // determine a plugin work or not
16+
// enable: true,
17+
// // path of the plugin that relatived the workdir
18+
// path: "app/plugins/poem",
19+
// // other config
20+
// limit: 2
21+
// }
2122
// notify: {
2223
// enable: true,
2324
// path: "app/plugins/notify",

app/dao/admin.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ class AdminDao {
156156
}
157157

158158
async getGroup (ctx, id) {
159-
const group = await ctx.manager.groupModel.findById(id);
159+
const group = await ctx.manager.groupModel.findByPk(id);
160160
const auths = await db.query(
161161
"SELECT lin_auth.auth,lin_auth.module FROM lin_auth WHERE lin_auth.group_id=:id",
162162
{
@@ -216,7 +216,7 @@ class AdminDao {
216216

217217
async updateGroup (ctx, v) {
218218
const id = v.get("path.id");
219-
const exit = await ctx.manager.groupModel.findById(id);
219+
const exit = await ctx.manager.groupModel.findByPk(id);
220220
if (!exit) {
221221
throw new NotFound({
222222
msg: "分组不存在,更新失败"
@@ -228,7 +228,7 @@ class AdminDao {
228228
}
229229

230230
async deleteGroup (ctx, id) {
231-
const exit = await ctx.manager.groupModel.findById(id);
231+
const exit = await ctx.manager.groupModel.findByPk(id);
232232
if (!exit) {
233233
throw new NotFound({
234234
msg: "分组不存在,删除失败"
@@ -263,7 +263,7 @@ class AdminDao {
263263
}
264264

265265
async dispatchAuth (ctx, v) {
266-
const group = await ctx.manager.groupModel.findById(v.get("body.group_id"));
266+
const group = await ctx.manager.groupModel.findByPk(v.get("body.group_id"));
267267
if (!group) {
268268
throw new NotFound({
269269
msg: "分组不存在"
@@ -289,7 +289,7 @@ class AdminDao {
289289
}
290290

291291
async dispatchAuths (ctx, v) {
292-
const group = await ctx.manager.groupModel.findById(v.get("body.group_id"));
292+
const group = await ctx.manager.groupModel.findByPk(v.get("body.group_id"));
293293
if (!group) {
294294
throw new NotFound({
295295
msg: "分组不存在"
@@ -314,7 +314,7 @@ class AdminDao {
314314
}
315315

316316
async removeAuths (ctx, v) {
317-
const group = await ctx.manager.groupModel.findById(v.get("body.group_id"));
317+
const group = await ctx.manager.groupModel.findByPk(v.get("body.group_id"));
318318
if (!group) {
319319
throw new NotFound({
320320
msg: "分组不存在"

app/dao/book.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class BookDao {
6262
}
6363

6464
async updateBook (v, id) {
65-
const book = await Book.findById(id);
65+
const book = await Book.findByPk(id);
6666
if (!book) {
6767
throw new NotFound({
6868
msg: "没有找到相关书籍"

app/plugins/notify/app/message.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class MessageDao {
4444
}
4545

4646
async readMessage (id) {
47-
const msg = await Message.findById(id);
47+
const msg = await Message.findByPk(id);
4848
if (!msg) {
4949
throw new NotFound({
5050
msg: "未找到消息"
@@ -73,7 +73,7 @@ class MessageDao {
7373
}
7474

7575
async deleteMessage (id) {
76-
const msg = await Message.findById(id);
76+
const msg = await Message.findByPk(id);
7777
if (!msg) {
7878
throw new NotFound({
7979
msg: "未找到消息"

0 commit comments

Comments
 (0)