Commit a84bf01b by 叶明星

修复bug

parent 3836e5f6
Showing with 14 additions and 7 deletions
......@@ -19,6 +19,9 @@ class InviteTransformer
{
if (isset($data['data'])&&is_array($data['data'])) {
$userIds = array_column($data['data'], 'user_id');
$invitedUserIds = array_column($data['data'], 'invited_user_id');
$userIds = array_merge($userIds, $invitedUserIds);
$userIds = array_unique($userIds);
if ($userIds) {
$users = $this->service->getUsersFromRedis($userIds);
$mobiles = [];
......@@ -26,19 +29,23 @@ class InviteTransformer
$mobiles[$user['user_id']] = $user['mobile'];
}
$invitedUserIds = array_column($data['data'], 'invited_user_id');
$invitedUsers = $this->service->getUsersFromRedis($invitedUserIds);
$invitedUserMobiles = [];
foreach ($users as $invitedUsers) {
$invitedUserMobiles[$invitedUsers['user_id']] = $user['mobile'];
}
// $invitedUserIds = array_column($data['data'], 'invited_user_id');
// $invitedUsers = $this->service->getUsersFromRedis($invitedUserIds);
// $invitedUserMobiles = [];
// dd($users);
// foreach ($users as $invitedUsers) {
// $invitedUserMobiles[$invitedUsers['user_id']] = $mobiles[$invitedUsers['user_id']];
// }
foreach ($data['data'] as &$item) {
//获取邀请人的手机
$item['mobile'] = array_get($mobiles, $item['user_id']);
$item['add_time'] = date('Y-m-d H:i:s', $item['add_time']);
//获取被邀请人的手机
$item['invited_user_mobile'] = array_get($invitedUserMobiles,$item['user_id']);
$item['invited_user_mobile'] = array_get($mobiles,$item['invited_user_id']);
// if(empty($item['invited_user_mobile'])){
// dd($item['invited_user_id']);
// }
}
}
unset($item);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment