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 cb6bae98
authored
Jun 18, 2021
by
Vladislav
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Исправление типов аргументов
1 parent
a0692877
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
19 deletions
app/Service/Requests/Direct/AddKeywords.php
app/Service/Requests/Direct/AddKeywords.php
View file @
cb6bae9
...
@@ -9,13 +9,14 @@ use App\Service\Requests\DirectRequest;
...
@@ -9,13 +9,14 @@ use App\Service\Requests\DirectRequest;
use
App\Service\StrReplaceByVariables
;
use
App\Service\StrReplaceByVariables
;
use
Carbon\Carbon
;
use
Carbon\Carbon
;
use
Illuminate\Support\Facades\Log
;
use
Illuminate\Support\Facades\Log
;
use
Ramsey\Collection\Collection
;
class
AddKeywords
extends
DirectRequest
class
AddKeywords
extends
DirectRequest
{
{
protected
$max_count
=
1000
;
protected
$max_count
=
1000
;
protected
$timestamp
;
protected
$timestamp
;
/* @var
array
*/
/* @var
Collection
*/
protected
$goalKeywords
;
protected
$goalKeywords
;
public
function
call
(
$params
=
null
)
public
function
call
(
$params
=
null
)
...
@@ -35,11 +36,11 @@ class AddKeywords extends DirectRequest
...
@@ -35,11 +36,11 @@ class AddKeywords extends DirectRequest
$splinter
=
$this
->
sliceByKey
(
$maxObjects
,
'Keywords'
);
$splinter
=
$this
->
sliceByKey
(
$maxObjects
,
'Keywords'
);
$splinter
->
putParams
([
$splinter
->
putParams
([
'goalKeywords'
=>
array_values
(
array_slice
(
$this
->
goalKeywords
,
$maxObjects
)
),
'goalKeywords'
=>
$this
->
goalKeywords
->
slice
(
$maxObjects
)
->
values
(
),
]);
]);
$this
->
putParams
([
$this
->
putParams
([
'goalKeywords'
=>
array_values
(
array_slice
(
$this
->
goalKeywords
,
0
,
$maxObjects
)),
'goalKeywords'
=>
$this
->
goalKeywords
->
slice
(
0
,
$maxObjects
)
]);
]);
return
$splinter
;
return
$splinter
;
...
@@ -98,38 +99,38 @@ class AddKeywords extends DirectRequest
...
@@ -98,38 +99,38 @@ class AddKeywords extends DirectRequest
$lists
=
[];
$lists
=
[];
$this
->
setParams
([
$this
->
setParams
([
'Keywords'
=>
array_map
(
function
(
array
$goalKeyword
)
use
(
$variables
,
$lists
)
{
'Keywords'
=>
$this
->
goalKeywords
->
map
(
function
(
$goalKeyword
)
use
(
$variables
,
$lists
)
{
if
(
!
isset
(
$lists
[
$goalKeyword
[
'dictionary_campaign_id'
]
]))
{
if
(
!
isset
(
$lists
[
$goalKeyword
->
dictionary_campaign_id
]))
{
$list
=
Variable
::
getListVariablesByDictionaryCampaign
(
$goalKeyword
[
'dictionary_campaign_id'
]
,
$variables
);
$list
=
Variable
::
getListVariablesByDictionaryCampaign
(
$goalKeyword
->
dictionary_campaign_id
,
$variables
);
$lists
[
$goalKeyword
[
'dictionary_campaign_id'
]
]
=
$list
;
$lists
[
$goalKeyword
->
dictionary_campaign_id
]
=
$list
;
}
else
{
}
else
{
$list
=
$lists
[
$goalKeyword
[
'dictionary_campaign_id'
]
];
$list
=
$lists
[
$goalKeyword
->
dictionary_campaign_id
];
}
}
$data
=
[
$data
=
[
'Keyword'
=>
StrReplaceByVariables
::
getInstance
(
$goalKeyword
[
'keyword'
]
,
$list
)
->
get
(),
'Keyword'
=>
StrReplaceByVariables
::
getInstance
(
$goalKeyword
->
keyword
,
$list
)
->
get
(),
'AdGroupId'
=>
$goalKeyword
[
'goal_ad_group_external_id'
]
,
'AdGroupId'
=>
$goalKeyword
->
goal_ad_group_external_id
,
];
];
if
(
$goalKeyword
[
'bid'
]
)
{
if
(
$goalKeyword
->
bid
)
{
$data
[
'Bid'
]
=
$goalKeyword
[
'bid'
]
;
$data
[
'Bid'
]
=
$goalKeyword
->
bid
;
}
}
if
(
$goalKeyword
[
'context_bid'
]
)
{
if
(
$goalKeyword
->
context_bid
)
{
$data
[
'ContextBid'
]
=
$goalKeyword
[
'context_bid'
]
;
$data
[
'ContextBid'
]
=
$goalKeyword
->
context_bid
;
}
}
if
(
$goalKeyword
[
'user_param_1'
]
)
{
if
(
$goalKeyword
->
user_param_1
)
{
$data
[
'UserParam1'
]
=
$goalKeyword
[
'user_param_1'
]
;
$data
[
'UserParam1'
]
=
$goalKeyword
->
user_param_1
;
}
}
if
(
$goalKeyword
[
'user_param_2'
]
)
{
if
(
$goalKeyword
->
user_param_2
)
{
$data
[
'UserParam2'
]
=
$goalKeyword
[
'user_param_2'
]
;
$data
[
'UserParam2'
]
=
$goalKeyword
->
user_param_2
;
}
}
return
$data
;
return
$data
;
}
,
$this
->
goalKeywords
),
}),
]);
]);
}
}
...
...
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