Skip to content

Commit ae1d10e

Browse files
committed
fix: 修复文章与分类获取列表状态
1 parent 43bf7fd commit ae1d10e

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

app/dao/article.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ class ArticleDao {
126126

127127
// 筛选方式
128128
let filter = {
129+
status: status === '' ? 1 : status,
129130
deleted_at: null
130131
};
131132

@@ -141,10 +142,6 @@ class ArticleDao {
141142
};
142143
}
143144

144-
if (status != null) {
145-
filter.status = status
146-
}
147-
148145
try {
149146
const article = await Article.scope('iv').findAndCountAll({
150147
limit: page_size, //每页10条

app/dao/category.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,10 @@ class CategoryDao {
104104

105105
// 分类列表
106106
static async list(query = {}) {
107-
const { status, name, id, page_size = 10, page = 1 } = query
108-
let params = {}
109-
if (status != null) {
110-
params.status = status
107+
const { status = 1, name, id, page_size = 10, page = 1 } = query
108+
109+
let params = {
110+
status: status === '' ? 1 : status
111111
}
112112

113113
if (name) {
@@ -119,8 +119,8 @@ class CategoryDao {
119119
if (id) {
120120
params.id = id
121121
}
122-
123122
console.log('params', params)
123+
124124
try {
125125
const category = await Category.scope('bh').findAndCountAll({
126126
where: params,

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy