This commit is contained in:
2025-09-16 17:39:51 +08:00
parent 14a3c39f9d
commit 61476e2b8e
9 changed files with 768 additions and 722 deletions

View File

@@ -1046,9 +1046,9 @@ class MatchingService {
}
// 确保至少有最小笔数
if (allocations.length < minTransfers) {
throw new Error(`无法生成足够的分配:需要至少${minTransfers}笔,但只能生成${allocations.length}`);
}
// if (allocations.length < minTransfers) {
// throw new Error(`无法生成足够的分配:需要至少${minTransfers}笔,但只能生成${allocations.length}笔`);
// }
// 精确控制总金额,避免超出预期
const currentTotal = allocations.reduce((sum, a) => sum + a.amount, 0);

View File

@@ -363,7 +363,7 @@ class TransferService {
}
}
async getTransfersHistory(filters = {}, pagination = {}, user_type = 'user_to_user') {
async getTransfersHistory(filters = {}, pagination = {}, user_type = 'manual') {
const db = getDB();
const {page = 1, limit = 10, sort = 'created_at', order = 'desc'} = pagination;
const pageNum = parseInt(page, 10) || 1;
@@ -372,7 +372,7 @@ class TransferService {
let whereClause = 'WHERE 1=1 ';
const params = [];
whereClause += `AND transfer_type != '${user_type}'`;
whereClause += `AND source_type != '${user_type}'`;
// 构建查询条件
if (filters.user_id) {
whereClause += ' AND (from_user_id = ? OR to_user_id = ?)';