Skip to content

Commit

Permalink
feat: 批量打分 (#233)
Browse files Browse the repository at this point in the history
* feat: 批量打分

* feat: 批量打分
  • Loading branch information
yi-boide authored Jul 26, 2024
1 parent f4a233a commit 1d995b8
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
4 changes: 4 additions & 0 deletions entry/src/main/ets/database/dao/BookSourceDao.ets
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ class BookSourceDao {
const type = searchParams?.type;
const enabled = searchParams?.enabled;
const hasExploreUrl = searchParams?.hasExploreUrl;
const showExplore = searchParams?.showExplore;
try {
const column: ColumnInfo[] = AppDatabaseUtil.getColumn(this.TABLE_NAME);
let sql = `SELECT * FROM book_sources`;
Expand All @@ -148,6 +149,9 @@ class BookSourceDao {
if (hasExploreUrl !== undefined) {
whereClause.push(`COALESCE(exploreUrl, '') ${hasExploreUrl ? '<>' : '='} ''`);
}
if (showExplore !== undefined) {
whereClause.push(`showExplore = ${showExplore ? 1 : 0}`);
}
if (searchKey) { // 确保 searchKey 不为空或未定义
whereClause.push(`(
bookSourceName LIKE '%${searchKey}%'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,22 @@ export default struct SourceView {
background: '#FF6600',
fontColor: '#FFFFFF',
action: async () => {
if (this.isBatch) {
const sourceList: BookSourcePart[] = []
this.sourceList.forEach((item, i) => {
if (this.activeNameMap[item.bookSourceUrl]) {
item.bookSourceGrade = this.dialogItem.bookSourceGrade
item.bookSourceScore = this.dialogItem.bookSourceScore
sourceList.push(item)
}
})
await BookSourceDao.batchUpdateFlow(sourceList)
this.getList()
this.activeNameMap = {}
this.dialogController.close()
this.dialogItem = {}
return
}
await BookSourceDao.updateFlow(this.dialogItem as BookSourcePart)
this.getList()
this.dialogItem = {}
Expand Down Expand Up @@ -382,6 +398,11 @@ export default struct SourceView {
this.isShowGroup = true;
break;
case 1:
if (!Object.values(this.activeNameMap).filter(o => o).length) {
showMessage('请至少选择一个')
return
}
this.dialogItem = this.sourceList.filter(item => this.activeNameMap[item.bookSourceUrl])[0]
this.dialogController.open()
break;
case 2:
Expand Down

0 comments on commit 1d995b8

Please sign in to comment.