mirror of
https://github.com/ctwj/urldb.git
synced 2025-11-25 11:29:37 +08:00
chore: bump version to v1.2.2
This commit is contained in:
@@ -2,6 +2,7 @@ package repo
|
||||
|
||||
import (
|
||||
"github.com/ctwj/urldb/db/entity"
|
||||
"github.com/ctwj/urldb/utils"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
@@ -96,9 +97,14 @@ func (r *FileRepositoryImpl) SearchFiles(search string, fileType, status string,
|
||||
offset := (page - 1) * pageSize
|
||||
query := r.db.Model(&entity.File{}).Where("is_deleted = ?", false)
|
||||
|
||||
// 添加调试日志
|
||||
utils.Info("搜索文件参数: search='%s', fileType='%s', status='%s', userID=%d, page=%d, pageSize=%d",
|
||||
search, fileType, status, userID, page, pageSize)
|
||||
|
||||
// 添加搜索条件
|
||||
if search != "" {
|
||||
query = query.Where("original_name LIKE ? OR file_name LIKE ?", "%"+search+"%", "%"+search+"%")
|
||||
query = query.Where("original_name LIKE ?", "%"+search+"%")
|
||||
utils.Info("添加搜索条件: original_name LIKE '%%%s%%'", search)
|
||||
}
|
||||
|
||||
if fileType != "" {
|
||||
@@ -126,6 +132,12 @@ func (r *FileRepositoryImpl) SearchFiles(search string, fileType, status string,
|
||||
Limit(pageSize).
|
||||
Find(&files).Error
|
||||
|
||||
// 添加调试日志
|
||||
utils.Info("搜索结果: 总数=%d, 当前页文件数=%d", total, len(files))
|
||||
if len(files) > 0 {
|
||||
utils.Info("第一个文件: ID=%d, 文件名='%s'", files[0].ID, files[0].OriginalName)
|
||||
}
|
||||
|
||||
return files, total, err
|
||||
}
|
||||
|
||||
|
||||
@@ -242,6 +242,10 @@ func (h *FileHandler) GetFileList(c *gin.Context) {
|
||||
req.PageSize = 20
|
||||
}
|
||||
|
||||
// 添加调试日志
|
||||
utils.Info("文件列表请求参数: page=%d, pageSize=%d, search='%s', fileType='%s', status='%s', userID=%d",
|
||||
req.Page, req.PageSize, req.Search, req.FileType, req.Status, req.UserID)
|
||||
|
||||
// 获取当前用户ID和角色
|
||||
userIDInterface, exists := c.Get("user_id")
|
||||
roleInterface, _ := c.Get("role")
|
||||
|
||||
@@ -43,10 +43,12 @@
|
||||
@input="debounceSearch"
|
||||
type="text"
|
||||
placeholder="搜索分类名称..."
|
||||
/>
|
||||
<div class="absolute right-3 top-1/2 transform -translate-y-1/2">
|
||||
clearable
|
||||
>
|
||||
<template #prefix>
|
||||
<i class="fas fa-search text-gray-400 text-sm"></i>
|
||||
</div>
|
||||
</template>
|
||||
</n-input>
|
||||
</div>
|
||||
<n-button @click="refreshData" type="tertiary">
|
||||
<template #icon>
|
||||
|
||||
@@ -27,32 +27,20 @@
|
||||
|
||||
<!-- 搜索和筛选 -->
|
||||
<n-card>
|
||||
<div class="grid grid-cols-1 md:grid-cols-4 gap-4">
|
||||
<div class="flex gap-4">
|
||||
<n-input
|
||||
v-model:value="searchKeyword"
|
||||
placeholder="搜索文件名..."
|
||||
placeholder="搜索原始文件名..."
|
||||
@keyup.enter="handleSearch"
|
||||
class="flex-1"
|
||||
clearable
|
||||
>
|
||||
<template #prefix>
|
||||
<i class="fas fa-search"></i>
|
||||
</template>
|
||||
</n-input>
|
||||
|
||||
<n-select
|
||||
v-model:value="filterType"
|
||||
placeholder="文件类型"
|
||||
:options="fileTypeOptions"
|
||||
clearable
|
||||
/>
|
||||
|
||||
<n-select
|
||||
v-model:value="filterStatus"
|
||||
placeholder="状态"
|
||||
:options="statusOptions"
|
||||
clearable
|
||||
/>
|
||||
|
||||
<n-button type="primary" @click="handleSearch">
|
||||
<n-button type="primary" @click="handleSearch" class="w-20">
|
||||
<template #icon>
|
||||
<i class="fas fa-search"></i>
|
||||
</template>
|
||||
@@ -244,8 +232,6 @@ const { getImageUrl } = useImageUrl()
|
||||
const loading = ref(false)
|
||||
const fileList = ref<FileItem[]>([])
|
||||
const searchKeyword = ref('')
|
||||
const filterType = ref('')
|
||||
const filterStatus = ref('')
|
||||
const showUploadModal = ref(false)
|
||||
const fileUploadRef = ref()
|
||||
const uploadModalKey = ref(0)
|
||||
@@ -266,18 +252,7 @@ const pagination = ref({
|
||||
// 总数
|
||||
const total = computed(() => pagination.value.total)
|
||||
|
||||
// 选项
|
||||
const fileTypeOptions = [
|
||||
{ label: '全部', value: '' },
|
||||
{ label: '图片', value: 'image' }
|
||||
]
|
||||
|
||||
const statusOptions = [
|
||||
{ label: '全部', value: '' },
|
||||
{ label: '正常', value: 'active' },
|
||||
{ label: '禁用', value: 'inactive' },
|
||||
{ label: '已删除', value: 'deleted' }
|
||||
]
|
||||
// 选项 - 已移除不需要的过滤条件
|
||||
|
||||
|
||||
|
||||
@@ -288,11 +263,11 @@ const loadFileList = async () => {
|
||||
const params = {
|
||||
page: pagination.value.page,
|
||||
page_size: pagination.value.pageSize,
|
||||
search: searchKeyword.value,
|
||||
file_type: filterType.value,
|
||||
status: filterStatus.value
|
||||
search: searchKeyword.value
|
||||
}
|
||||
|
||||
console.log('发送文件列表请求参数:', params)
|
||||
|
||||
const response = await fileApi.getFileList(params)
|
||||
fileList.value = response.data.files || []
|
||||
pagination.value.total = response.data.total || 0
|
||||
@@ -316,17 +291,12 @@ const loadFileList = async () => {
|
||||
}
|
||||
|
||||
const handleSearch = () => {
|
||||
console.log('执行搜索,关键词:', searchKeyword.value)
|
||||
pagination.value.page = 1
|
||||
loadFileList()
|
||||
}
|
||||
|
||||
const resetFilters = () => {
|
||||
searchKeyword.value = ''
|
||||
filterType.value = ''
|
||||
filterStatus.value = ''
|
||||
pagination.value.page = 1
|
||||
loadFileList()
|
||||
}
|
||||
|
||||
|
||||
const handlePageChange = (page: number) => {
|
||||
pagination.value.page = page
|
||||
|
||||
@@ -30,15 +30,26 @@
|
||||
|
||||
<!-- 搜索 -->
|
||||
<n-card>
|
||||
<div class="flex gap-4">
|
||||
<n-input
|
||||
v-model:value="searchQuery"
|
||||
placeholder="搜索热播剧..."
|
||||
@keyup.enter="handleSearch"
|
||||
class="flex-1"
|
||||
clearable
|
||||
>
|
||||
<template #prefix>
|
||||
<i class="fas fa-search"></i>
|
||||
</template>
|
||||
</n-input>
|
||||
|
||||
<n-button type="primary" @click="handleSearch" class="w-20">
|
||||
<template #icon>
|
||||
<i class="fas fa-search"></i>
|
||||
</template>
|
||||
搜索
|
||||
</n-button>
|
||||
</div>
|
||||
</n-card>
|
||||
|
||||
<!-- 热播剧列表 -->
|
||||
|
||||
@@ -24,15 +24,26 @@
|
||||
|
||||
<!-- 搜索 -->
|
||||
<n-card>
|
||||
<div class="flex gap-4">
|
||||
<n-input
|
||||
v-model:value="searchQuery"
|
||||
placeholder="搜索平台..."
|
||||
@keyup.enter="handleSearch"
|
||||
class="flex-1"
|
||||
clearable
|
||||
>
|
||||
<template #prefix>
|
||||
<i class="fas fa-search"></i>
|
||||
</template>
|
||||
</n-input>
|
||||
|
||||
<n-button type="primary" @click="handleSearch" class="w-20">
|
||||
<template #icon>
|
||||
<i class="fas fa-search"></i>
|
||||
</template>
|
||||
搜索
|
||||
</n-button>
|
||||
</div>
|
||||
</n-card>
|
||||
|
||||
<!-- 平台列表 -->
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
v-model:value="searchQuery"
|
||||
placeholder="搜索资源..."
|
||||
@keyup.enter="handleSearch"
|
||||
clearable
|
||||
>
|
||||
<template #prefix>
|
||||
<i class="fas fa-search"></i>
|
||||
@@ -55,7 +56,7 @@
|
||||
clearable
|
||||
/>
|
||||
|
||||
<n-button type="primary" @click="handleSearch">
|
||||
<n-button type="primary" @click="handleSearch" class="w-20">
|
||||
<template #icon>
|
||||
<i class="fas fa-search"></i>
|
||||
</template>
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<n-tab-pane name="site-submit" tab="站点提交">
|
||||
<div class="bg-white dark:bg-gray-800 rounded-lg shadow p-6">
|
||||
<div class="mb-6">
|
||||
<h3 class="text-lg font-semibold text-gray-900 dark:text-white mb-2">站点提交</h3>
|
||||
<h3 class="text-lg font-semibold text-gray-900 dark:text-white mb-2">站点提交(待开发)</h3>
|
||||
<p class="text-gray-600 dark:text-gray-400">向各大搜索引擎提交站点信息</p>
|
||||
</div>
|
||||
|
||||
@@ -186,7 +186,7 @@
|
||||
<n-tab-pane name="link-building" tab="外链建设">
|
||||
<div class="bg-white dark:bg-gray-800 rounded-lg shadow p-6">
|
||||
<div class="mb-6">
|
||||
<h3 class="text-lg font-semibold text-gray-900 dark:text-white mb-2">外链建设</h3>
|
||||
<h3 class="text-lg font-semibold text-gray-900 dark:text-white mb-2">外链建设(待开发)</h3>
|
||||
<p class="text-gray-600 dark:text-gray-400">管理和监控外部链接建设情况</p>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -188,13 +188,14 @@
|
||||
placeholder="搜索文件名..."
|
||||
@keyup.enter="handleSearch"
|
||||
class="flex-1"
|
||||
clearable
|
||||
>
|
||||
<template #prefix>
|
||||
<i class="fas fa-search"></i>
|
||||
</template>
|
||||
</n-input>
|
||||
|
||||
<n-button type="primary" @click="handleSearch">
|
||||
<n-button type="primary" @click="handleSearch" class="w-20">
|
||||
<template #icon>
|
||||
<i class="fas fa-search"></i>
|
||||
</template>
|
||||
|
||||
@@ -43,10 +43,12 @@
|
||||
@input="debounceSearch"
|
||||
type="text"
|
||||
placeholder="搜索标签名称..."
|
||||
/>
|
||||
<div class="absolute right-3 top-1/2 transform -translate-y-1/2">
|
||||
clearable
|
||||
>
|
||||
<template #prefix>
|
||||
<i class="fas fa-search text-gray-400 text-sm"></i>
|
||||
</div>
|
||||
</template>
|
||||
</n-input>
|
||||
</div>
|
||||
<n-button @click="refreshData" type="tertiary">
|
||||
<template #icon>
|
||||
|
||||
@@ -68,6 +68,7 @@
|
||||
v-model:value="searchQuery"
|
||||
placeholder="搜索资源标题..."
|
||||
@keyup.enter="handleSearch"
|
||||
clearable
|
||||
>
|
||||
<template #prefix>
|
||||
<i class="fas fa-search"></i>
|
||||
@@ -87,7 +88,7 @@
|
||||
:options="sortOptions"
|
||||
/>
|
||||
|
||||
<n-button type="primary" @click="handleSearch">
|
||||
<n-button type="primary" @click="handleSearch" class="w-20">
|
||||
<template #icon>
|
||||
<i class="fas fa-search"></i>
|
||||
</template>
|
||||
|
||||
@@ -18,7 +18,14 @@
|
||||
<div class="max-w-7xl mx-auto">
|
||||
<!-- 头部 -->
|
||||
<div class="header-container bg-slate-800 dark:bg-gray-800 text-white dark:text-gray-100 rounded-lg shadow-lg p-4 sm:p-8 mb-4 sm:mb-8 text-center relative">
|
||||
<h1 class="text-2xl sm:text-3xl font-bold mb-4">
|
||||
<h1 class="text-2xl sm:text-3xl font-bold mb-4 flex items-center justify-center gap-3">
|
||||
<img
|
||||
v-if="systemConfig?.site_logo"
|
||||
:src="getImageUrl(systemConfig.site_logo)"
|
||||
:alt="systemConfig?.site_title || 'Logo'"
|
||||
class="h-8 w-auto object-contain"
|
||||
@error="handleLogoError"
|
||||
/>
|
||||
<a href="/" class="text-white hover:text-gray-200 dark:hover:text-gray-300 no-underline">
|
||||
{{ systemConfig?.site_title || '老九网盘资源数据库' }}
|
||||
</a>
|
||||
@@ -62,8 +69,8 @@
|
||||
<div class="w-full max-w-3xl mx-auto mb-4 sm:mb-8 px-2 sm:px-0">
|
||||
<ClientOnly>
|
||||
<div class="relative">
|
||||
<n-input round placeholder="搜索" v-model:value="searchQuery" @blur="handleSearch" @keyup.enter="handleSearch">
|
||||
<template #suffix>
|
||||
<n-input round placeholder="搜索" v-model:value="searchQuery" @blur="handleSearch" @keyup.enter="handleSearch" clearable>
|
||||
<template #prefix>
|
||||
<i class="fas fa-search text-gray-400"></i>
|
||||
</template>
|
||||
</n-input>
|
||||
@@ -250,6 +257,15 @@ const pageLoading = ref(false)
|
||||
// 用户状态管理
|
||||
const userStore = useUserStore()
|
||||
|
||||
// 图片URL处理
|
||||
const { getImageUrl } = useImageUrl()
|
||||
|
||||
// Logo错误处理
|
||||
const handleLogoError = (event: Event) => {
|
||||
const img = event.target as HTMLImageElement
|
||||
img.style.display = 'none'
|
||||
}
|
||||
|
||||
// 使用 useAsyncData 获取资源数据
|
||||
const { data: resourcesData, pending, refresh } = await useAsyncData(
|
||||
() => `resources-1-${route.query.search || ''}-${route.query.platform || ''}`,
|
||||
|
||||
@@ -92,7 +92,7 @@
|
||||
clearable
|
||||
/>
|
||||
|
||||
<n-button type="primary" @click="handleSearch">
|
||||
<n-button type="primary" @click="handleSearch" class="w-20">
|
||||
<template #icon>
|
||||
<i class="fas fa-search"></i>
|
||||
</template>
|
||||
|
||||
@@ -92,7 +92,7 @@
|
||||
clearable
|
||||
/>
|
||||
|
||||
<n-button type="primary" @click="handleSearch">
|
||||
<n-button type="primary" @click="handleSearch" class="w-20">
|
||||
<template #icon>
|
||||
<i class="fas fa-search"></i>
|
||||
</template>
|
||||
|
||||
@@ -80,7 +80,7 @@
|
||||
clearable
|
||||
/>
|
||||
|
||||
<n-button type="primary" @click="handleSearch">
|
||||
<n-button type="primary" @click="handleSearch" class="w-20">
|
||||
<template #icon>
|
||||
<i class="fas fa-search"></i>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user