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 3bf1442d
authored
Jul 12, 2021
by
Vladislav
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#20364 Загрузка и синхронизация расширений
1 parent
beb1867e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
1 deletions
app/Console/Commands/DictionaryCampaignsSyncByCampaign.php
app/Service/Requests/Direct/GetAds.php
app/Console/Commands/DictionaryCampaignsSyncByCampaign.php
View file @
3bf1442
...
@@ -208,6 +208,44 @@ class DictionaryCampaignsSyncByCampaign extends Command
...
@@ -208,6 +208,44 @@ class DictionaryCampaignsSyncByCampaign extends Command
and (ad.v_card_external_id is null or (ad.v_card_external_id is not null and vc.id is not null))
and (ad.v_card_external_id is null or (ad.v_card_external_id is not null and vc.id is not null))
"
);
"
);
//обновляем связи целевых объявлений.
DB
::
insert
(
"
UPDATE goal_advertisements gad
INNER JOIN advertisements ad on ad.id = gad.advertisement_id
INNER JOIN ad_groups ag on ad.ad_group_id = ag.id
INNER JOIN goal_ad_groups gag on ag.id = gag.ad_group_id
INNER JOIN dictionaries d on gag.dictionary_campaign_id = d.id
LEFT JOIN v_cards vc on ad.v_card_external_id = vc.external_id
LEFT JOIN goal_v_cards gvc on vc.id = gvc.v_card_id and gag.dictionary_campaign_id = gvc.dictionary_campaign_id
LEFT JOIN sitelinks s on ad.sitelink_external_id = s.external_id
LEFT JOIN goal_sitelinks gs on s.id = gs.sitelink_id and gs.token_id = d.token_id
SET gad.goal_v_card_id = gvc.id,
gad.goal_v_card_external_id = gvc.external_id,
gad.goal_sitelink_id = gs.id,
gad.goal_sitelink_external_id = gs.external_id,
gad.updated_at = CURRENT_TIMESTAMP
WHERE (
(
gad.goal_sitelink_id != gs.id
or
(gad.goal_sitelink_id is null and gs.id is not null)
or
(gad.goal_sitelink_id is not null and gs.id is null)
)
or
(
gad.goal_v_card_id != gvc.id
or
(gad.goal_v_card_id is null and gvc.id is not null)
or
(gad.goal_v_card_id is not null and gvc.id is null)
)
)
"
);
//грузим связь объявлений к расширения которых по какой то причне нет в целевых.
//грузим связь объявлений к расширения которых по какой то причне нет в целевых.
DB
::
insert
(
"
DB
::
insert
(
"
INSERT INTO goal_advertisement_goal_ad_extensions(goal_advertisement_id, goal_ad_extension_id, created_at, updated_at)
INSERT INTO goal_advertisement_goal_ad_extensions(goal_advertisement_id, goal_ad_extension_id, created_at, updated_at)
...
@@ -223,6 +261,16 @@ class DictionaryCampaignsSyncByCampaign extends Command
...
@@ -223,6 +261,16 @@ class DictionaryCampaignsSyncByCampaign extends Command
WHERE gagae.goal_ad_extension_id is null
WHERE gagae.goal_ad_extension_id is null
"
);
"
);
//Удаляем лишнии связи объявлений к расширениям.
DB
::
insert
(
"
DELETE goal_advertisement_goal_ad_extensions
FROM goal_advertisement_goal_ad_extensions
INNER JOIN goal_advertisements ga on goal_advertisement_goal_ad_extensions.goal_advertisement_id = ga.id
INNER JOIN goal_ad_extensions gae on goal_advertisement_goal_ad_extensions.goal_ad_extension_id = gae.id
INNER JOIN advertisements a on ga.advertisement_id = a.id
LEFT JOIN advertisement_ad_extensions aae on a.id = aae.advertisement_id and gae.ad_extension_id = aae.ad_extension_id
WHERE aae.ad_extension_id is null"
);
//грузим расширения которых по какой то причне нет в целевых.
//грузим расширения которых по какой то причне нет в целевых.
DB
::
insert
(
"
DB
::
insert
(
"
INSERT INTO goal_retargetinglists(retargetinglist_id, token_id, created_at, updated_at)
INSERT INTO goal_retargetinglists(retargetinglist_id, token_id, created_at, updated_at)
...
...
app/Service/Requests/Direct/GetAds.php
View file @
3bf1442
...
@@ -85,7 +85,7 @@ class GetAds extends DirectRequest
...
@@ -85,7 +85,7 @@ class GetAds extends DirectRequest
$ad_group
=
$ad_groups
->
get
((
string
)
$ad
[
'AdGroupId'
]);
$ad_group
=
$ad_groups
->
get
((
string
)
$ad
[
'AdGroupId'
]);
if
(
!
$ad_group
)
if
(
!
$ad_group
||
!
$ad_group
->
campaign
)
continue
;
continue
;
...
...
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