Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Письменов Дмитрий Иванович
/
yourroomads
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 41f8490a
authored
Sep 17, 2021
by
Vladislav
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Оптимизация удаление визиток
1 parent
e7bcf03d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
9 deletions
app/Console/Commands/VCardsDelete.php
app/Console/Kernel.php
app/Models/Pivots/DictionaryCampaign.php
app/Service/Requests/Direct/DeleteVCards.php
app/Console/Commands/VCardsDelete.php
View file @
41f8490
...
...
@@ -58,14 +58,14 @@ class VCardsDelete extends Command
return
0
;
}
private
function
sendRequest
(
$token
,
$
a
ds
)
private
function
sendRequest
(
$token
,
$
vCar
ds
)
{
/* @var $
a
ds VCard[]|GoalVCard[] */
if
(
!
$
a
ds
->
count
())
{
/* @var $
vCar
ds VCard[]|GoalVCard[] */
if
(
!
$
vCar
ds
->
count
())
{
return
;
}
foreach
(
array_chunk
(
$
a
ds
->
pluck
(
'external_id'
)
->
toArray
(),
1000
)
as
$items
)
{
foreach
(
array_chunk
(
$
vCar
ds
->
pluck
(
'external_id'
)
->
toArray
(),
1000
)
as
$items
)
{
if
(
$token
->
isMain
())
{
VCard
::
whereIn
(
'external_id'
,
$items
)
->
update
([
...
...
@@ -79,10 +79,12 @@ class VCardsDelete extends Command
}
}
exit
();
$request
=
new
DeleteVCards
();
$request
->
setToken
(
$token
)
->
call
([
'ids'
=>
$
a
ds
->
pluck
(
'external_id'
)
->
toArray
(),
'ids'
=>
$
vCar
ds
->
pluck
(
'external_id'
)
->
toArray
(),
]);
}
...
...
app/Console/Kernel.php
View file @
41f8490
...
...
@@ -69,7 +69,6 @@ class Kernel extends ConsoleKernel
*/
protected
function
schedule
(
Schedule
$schedule
)
{
return
;
$schedule
->
command
(
DictionaryCampaignsSyncByCampaign
::
class
)
->
everyThirtyMinutes
();
...
...
app/Models/Pivots/DictionaryCampaign.php
View file @
41f8490
...
...
@@ -540,7 +540,7 @@ class DictionaryCampaign extends Pivot
$query
->
whereNotNull
(
'goal_advertisements.archive_at'
)
->
orWhereNotNull
(
'goal_advertisements.deleted_at'
)
->
orWhereNull
(
'goal_advertisements.id'
);
})
->
forExternal
()
->
forNotReserveDelete
();
})
->
forExternal
()
->
forNotReserveDelete
()
->
select
(
'goal_v_cards.*'
)
;
}
public
function
goalAudienceTargets
()
...
...
app/Service/Requests/Direct/DeleteVCards.php
View file @
41f8490
...
...
@@ -29,7 +29,7 @@ class DeleteVCards extends DirectRequest
public
function
slice
(
$maxObjects
)
:
?
APIRequest
{
return
$this
->
sliceByKey
(
$maxObjects
,
[
'SelectionCriteria'
,
'Ids'
]);
;
return
$this
->
sliceByKey
(
$maxObjects
,
[
'SelectionCriteria'
,
'Ids'
]);
}
public
function
handle
(
$response
)
...
...
@@ -117,7 +117,7 @@ class DeleteVCards extends DirectRequest
'reserve_delete_at'
=>
null
,
]);
}
else
{
VCard
::
whereIn
(
'external_id'
,
$this
->
getParams
()[
'SelectionCriteria'
][
'Ids'
])
Goal
VCard
::
whereIn
(
'external_id'
,
$this
->
getParams
()[
'SelectionCriteria'
][
'Ids'
])
->
update
([
'reserve_delete_at'
=>
null
,
]);
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment