feat: 优化用户查询,按ID降序排列注册和绑定手机号的用户
This commit is contained in:
parent
9348ddeab2
commit
111a7fb1a2
|
@ -117,12 +117,14 @@ class PromotionController
|
||||||
// 获取注册的用户详细信息(筛选注册时间段)
|
// 获取注册的用户详细信息(筛选注册时间段)
|
||||||
$res['register_user'] = User::whereIn('id', $users)
|
$res['register_user'] = User::whereIn('id', $users)
|
||||||
->whereBetween('created_at', [$startDate . ' 00:00:00', $endDate . ' 23:59:59']) // 时间范围筛选
|
->whereBetween('created_at', [$startDate . ' 00:00:00', $endDate . ' 23:59:59']) // 时间范围筛选
|
||||||
|
->orderBy('id', 'desc')
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
// 获取绑定手机号的用户详细信息
|
// 获取绑定手机号的用户详细信息
|
||||||
$userIdsWithPhones = $UserPhone->pluck('user_id')->toArray(); // 获取绑定手机号的用户 ID 列表
|
$userIdsWithPhones = $UserPhone->pluck('user_id')->toArray(); // 获取绑定手机号的用户 ID 列表
|
||||||
$res['binding_user'] = User::whereIn('id', $userIdsWithPhones)
|
$res['binding_user'] = User::whereIn('id', $userIdsWithPhones)
|
||||||
->whereBetween('created_at', [$startDate . ' 00:00:00', $endDate . ' 23:59:59']) // 时间范围筛选
|
->whereBetween('created_at', [$startDate . ' 00:00:00', $endDate . ' 23:59:59']) // 时间范围筛选
|
||||||
|
->orderBy('id', 'desc')
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
return ApiResponse::success(200, $res);
|
return ApiResponse::success(200, $res);
|
||||||
|
|
Loading…
Reference in New Issue