邮件详情样式优化和查询优化

This commit is contained in:
eoao
2025-06-29 11:57:53 +08:00
parent bd244e48ec
commit 33141fe7dd
8 changed files with 21 additions and 16 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -6,8 +6,8 @@
<title></title>
<link rel="icon" href="/assets/favicon-C5dAZutX.svg" type="image/svg+xml">
<script src="https://challenges.cloudflare.com/turnstile/v0/api.js" async defer></script>
<script type="module" crossorigin src="/assets/index-cUTOO-6m.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-CaUbyCK1.css">
<script type="module" crossorigin src="/assets/index-DDsmLAr5.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-p2lTpkGZ.css">
</head>
<body>
<div id="loading-first">

View File

@@ -32,7 +32,7 @@ export async function email(message, env, ctx) {
return;
}
const account = await accountService.selectByEmailIncludeDel({ env: env }, message.to);
const account = await accountService.selectByEmailIncludeDelNoCase({ env: env }, message.to);
const reader = message.raw.getReader();
let content = '';

View File

@@ -1,7 +1,7 @@
import orm from '../entity/orm';
import email from '../entity/email';
import { emailConst, isDel, settingConst } from '../const/entity-const';
import { and, desc, eq, gt, inArray, lt, count, asc, like, ne } from 'drizzle-orm';
import { and, desc, eq, gt, inArray, lt, count, asc, sql, ne } from 'drizzle-orm';
import { star } from '../entity/star';
import settingService from './setting-service';
import accountService from './account-service';
@@ -13,7 +13,6 @@ import { parseHTML } from 'linkedom';
import userService from './user-service';
import roleService from './role-service';
import user from '../entity/user';
import account from '../entity/account';
import starService from './star-service';
import dayjs from 'dayjs';
import kvConst from '../const/kv-const';
@@ -509,19 +508,19 @@ const emailService = {
}
if (userEmail) {
conditions.push(like(user.email, `${userEmail}%`));
conditions.push(sql`${user.email} COLLATE NOCASE LIKE ${userEmail + '%'}`);
}
if (accountEmail) {
conditions.push(like(email.toEmail, `${accountEmail}%`));
conditions.push(sql`${email.toEmail} COLLATE NOCASE LIKE ${accountEmail + '%'}`);
}
if (name) {
conditions.push(like(email.name, `${name}%`));
conditions.push(sql`${email.name} COLLATE NOCASE LIKE ${name + '%'}`);
}
if (subject) {
conditions.push(like(email.subject, `${subject}%`));
conditions.push(sql`${email.subject} COLLATE NOCASE LIKE ${subject + '%'}`);
}
conditions.push(ne(email.status, emailConst.status.SAVING));

View File

@@ -107,7 +107,7 @@ const userService = {
await c.env.kv.delete(kvConst.AUTH_INFO + userId);
},
async list(c, params, userId) {
async list(c, params) {
let { num, size, email, timeSort, status } = params;
@@ -130,9 +130,10 @@ const userService = {
if (email) {
conditions.push(like(user.email, `${email}%`));
conditions.push(sql`${user.email} COLLATE NOCASE LIKE ${email + '%'}`);
}
if (params.isDel) {
conditions.push(eq(user.isDel, params.isDel));
}