Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
杨树贤
/
ic_welfare
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
a84bf01b
authored
Oct 16, 2019
by
叶明星
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
修复bug
parent
3836e5f6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
7 deletions
app/Http/Transformers/InviteTransformer.php
app/Http/Transformers/InviteTransformer.php
View file @
a84bf01b
...
...
@@ -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
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment