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 9b83cc01
authored
Jun 28, 2021
by
Vladislav
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove save var
1 parent
14cb7527
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
43 deletions
app/Service/Requests/Direct/UpdateAdGroups.php
app/Service/Requests/Direct/UpdateAds.php
app/Service/Requests/Direct/UpdateKeywords.php
app/Service/Requests/Direct/UpdateAdGroups.php
View file @
9b83cc0
...
...
@@ -19,8 +19,6 @@ class UpdateAdGroups extends DirectRequest
protected
$max_count
=
1000
;
protected
$timestamp
;
/* @var Collection|GoalAdGroup[] */
protected
$goalAdGroups
;
public
function
call
(
$params
=
null
)
{
...
...
@@ -74,22 +72,15 @@ class UpdateAdGroups extends DirectRequest
}
}
public
function
putParams
(
$params
)
{
$this
->
goalAdGroups
=
$params
[
'goalAdGroups'
];
}
private
function
requestPrepare
(
$params
)
{
$this
->
setService
(
'AdGroups'
);
$this
->
setMethod
(
'update'
);
$this
->
putParams
(
$params
);
$variables
=
Variable
::
all
();
$this
->
setParams
([
'AdGroups'
=>
$
this
->
goalAdGroups
->
map
(
function
(
GoalAdGroup
$goalAdGroup
)
use
(
$variables
)
{
'AdGroups'
=>
$
params
[
'goalAdGroups'
]
->
map
(
function
(
GoalAdGroup
$goalAdGroup
)
use
(
$variables
)
{
$list
=
Variable
::
getListVariablesByDictionaryCampaign
(
$goalAdGroup
->
dictionary_campaign_id
,
$variables
);
...
...
app/Service/Requests/Direct/UpdateAds.php
View file @
9b83cc0
...
...
@@ -9,8 +9,6 @@ use App\Models\Variable;
use
App\Service\Contract\APIRequest
;
use
App\Service\Requests\DirectRequest
;
use
App\Service\StrReplaceByVariables
;
use
Carbon\Carbon
;
use
Illuminate\Database\Eloquent\Collection
;
use
Illuminate\Support\Facades\Log
;
class
UpdateAds
extends
DirectRequest
...
...
@@ -18,8 +16,6 @@ class UpdateAds extends DirectRequest
protected
$max_count
=
1000
;
protected
$timestamp
;
/* @var Collection|GoalAdvertisement[]|Advertisement[]|\stdClass[] */
protected
$goalAds
;
public
function
call
(
$params
=
null
)
{
...
...
@@ -35,17 +31,7 @@ class UpdateAds extends DirectRequest
public
function
slice
(
$maxObjects
)
:
?
APIRequest
{
$splinter
=
$this
->
sliceByKey
(
$maxObjects
,
'Ads'
);
$splinter
->
putParams
([
'goalAds'
=>
$this
->
goalAds
->
slice
(
$maxObjects
)
->
values
(),
]);
$this
->
putParams
([
'goalAds'
=>
$this
->
goalAds
->
slice
(
0
,
$maxObjects
),
]);
return
$splinter
;
return
$this
->
sliceByKey
(
$maxObjects
,
'Ads'
);;
}
public
function
handle
(
$response
)
...
...
@@ -84,24 +70,17 @@ class UpdateAds extends DirectRequest
}
}
public
function
putParams
(
$params
)
{
$this
->
goalAds
=
$params
[
'goalAds'
];
}
private
function
requestPrepare
(
$params
)
{
$this
->
setService
(
'Ads'
);
$this
->
setMethod
(
'update'
);
$this
->
putParams
(
$params
);
$variables
=
Variable
::
all
();
$lists
=
[];
$this
->
setParams
([
'Ads'
=>
$
this
->
goalAds
->
map
(
function
(
$goalAdvertisement
)
use
(
$variables
,
&
$lists
)
{
'Ads'
=>
$
params
[
'goalAds'
]
->
map
(
function
(
$goalAdvertisement
)
use
(
$variables
,
&
$lists
)
{
/* @var $goalAdvertisement GoalAdvertisement|Advertisement|\stdClass */
...
...
app/Service/Requests/Direct/UpdateKeywords.php
View file @
9b83cc0
...
...
@@ -17,8 +17,6 @@ class UpdateKeywords extends DirectRequest
protected
$max_count
=
1000
;
protected
$timestamp
;
/* @var Collection|GoalKeyword[]|Keyword[]|\stdClass[] */
protected
$goalKeywords
;
public
function
call
(
$params
=
null
)
{
...
...
@@ -72,24 +70,17 @@ class UpdateKeywords extends DirectRequest
}
}
public
function
putParams
(
$params
)
{
$this
->
goalKeywords
=
$params
[
'goalKeywords'
];
}
private
function
requestPrepare
(
$params
)
{
$this
->
setService
(
'Keywords'
);
$this
->
setMethod
(
'update'
);
$this
->
putParams
(
$params
);
$variables
=
Variable
::
all
();
$lists
=
[];
$this
->
setParams
([
'Keywords'
=>
$
this
->
goalKeywords
->
map
(
function
(
$goalKeyword
)
use
(
$variables
,
&
$lists
)
{
'Keywords'
=>
$
params
[
'goalKeywords'
]
->
map
(
function
(
$goalKeyword
)
use
(
$variables
,
&
$lists
)
{
/* @var $goalKeyword GoalKeyword|Keyword|\stdClass */
...
...
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