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 7758777e
authored
Jul 16, 2021
by
Евгений
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Доработка загрузки и выгрзуки модификаторов.
1 parent
fe4c0af4
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
58 additions
and
3 deletions
app/Console/Commands/BidModifiersAdd.php
app/Models/BidModifier.php
app/Service/Requests/Direct/AddBidModifiers.php
app/Service/Requests/Direct/GetBidModifiers.php
database/migrations/2021_07_16_090704_update_bid_modifiers_table.php
app/Console/Commands/BidModifiersAdd.php
View file @
7758777
...
...
@@ -50,6 +50,8 @@ class BidModifiersAdd extends Command
foreach
(
$tokens
as
$token
)
{
$goalBidModifiers
=
DB
::
table
(
'goal_bid_modifiers'
)
->
join
(
'bid_modifiers'
,
'goal_bid_modifiers.bid_modifier_id'
,
'='
,
'bid_modifiers.id'
)
->
join
(
'dictionary_campaigns'
,
'goal_bid_modifiers.dictionary_campaign_id'
,
'='
,
'dictionary_campaigns.id'
)
->
join
(
'dictionaries'
,
'dictionaries.id'
,
'='
,
'dictionary_campaigns.dictionary_id'
)
->
whereNull
(
'bid_modifiers.deleted_at'
)
->
whereNull
(
'goal_bid_modifiers.external_id'
)
->
whereNull
(
'goal_bid_modifiers.reserve_create_at'
)
...
...
@@ -67,13 +69,17 @@ class BidModifiersAdd extends Command
'goal_bid_modifiers.goal_ad_group_external_id'
,
'bid_modifiers.mobile_adjustment'
,
'bid_modifiers.desktop_adjustment'
,
'bid_modifiers.video_adjustment'
,
'dictionaries.region_id'
,
])
->
select
([
DB
::
raw
(
'json_arrayagg(goal_bid_modifiers.id) as ids'
),
'goal_bid_modifiers.dictionary_campaign_external_id as dictionary_campaign_external_id'
,
'goal_bid_modifiers.goal_ad_group_external_id as goal_ad_group_external_id'
,
'bid_modifiers.mobile_adjustment as mobile_adjustment'
,
'bid_modifiers.video_adjustment as video_adjustment'
,
'bid_modifiers.desktop_adjustment as desktop_adjustment'
,
'dictionaries.region_id'
,
DB
::
raw
(
'json_arrayagg(bid_modifiers.demographics_adjustment) as demographics_adjustments'
),
DB
::
raw
(
'json_arrayagg(bid_modifiers.retargeting_adjustment) as retargeting_adjustments'
),
])
...
...
@@ -93,13 +99,14 @@ class BidModifiersAdd extends Command
]);
}
if
(
!
empty
(
$goalBidModifiers
)){
$request
=
new
AddBidModifiers
();
$request
->
setToken
(
$token
)
->
call
([
'goalBidModifiers'
=>
$goalBidModifiers
,
]);
}
}
return
0
;
}
...
...
app/Models/BidModifier.php
View file @
7758777
...
...
@@ -38,6 +38,8 @@ class BidModifier extends Model
'desktop_adjustment'
,
'demographics_adjustment'
,
'retargeting_adjustment'
,
'video_adjustment'
,
'regional_adjustment'
,
'updated_self'
,
...
...
app/Service/Requests/Direct/AddBidModifiers.php
View file @
7758777
...
...
@@ -162,9 +162,12 @@ class AddBidModifiers extends DirectRequest
},
array_filter
(
@
json_decode
(
$goalBidModifier
->
retargeting_adjustments
,
true
))))
{
$data
[
'RetargetingAdjustments'
]
=
$retargeting_adjustments
;
}
elseif
(
$video_adjustment
=
@
json_decode
(
$goalBidModifier
->
video_adjustment
,
true
))
{
$data
[
'VideoAdjustment'
]
=
$video_adjustment
;
}
return
$data
;
...
...
app/Service/Requests/Direct/GetBidModifiers.php
View file @
7758777
...
...
@@ -59,7 +59,7 @@ class GetBidModifiers extends DirectRequest
if
(
!
isset
(
$response
[
'result'
][
'BidModifiers'
]))
{
return
;
}
Log
::
debug
(
print_r
(
$response
[
'result'
],
true
));
$campaigns_external_ids
=
[];
$ad_groups_external_ids
=
[];
...
...
@@ -126,6 +126,7 @@ class GetBidModifiers extends DirectRequest
'desktop_adjustment'
=>
$bid_modifier
[
'DesktopAdjustment'
]
??
null
,
'demographics_adjustment'
=>
$bid_modifier
[
'DemographicsAdjustment'
]
??
null
,
'retargeting_adjustment'
=>
$bid_modifier
[
'RetargetingAdjustment'
]
??
null
,
'video_adjustment'
=>
$bid_modifier
[
'VideoAdjustment'
]
??
null
,
'updated_self'
=>
null
,
...
...
@@ -203,6 +204,7 @@ class GetBidModifiers extends DirectRequest
BidModifier
::
TYPE_DESKTOP_ADJUSTMENT
,
BidModifier
::
TYPE_DEMOGRAPHICS_ADJUSTMENT
,
BidModifier
::
TYPE_RETARGETING_ADJUSTMENT
,
BidModifier
::
TYPE_VIDEO_ADJUSTMENT
,
],
"Levels"
=>
[
BidModifier
::
LEVEL_AD_GROUP
,
...
...
@@ -218,6 +220,12 @@ class GetBidModifiers extends DirectRequest
"DesktopAdjustmentFieldNames"
=>
[
"BidModifier"
,
],
"VideoAdjustmentFieldNames"
=>
[
"BidModifier"
,
],
"RegionalAdjustmentFieldNames"
=>
[
"RegionId"
,
"BidModifier"
,
"Enabled"
,
],
"DemographicsAdjustmentFieldNames"
=>
[
"Gender"
,
"Age"
,
"BidModifier"
,
"Enabled"
,
],
...
...
database/migrations/2021_07_16_090704_update_bid_modifiers_table.php
0 → 100644
View file @
7758777
<?php
use
App\Models\BidModifier
;
use
Illuminate\Database\Migrations\Migration
;
use
Illuminate\Database\Schema\Blueprint
;
use
Illuminate\Support\Facades\Schema
;
class
UpdateBidModifiersTable
extends
Migration
{
/**
* Run the migrations.
*
* @return void
*/
public
function
up
()
{
Schema
::
table
(
'bid_modifiers'
,
function
(
Blueprint
$table
)
{
$table
->
json
(
'video_adjustment'
)
->
nullable
();
$table
->
json
(
'regional_adjustment'
)
->
nullable
();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public
function
down
()
{
Schema
::
table
(
'bid_modifiers'
,
function
(
Blueprint
$table
)
{
$table
->
dropColumn
(
'video_adjustment'
)
->
nullable
();
$table
->
dropColumn
(
'regional_adjustment'
)
->
nullable
();
});
}
}
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