fix: query tenant entry tables without prefix

This commit is contained in:
richjohnrambo
2026-09-22 23:52:08 +08:00
parent abd5eb162a
commit 603e89e204
3 changed files with 113 additions and 108 deletions
+13 -16
View File
@@ -22,24 +22,21 @@ func loadImPublicUploads(ctx context.Context, fileIds []string) (files []*sysin.
if len(fileIds) == 0 {
return []*sysin.ImPublicUploadModel{}, nil
}
if err = g.DB().Model("im_public_uploads").Safe().Ctx(ctx).
Fields(
"id",
"file_id",
"purpose",
"mime_type",
"size",
"etag",
"location",
"expires_at",
"created_at",
"uploaded_at",
).
WhereIn("file_id", fileIds).
OrderAsc("id").
Scan(&files); err != nil {
placeholders := make([]string, 0, len(fileIds))
args := make([]any, 0, len(fileIds))
for _, fileId := range fileIds {
placeholders = append(placeholders, "?")
args = append(args, fileId)
}
query := `SELECT id,file_id,purpose,mime_type,size,etag,location,expires_at,created_at,uploaded_at
FROM im_public_uploads WHERE file_id IN (` + strings.Join(placeholders, ",") + `) ORDER BY id ASC`
rows, err := g.DB().GetAll(ctx, query, args...)
if err != nil {
return nil, gerror.Wrap(err, "获取公共上传文件信息失败,请稍后重试!")
}
if err = rows.Structs(&files); err != nil {
return nil, gerror.Wrap(err, "解析公共上传文件信息失败,请稍后重试!")
}
drive := ""
if conf, confErr := service.SysConfig().GetUpload(ctx); confErr == nil && conf != nil {