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 0742f076
authored
Jul 09, 2021
by
Vladislav
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#19499 Загрузка модификаторов ставок
1 parent
4e80940c
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
5 deletions
app/Console/Commands/CampaignsLoadUpdated.php
app/Console/Commands/DictionaryCampaignsSyncByCampaign.php
app/Console/Kernel.php
app/Service/Requests/Direct/GetBidModifiers.php
app/Console/Commands/CampaignsLoadUpdated.php
View file @
0742f07
...
...
@@ -4,6 +4,7 @@ namespace App\Console\Commands;
use
App\Models\Campaigns
;
use
App\Models\Tokens
;
use
App\Service\Requests\Direct\GetBidModifiers
;
use
App\Service\Requests\Direct\GetCampaigns
;
use
Illuminate\Console\Command
;
...
...
@@ -63,11 +64,20 @@ class CampaignsLoadUpdated extends Command
->
get
();
foreach
(
$tokens
as
$token
)
{
$ids
=
$token
->
dictionaryCampaignsEnabledForExternalSynchronizedUpdatedSelf
->
pluck
(
'external_id'
)
->
toArray
();
$request
=
new
GetCampaigns
();
$request
->
setToken
(
$token
)
->
call
([
'ids'
=>
$token
->
dictionaryCampaignsEnabledForExternalSynchronizedUpdatedSelf
->
pluck
(
'external_id'
)
->
toArray
(),
'ids'
=>
$ids
,
]);
$request
=
new
GetBidModifiers
();
$request
->
setToken
(
$token
)
->
call
([
'CampaignIds'
=>
$ids
,
]);
}
...
...
app/Console/Commands/DictionaryCampaignsSyncByCampaign.php
View file @
0742f07
...
...
@@ -232,7 +232,7 @@ class DictionaryCampaignsSyncByCampaign extends Command
INNER JOIN campaigns c on bm.campaign_id = c.id
INNER JOIN dictionary_campaigns dc on dc.campaign_id = c.id
LEFT JOIN ad_groups ag on c.id = ag.campaign_id AND bm.ad_group_id = ag.id
LEFT JOIN goal_ad_groups gag on dc.
dictionary_
id = gag.dictionary_campaign_id AND ag.id = gag.ad_group_id
LEFT JOIN goal_ad_groups gag on dc.id = gag.dictionary_campaign_id AND ag.id = gag.ad_group_id
LEFT JOIN goal_bid_modifiers gbm on bm.id = gbm.bid_modifier_id and gbm.dictionary_campaign_id = dc.id
WHERE gbm.bid_modifier_id is null
"
);
...
...
app/Console/Kernel.php
View file @
0742f07
...
...
@@ -10,6 +10,7 @@ use App\Console\Commands\AdGroupsUpdate;
use
App\Console\Commands\AdvertisementsAdd
;
use
App\Console\Commands\AdvertisementsLoadUpdated
;
use
App\Console\Commands\AdvertisementsUpdate
;
use
App\Console\Commands\BidModifiersAdd
;
use
App\Console\Commands\CampaignsAdd
;
use
App\Console\Commands\CampaignsCheckChange
;
use
App\Console\Commands\CampaignsCheckUpdatedChildren
;
...
...
@@ -86,6 +87,8 @@ class Kernel extends ConsoleKernel
$schedule
->
command
(
AdGroupsAdd
::
class
)
->
hourlyAt
(
30
);
$schedule
->
command
(
AdGroupsUpdate
::
class
)
->
hourlyAt
(
30
);
$schedule
->
command
(
BidModifiersAdd
::
class
)
->
hourlyAt
(
35
);
$schedule
->
command
(
KeywordsAdd
::
class
)
->
hourlyAt
(
40
);
$schedule
->
command
(
KeywordsUpdate
::
class
)
->
hourlyAt
(
40
);
$schedule
->
command
(
KeywordsDelete
::
class
)
->
hourlyAt
(
40
);
...
...
app/Service/Requests/Direct/GetBidModifiers.php
View file @
0742f07
...
...
@@ -84,7 +84,7 @@ class GetBidModifiers extends DirectRequest
->
get
()
->
keyBy
(
'external_id'
);
$adGroups
=
AdGroup
::
whereIn
(
'external_id'
,
array_keys
(
$
campaign
s_external_ids
))
$adGroups
=
AdGroup
::
whereIn
(
'external_id'
,
array_keys
(
$
ad_group
s_external_ids
))
->
get
()
->
keyBy
(
'external_id'
);
}
else
{
...
...
@@ -100,8 +100,13 @@ class GetBidModifiers extends DirectRequest
continue
;
/* @var $adGroup AdGroup|null */
$adGroup
=
$adGroups
->
get
((
string
)
$bid_modifier
[
'AdGroupId'
])
;
$adGroup
=
null
;
$ad_group_external_id
=
(
string
)
$bid_modifier
[
'AdGroupId'
];
if
(
$ad_group_external_id
)
{
$adGroup
=
$adGroups
->
get
(
$ad_group_external_id
);
}
$external_id
=
(
string
)
$bid_modifier
[
'Id'
];
...
...
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