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 e9d069be
authored
Jun 09, 2021
by
Vladislav
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#19472 Синхронизация групп с целевыми
1 parent
3631766d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
1 deletions
app/Console/Commands/AdGroupsLoadUpdated.php
app/Console/Commands/CampaignsCheckUpdatedChildrenAdGroups.php
app/Models/AdGroup.php
app/Service/Requests/Direct/CheckChanges.php
app/Console/Commands/AdGroupsLoadUpdated.php
View file @
e9d069b
...
...
@@ -48,7 +48,7 @@ class AdGroupsLoadUpdated extends Command
*/
public
function
handle
()
{
$adGroups
=
AdGroup
::
forUpdatedSelf
()
->
get
();
$adGroups
=
AdGroup
::
has
(
'campaignForEnabledForManaged'
)
->
forUpdatedSelf
()
->
get
();
if
(
!
$adGroups
->
count
())
{
return
;
}
...
...
app/Console/Commands/CampaignsCheckUpdatedChildrenAdGroups.php
View file @
e9d069b
...
...
@@ -82,6 +82,7 @@ class CampaignsCheckUpdatedChildrenAdGroups extends Command
'FieldNames'
=>
[
'AdGroupIds'
,
],
'Timestamp'
=>
$token
->
check_changes_ad_group_at
->
toIso8601ZuluString
(),
]);
}
...
...
app/Models/AdGroup.php
View file @
e9d069b
...
...
@@ -29,6 +29,7 @@ use Illuminate\Support\Collection;
* @property \Illuminate\Support\Carbon|null $created_at
* @property \Illuminate\Support\Carbon|null $updated_at
* @property-read \App\Models\Campaigns $campaign
* @property-read \App\Models\Campaigns|null $campaignForEnabledForManaged
* @property-read \Illuminate\Database\Eloquent\Collection|GoalAdGroup[] $goalGroups
* @property-read int|null $goal_groups_count
* @method static Builder|AdGroup forUpdatedSelf()
...
...
@@ -192,4 +193,9 @@ class AdGroup extends Model
return
$this
->
belongsTo
(
Campaigns
::
class
,
'campaign_id'
);
}
public
function
campaignForEnabledForManaged
()
{
return
$this
->
campaign
()
->
forEnabled
()
->
forManaged
();
}
}
app/Service/Requests/Direct/CheckChanges.php
View file @
e9d069b
...
...
@@ -57,6 +57,11 @@ class CheckChanges extends DirectRequest
public
function
handle
(
$response
)
{
if
(
!
isset
(
$response
[
'result'
]))
{
Log
::
debug
(
$response
);
return
;
}
if
(
isset
(
$response
[
'result'
][
'NotFound'
]))
{
Log
::
debug
(
$response
[
'result'
][
'NotFound'
]);
}
...
...
@@ -65,6 +70,7 @@ class CheckChanges extends DirectRequest
Log
::
debug
(
$response
[
'result'
][
'Unprocessed'
]);
}
if
(
isset
(
$response
[
'result'
][
'Modified'
][
'AdGroupIds'
]))
{
foreach
(
$response
[
'result'
][
'Modified'
][
'AdGroupIds'
]
as
$ad_group_id
)
{
...
...
@@ -108,6 +114,7 @@ class CheckChanges extends DirectRequest
]);
}
$this
->
getToken
()
->
update
([
'check_changes_ad_group'
=>
Carbon
::
parse
(
$response
[
'result'
][
'Timestamp'
]),
]);
...
...
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