邮件详情样式优化和查询优化
This commit is contained in:
@@ -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 = '';
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user