fix(用户列表): 移除充值次数筛选

后端查询、参数接收与前端表单同步移除
This commit is contained in:
吴昊天 2026-10-21 11:49:34 +08:00
parent 78f56bb074
commit 7405042247
3 changed files with 2 additions and 50 deletions

View File

@ -66,7 +66,6 @@ class UserController extends AuthController
['before_pay_time', ''],
['pay_count_num', []],
['pay_count_money', []],
['recharge_count', []],
['agent_level', 0],
]);
$where['label_id'] = toIntArray($where['label_id']);

View File

@ -273,45 +273,15 @@ class UserWechatUserDao extends BaseDao
}
}
// --- 充值次数筛选 (区间) ---
// recharge_count: [min, max] 统计 user_recharge 表中的记录数
if (isset($where['recharge_count']) && count($where['recharge_count']) == 2) {
$min = $where['recharge_count'][0];
$max = $where['recharge_count'][1];
if ($min !== '' || $max !== '') {
$model = $model->where(function ($query) use ($userAlias, $min, $max) {
// 子查询:通过分组统计充值记录数
$query->whereExists(function ($q) use ($userAlias, $min, $max) {
$q->name('user_recharge')
->whereColumn('uid', $userAlias . 'uid')
->field('uid')
->group('uid')
->having('COUNT(*) BETWEEN ' . (int)$min . ' AND ' . (int)$max);
});
// 特殊处理:包含无充值记录的用户
if ($min === '' || $min == 0) {
$query->whereOr(function ($q) use ($userAlias) {
$q->whereNotExists(function ($sub) use ($userAlias) {
$sub->name('user_recharge')
->whereColumn('uid', $userAlias . 'uid');
});
});
}
});
}
}
// --- 余额筛选 (区间) ---
// balance: [min, max]
if (isset($where['balance']) && count($where['balance']) == 2) {
if ($where['balance'][0] !== '' && $where['balance'][1] !== '') {
$model = $model->whereBetween($userAlias . 'now_money', $where['balance']);
} elseif ($where['balance'][0] !== '' && $where['balance'][1] === '') {
$model = $model->where($userAlias . 'now_money', '>', $where['balance'][0]);
$model = $model->where($userAlias . 'now_money', '>=', $where['balance'][0]);
} elseif ($where['balance'][0] === '' && $where['balance'][1] !== '') {
$model = $model->where($userAlias . 'now_money', '<', $where['balance'][1]);
$model = $model->where($userAlias . 'now_money', '<=', $where['balance'][1]);
}
}

View File

@ -129,21 +129,6 @@
class="form_range_content_width"
/>
</el-form-item>
<el-form-item label="充值次数:" label-for="store_name">
<el-input
clearable
placeholder="最小值"
v-model="userFrom.recharge_count[0]"
class="form_range_content_width"
/>
<span class="ml5 mr5">~</span>
<el-input
clearable
placeholder="最大值"
v-model="userFrom.recharge_count[1]"
class="form_range_content_width"
/>
</el-form-item>
<el-form-item label="访问情况:" label-for="user_time_type">
<el-select v-model="user_time_type" placeholder="请选择访问情况" clearable class="form_content_width">
<el-option value="" label="全部"></el-option>
@ -486,7 +471,6 @@ const userFrom = ref({
balance: ['', ''],
integral: ['', ''],
pay_count_money: ['', ''],
recharge_count: ['', ''],
user_time_type: '',
user_time: '',
before_pay_time: '',
@ -998,7 +982,6 @@ function reset(name) {
balance: ['', ''],
integral: ['', ''],
pay_count_money: ['', ''],
recharge_count: ['', ''],
user_time_type: '',
user_time: '',
before_pay_time: '',