Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Cong.Zhao
/
musician-api.hikoon.com
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
9da69faa
...
9da69faa43fa9c9c4c50013caf2f17e329d97e4d
authored
2021-09-18 14:49:01 +0800
by
lemon
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
*
1 parent
1a525e07
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
app/Console/Commands/DealSongIp.php
app/Console/Commands/DealSongIp.php
View file @
9da69fa
...
...
@@ -51,17 +51,17 @@ class DealSongIp extends Command
foreach
(
$company_ids
as
$company_id
)
{
SongsIp
::
query
()
->
select
([
'id'
,
'song_id'
,
'custom_id'
])
->
chunk
(
5
000
,
function
(
$res
)
{
SongsIp
::
query
()
->
select
([
'id'
,
'song_id'
,
'custom_id'
])
->
chunk
(
2
000
,
function
(
$res
)
{
$res
=
$res
->
toArray
();
$custom_ids
=
array_column
(
$res
,
'custom_id'
);
if
(
!
empty
(
$custom_ids
))
{
$songs
=
Song
::
query
()
->
whereIn
(
'custom_id'
,
$custom_ids
)
->
select
([])
->
get
()
->
keyBy
(
'custom_id'
)
->
toArray
();
$songs
=
Song
::
query
()
->
whereIn
(
'custom_id'
,
$custom_ids
)
->
select
([
'id'
,
'custom_id'
])
->
get
()
->
keyBy
(
'custom_id'
)
->
toArray
();
foreach
(
$res
as
$item
)
{
if
(
isset
(
$songs
[
$item
[
'custom_id'
]]))
{
SongsIp
::
query
()
->
where
([
'id'
=>
$item
[
'id'
]])
->
update
([
'song_id'
=>
$
item
[
'id'
]]);
SongsIp
::
query
()
->
where
([
'id'
=>
$item
[
'id'
]])
->
update
([
'song_id'
=>
$
songs
[
$item
[
'custom_id'
]]
[
'id'
]]);
}
else
{
SongsIp
::
query
()
->
where
([
'id'
=>
$item
[
'id'
]])
->
update
([
'song_id'
=>
0
]);
}
...
...
Please
register
or
sign in
to post a comment