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 14cb7527
authored
Jun 25, 2021
by
Vladislav
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#20359 Каждый час обновляются РК
1 parent
ff62e9ce
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
12 additions
and
10 deletions
app/Console/Commands/CampaignsUpdate.php
app/Service/Requests/Direct/AddAds.php
app/Service/Requests/Direct/GetCampaigns.php
app/Service/Requests/Direct/UpdateAdGroups.php
app/Service/Requests/Direct/UpdateCampaigns.php
app/Console/Commands/CampaignsUpdate.php
View file @
14cb752
...
...
@@ -40,7 +40,7 @@ class CampaignsUpdate extends Command
*/
public
function
handle
()
{
$tokens
=
Tokens
::
whereHas
(
'dictionaryCampaignsEnabledForExternalUpdatedNeedUpdated'
)
$tokens
=
Tokens
::
whereHas
(
'dictionaryCampaignsEnabledForExternalUpdatedNeedUpdated
.campaign
'
)
->
with
(
'dictionaryCampaignsEnabledForExternalUpdatedNeedUpdated.campaign'
)
->
where
(
'type'
,
'!='
,
Tokens
::
MAIN
)
->
get
();
...
...
app/Service/Requests/Direct/AddAds.php
View file @
14cb752
...
...
@@ -51,7 +51,6 @@ class AddAds extends DirectRequest
public
function
handle
(
$response
)
{
try
{
\Log
::
debug
(
$response
);
if
(
isset
(
$response
[
'result'
][
'Errors'
]))
{
Log
::
debug
(
$response
[
'Errors'
]);
Log
::
debug
(
$this
->
getParams
());
...
...
app/Service/Requests/Direct/GetCampaigns.php
View file @
14cb752
...
...
@@ -7,6 +7,7 @@ use App\Models\Campaigns;
use
App\Models\Pivots\DictionaryCampaign
;
use
App\Service\Contract\APIRequest
;
use
App\Service\Requests\DirectRequest
;
use
Carbon\Carbon
;
use
Illuminate\Support\Facades\Log
;
class
GetCampaigns
extends
DirectRequest
...
...
@@ -25,7 +26,7 @@ class GetCampaigns extends DirectRequest
public
function
getObjectsCount
()
{
$params
=
$this
->
getParams
();
if
(
isset
(
$params
[
'SelectionCriteria'
][
'Ids'
])){
if
(
isset
(
$params
[
'SelectionCriteria'
][
'Ids'
]))
{
return
count
(
$params
[
'SelectionCriteria'
][
'Ids'
]);
}
return
-
1
;
...
...
@@ -35,7 +36,7 @@ class GetCampaigns extends DirectRequest
{
$params
=
$this
->
getParams
();
if
(
isset
(
$params
[
'SelectionCriteria'
][
'Ids'
])){
if
(
isset
(
$params
[
'SelectionCriteria'
][
'Ids'
]))
{
return
$this
->
sliceByKey
(
$maxObjects
,
[
'SelectionCriteria'
,
'Ids'
]);
}
...
...
@@ -83,7 +84,9 @@ class GetCampaigns extends DirectRequest
continue
;
$dictionaryCampaign
->
update
(
$dictionaryCampaign
::
copyPropertyFromMain
(
$campaign_data
)
array_merge
([
'updated_self'
=>
null
,
],
$dictionaryCampaign
::
copyPropertyFromMain
(
$campaign_data
))
);
}
...
...
app/Service/Requests/Direct/UpdateAdGroups.php
View file @
14cb752
...
...
@@ -115,17 +115,17 @@ class UpdateAdGroups extends DirectRequest
$data
[
'SmartAdGroup'
]
=
$goalAdGroup
->
group
->
smart_ad_group
;
}
if
(
$goalAdGroup
->
group
->
negative_keywords
&&
count
(
$goalAdGroup
->
group
->
negative_keywords
))
{
if
(
$goalAdGroup
->
group
->
negative_keywords
&&
isset
(
$goalAdGroup
->
group
->
negative_keywords
[
'Items'
])
&&
count
(
$goalAdGroup
->
group
->
negative_keywords
[
'Items'
]
))
{
$data
[
'NegativeKeywords'
]
=
[
'Items'
=>
array_map
(
function
(
$value
)
use
(
$list
)
{
return
StrReplaceByVariables
::
getInstance
(
$value
,
$list
)
->
get
();
},
$goalAdGroup
->
group
->
negative_keywords
),
},
$goalAdGroup
->
group
->
negative_keywords
[
'Items'
]
),
];
}
if
(
$goalAdGroup
->
group
->
negative_keyword_shared_set_ids
&&
count
(
$goalAdGroup
->
group
->
negative_keyword_shared_set_ids
))
{
if
(
$goalAdGroup
->
group
->
negative_keyword_shared_set_ids
&&
isset
(
$goalAdGroup
->
group
->
negative_keyword_shared_set_ids
[
'Items'
])
&&
count
(
$goalAdGroup
->
group
->
negative_keyword_shared_set_ids
[
'Items'
]
))
{
$data
[
'NegativeKeywordSharedSetIds'
]
=
[
'Items'
=>
$goalAdGroup
->
group
->
negative_keyword_shared_set_ids
,
'Items'
=>
$goalAdGroup
->
group
->
negative_keyword_shared_set_ids
[
'Items'
]
,
];
}
...
...
app/Service/Requests/Direct/UpdateCampaigns.php
View file @
14cb752
...
...
@@ -44,7 +44,7 @@ class UpdateCampaigns extends DirectRequest
Log
::
debug
(
$this
->
getParams
());
}
if
(
isset
(
$response
[
'result'
][
'UpdateResults'
]))
{
if
(
!
isset
(
$response
[
'result'
][
'UpdateResults'
]))
{
return
;
}
...
...
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