feat: 管理端与用户端批量更新(订单/邀请双码/tabBar/审核与分销等)
- 管理端:用户详情、企业看板双小程序码、超管设置与用户列表等 - 后端:订单接口、邀请码企业版+个人版、分析与测试相关调整 - 微信小程序/抖音:自定义 tabBar 居中与拍摄钮上移、相机页与结果页、订单页、支付与统计 - 新增 faceResultDetail 工具与 mp 分析迁移脚本 Made-with: Cursor
This commit is contained in:
@@ -78,9 +78,28 @@ class AppUser extends BaseController
|
||||
$baseQuery->where($where);
|
||||
}
|
||||
|
||||
// 默认不展示「从未有过测试记录」的用户(企业后台按本企业 test_results 判定);?includeZeroTests=1 显示全部
|
||||
$includeZeroTests = Request::param('includeZeroTests', '');
|
||||
$showUntested = ($includeZeroTests === '1' || $includeZeroTests === 'true' || $includeZeroTests === true);
|
||||
if (!$showUntested) {
|
||||
$trQ = Db::name('test_results');
|
||||
if ($enterpriseId) {
|
||||
$trQ->where('enterpriseId', (int) $enterpriseId);
|
||||
}
|
||||
$testedUserIds = $trQ->distinct(true)->column('userId');
|
||||
$testedUserIds = array_values(array_unique(array_filter(array_map('intval', $testedUserIds))));
|
||||
if (empty($testedUserIds)) {
|
||||
return paginate_response([], 0, $page, $pageSize);
|
||||
}
|
||||
$baseQuery->whereIn('id', $testedUserIds);
|
||||
}
|
||||
|
||||
$total = (int) $baseQuery->count();
|
||||
$list = (clone $baseQuery)
|
||||
->field('id,nickname,openid,avatar,phone,gender,country,province,city,status,lastLoginAt,createdAt')
|
||||
->field([
|
||||
'id', 'nickname', 'openid', 'avatar', 'phone', 'gender',
|
||||
'country', 'province', 'city', 'status', 'lastLoginAt', 'createdAt',
|
||||
])
|
||||
->order('createdAt', 'desc')
|
||||
->page($page, $pageSize)
|
||||
->select()
|
||||
@@ -155,6 +174,9 @@ class AppUser extends BaseController
|
||||
|
||||
foreach ($list as &$row) {
|
||||
$id = $row['id'];
|
||||
$av = $row['avatar'] ?? '';
|
||||
$row['avatar'] = is_scalar($av) ? trim((string) $av) : '';
|
||||
$row['avatarUrl'] = $row['avatar'];
|
||||
$testsForUser = $testTypes[$id] ?? [];
|
||||
$row['username'] = $row['nickname'] ?? ('用户' . $id);
|
||||
$row['testCount'] = (int) ($testCounts[$id] ?? 0);
|
||||
@@ -172,6 +194,7 @@ class AppUser extends BaseController
|
||||
$row['paidOrders'] = $pay ? (int) ($pay['paidOrders'] ?? 0) : 0;
|
||||
$row['totalPaidAmount'] = $pay ? (int) ($pay['totalPaidAmount'] ?? 0) : 0;
|
||||
}
|
||||
unset($row);
|
||||
|
||||
return paginate_response($list, $total, $page, $pageSize);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user