新增全部用户查看删除邮箱

This commit is contained in:
eoao
2025-09-21 19:20:00 +08:00
parent 457304eafb
commit 82bd308d56
21 changed files with 244 additions and 77 deletions

View File

@@ -5,7 +5,7 @@ import userService from './user-service';
import emailService from './email-service';
import orm from '../entity/orm';
import account from '../entity/account';
import { and, asc, eq, gt, inArray, count, sql } from 'drizzle-orm';
import { and, asc, eq, gt, inArray, count, sql, ne } from 'drizzle-orm';
import { isDel, settingConst } from '../const/entity-const';
import settingService from './setting-service';
import turnstileService from './turnstile-service';
@@ -195,7 +195,37 @@ const accountService = {
throw new BizError(t('usernameLengthLimit'));
}
await orm(c).update(account).set({name}).where(and(eq(account.userId, userId),eq(account.accountId, accountId))).run();
},
async allAccount(c, params) {
let { userId, num, size } = params
userId = Number(userId)
num = Number(num)
size = Number(size)
if (size > 30) {
size = 30;
}
num = (num - 1) * size;
const userRow = await userService.selectByIdIncludeDel(c, userId);
const list = await orm(c).select().from(account).where(and(eq(account.userId, userId),ne(account.email,userRow.email))).limit(size).offset(num);
const { total } = await orm(c).select({ total: count() }).from(account).where(eq(account.userId, userId)).get();
return { list, total }
},
async physicsDelete(c, params) {
const { accountId } = params
await emailService.physicsDeleteByAccountId(c, accountId)
await orm(c).delete(account).where(eq(account.accountId, accountId)).run();
}
};
export default accountService;

View File

@@ -191,6 +191,11 @@ const attService = {
await r2Service.delete(c, batch);
}
},
async removeByAccountId(c, accountId) {
console.log(accountId)
await this.removeAttByField(c, "account_id", [accountId])
}
};

View File

@@ -655,6 +655,11 @@ const emailService = {
await attService.removeByEmailIds(c, emailIds);
await orm(c).delete(email).where(conditions.length > 1 ? and(...conditions) : conditions[0]).run();
},
async physicsDeleteByAccountId(c, accountId) {
await attService.removeByAccountId(c, accountId);
await orm(c).delete(email).where(eq(email.accountId, accountId)).run();
}
};

View File

@@ -74,6 +74,10 @@ const userService = {
return orm(c).select().from(user).where(sql`${user.email} COLLATE NOCASE = ${email}`).get();
},
selectByIdIncludeDel(c, userId) {
return orm(c).select().from(user).where(eq(user.userId, userId)).get();
},
selectById(c, userId) {
return orm(c).select().from(user).where(
and(