新增全部用户查看删除邮箱
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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])
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user