新增全局流水号

This commit is contained in:
2026-08-25 05:33:01 +08:00
parent 90fd59b647
commit 07c4e969c3
33 changed files with 1176 additions and 73 deletions
+7 -3
View File
@@ -376,20 +376,24 @@ trait OrderRepositoryAdmin {
}
if ($search !== '') {
// Numeric search may mean user_id or product_id; also match order number / type.
$flow_table = \AKSRT\Core\DBMigrator::table('financial_flow');
$flow_match = "EXISTS (SELECT 1 FROM {$flow_table} ff WHERE ff.order_number = " . $this->table() . '.order_number AND ff.flow_number LIKE %s)';
// Numeric search may mean user_id or product_id; also match order or flow number / type.
if (ctype_digit($search)) {
$where[] = '(order_number LIKE %s OR product_type LIKE %s OR user_id = %d OR product_id = %d)';
$where[] = "(order_number LIKE %s OR product_type LIKE %s OR user_id = %d OR product_id = %d OR {$flow_match})";
$like = '%' . $wpdb->esc_like($search) . '%';
$params[] = $like;
$params[] = $like;
$params[] = (int) $search;
$params[] = (int) $search;
$params[] = $like;
} else {
$where[] = '(order_number LIKE %s OR product_type LIKE %s OR payment_method LIKE %s)';
$where[] = "(order_number LIKE %s OR product_type LIKE %s OR payment_method LIKE %s OR {$flow_match})";
$like = '%' . $wpdb->esc_like($search) . '%';
$params[] = $like;
$params[] = $like;
$params[] = $like;
$params[] = $like;
}
}