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 32fbf630
authored
Aug 02, 2022
by
Vladislav
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#23509 Отключение получения и обновления списка условий ретаргетинга/аудиторий
1 parent
631665f1
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
90 additions
and
3 deletions
app/Console/Commands/BidModifiersAdd.php
app/Console/Commands/BidModifiersDelete.php
app/Console/Commands/BidModifiersUpdate.php
app/Console/Commands/CampaignsLoadBidModifiers.php
app/Console/Commands/RetargetinglistsAdd.php
app/Console/Commands/RetargetinglistsDelete.php
app/Console/Commands/RetargetinglistsLoad.php
app/Console/Commands/RetargetinglistsUpdate.php
app/Http/Controllers/TokensController.php
app/Models/Tokens.php
database/migrations/2022_08_02_101252_add_allow_retargeting_load_column.php
resources/js/Pages/Tokens/Edit.vue
app/Console/Commands/BidModifiersAdd.php
View file @
32fbf63
...
...
@@ -45,6 +45,11 @@ class BidModifiersAdd extends Command
*/
public
function
handle
()
{
$token
=
Tokens
::
allowedRetargetingLoad
()
->
where
(
'type'
,
Tokens
::
MAIN
)
->
first
();
if
(
!
$token
)
{
return
0
;
}
$tokens
=
Tokens
::
allowedLimit
()
->
whereHas
(
'dictionaryCampaignsEnabledForExternalSynchronized.goalBidModifiersForNotExternal.bidModifier'
)
->
where
(
'type'
,
'!='
,
Tokens
::
MAIN
)
->
get
();
...
...
app/Console/Commands/BidModifiersDelete.php
View file @
32fbf63
...
...
@@ -40,6 +40,11 @@ class BidModifiersDelete extends Command
*/
public
function
handle
()
{
$token
=
Tokens
::
allowedRetargetingLoad
()
->
where
(
'type'
,
Tokens
::
MAIN
)
->
first
();
if
(
!
$token
)
{
return
0
;
}
foreach
(
Tokens
::
allowedLimit
()
->
where
(
'type'
,
'!='
,
Tokens
::
MAIN
)
->
get
()
as
$token
)
{
$ids
=
DB
::
table
(
'goal_bid_modifiers'
)
->
join
(
'bid_modifiers'
,
'goal_bid_modifiers.bid_modifier_id'
,
'='
,
'bid_modifiers.id'
)
...
...
app/Console/Commands/BidModifiersUpdate.php
View file @
32fbf63
...
...
@@ -42,6 +42,11 @@ class BidModifiersUpdate extends Command
*/
public
function
handle
()
{
$token
=
Tokens
::
allowedRetargetingLoad
()
->
where
(
'type'
,
Tokens
::
MAIN
)
->
first
();
if
(
!
$token
)
{
return
0
;
}
$tokens
=
Tokens
::
allowedLimit
()
->
where
(
'type'
,
'!='
,
Tokens
::
MAIN
)
->
get
();
...
...
app/Console/Commands/CampaignsLoadBidModifiers.php
View file @
32fbf63
...
...
@@ -47,7 +47,7 @@ class CampaignsLoadBidModifiers extends Command
return
0
;
}
$token
=
Tokens
::
allowedLimit
()
->
where
(
'type'
,
Tokens
::
MAIN
)
->
first
();
$token
=
Tokens
::
allowedLimit
()
->
allowedRetargetingLoad
()
->
where
(
'type'
,
Tokens
::
MAIN
)
->
first
();
if
(
!
$token
)
{
return
0
;
}
...
...
app/Console/Commands/RetargetinglistsAdd.php
View file @
32fbf63
...
...
@@ -43,6 +43,11 @@ class RetargetinglistsAdd extends Command
*/
public
function
handle
()
{
$token
=
Tokens
::
allowedRetargetingLoad
()
->
where
(
'type'
,
Tokens
::
MAIN
)
->
first
();
if
(
!
$token
)
{
return
0
;
}
$tokens
=
Tokens
::
allowedLimit
()
->
whereHas
(
'goalRetargetinglistsForNotExternalForNotReserveCreate.retargetinglist'
)
->
where
(
'type'
,
'!='
,
Tokens
::
MAIN
)
->
get
();
...
...
app/Console/Commands/RetargetinglistsDelete.php
View file @
32fbf63
...
...
@@ -43,6 +43,11 @@ class RetargetinglistsDelete extends Command
*/
public
function
handle
()
{
$token
=
Tokens
::
allowedRetargetingLoad
()
->
where
(
'type'
,
Tokens
::
MAIN
)
->
first
();
if
(
!
$token
)
{
return
0
;
}
$tokens
=
Tokens
::
allowedLimit
()
->
whereHas
(
'goalRetargetinglistsForExternalNeedDeletedForNotReserveDelete'
)
->
where
(
'type'
,
'!='
,
Tokens
::
MAIN
)
->
get
();
...
...
app/Console/Commands/RetargetinglistsLoad.php
View file @
32fbf63
...
...
@@ -40,7 +40,7 @@ class RetargetinglistsLoad extends Command
*/
public
function
handle
()
{
$token
=
Tokens
::
allowedLimit
()
->
where
(
'type'
,
Tokens
::
MAIN
)
->
first
();
$token
=
Tokens
::
allowedLimit
()
->
allowedRetargetingLoad
()
->
where
(
'type'
,
Tokens
::
MAIN
)
->
first
();
if
(
!
$token
)
{
return
0
;
...
...
app/Console/Commands/RetargetinglistsUpdate.php
View file @
32fbf63
...
...
@@ -43,6 +43,11 @@ class RetargetinglistsUpdate extends Command
*/
public
function
handle
()
{
$token
=
Tokens
::
allowedRetargetingLoad
()
->
where
(
'type'
,
Tokens
::
MAIN
)
->
first
();
if
(
!
$token
)
{
return
0
;
}
$tokens
=
Tokens
::
allowedLimit
()
->
whereHas
(
'goalRetargetinglistsForExternalForNotReserveUpdateNeedUpdated.retargetinglist'
)
->
where
(
'type'
,
'!='
,
Tokens
::
MAIN
)
->
get
();
...
...
app/Http/Controllers/TokensController.php
View file @
32fbf63
...
...
@@ -62,6 +62,7 @@ class TokensController extends Controller
'type'
=>
$token
->
type
,
'main'
=>
$token
->
isMain
(),
'limit_to_run'
=>
$token
->
limit_to_run
,
'allow_retargeting_load'
=>
$token
->
allow_retargeting_load
,
'errors_count'
=>
$token
->
errors_count
,
'campaigns'
=>
(
$token
->
isMain
()
...
...
@@ -121,12 +122,14 @@ class TokensController extends Controller
Request
::
validate
([
'type'
=>
[
'required'
,
'in:'
.
Tokens
::
MAIN
.
","
.
Tokens
::
GOAL
],
'limit_to_run'
=>
[
'required'
,
'integer'
,
'min:0'
],
'allow_retargeting_load'
=>
[
'nullable'
,
'boolean'
],
])
);
}
else
{
$token
->
update
(
Request
::
validate
([
'limit_to_run'
=>
[
'required'
,
'integer'
,
'min:0'
],
'allow_retargeting_load'
=>
[
'nullable'
,
'boolean'
],
])
);
}
...
...
app/Models/Tokens.php
View file @
32fbf63
...
...
@@ -101,6 +101,7 @@ class Tokens extends Model
'limit'
,
'retargetinglists_loaded_at'
,
'limit_to_run'
,
'allow_retargeting_load'
,
];
protected
$casts
=
[
...
...
@@ -110,6 +111,7 @@ class Tokens extends Model
'check_changes_ad_group'
=>
'datetime'
,
'check_changes_ad_extension'
=>
'datetime'
,
'retargetinglists_loaded_at'
=>
'datetime'
,
'allow_retargeting_load'
=>
'boolean'
,
];
public
function
getCheckChangesAtAttribute
()
...
...
@@ -159,6 +161,16 @@ class Tokens extends Model
return
$query
->
whereColumn
(
'limit_to_run'
,
'<'
,
'limit'
);
}
/**
* @param Builder $query
* @param array $filters
* @return Builder
*/
public
function
scopeAllowedRetargetingLoad
(
$query
)
{
return
$query
->
where
(
'allow_retargeting_load'
,
true
);
}
public
function
isMain
()
{
return
$this
->
type
===
$this
::
MAIN
;
...
...
database/migrations/2022_08_02_101252_add_allow_retargeting_load_column.php
0 → 100644
View file @
32fbf63
<?php
use
Illuminate\Database\Migrations\Migration
;
use
Illuminate\Database\Schema\Blueprint
;
use
Illuminate\Support\Facades\Schema
;
class
AddAllowRetargetingLoadColumn
extends
Migration
{
/**
* Run the migrations.
*
* @return void
*/
public
function
up
()
{
Schema
::
table
(
'tokens'
,
function
(
Blueprint
$table
)
{
$table
->
boolean
(
'allow_retargeting_load'
)
->
default
(
0
);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public
function
down
()
{
Schema
::
table
(
'tokens'
,
function
(
Blueprint
$table
)
{
$table
->
dropColumn
(
'allow_retargeting_load'
);
});
}
}
resources/js/Pages/Tokens/Edit.vue
View file @
32fbf63
...
...
@@ -23,6 +23,13 @@
</select-input>
<text-input
v-model=
"form.limit_to_run"
:error=
"form.errors.limit_to_run"
type=
"number"
class=
"pr-6 pb-8 w-full"
label=
"Минимум баллов для синхронизации"
/>
<input
:checked=
"form.allow_retargeting_load"
@
change=
"onToggleAllowRetargetingLoad"
type=
"checkbox"
class=
"mt-1"
id=
"allow_retargeting_load"
>
<label
class=
"ml-1"
for=
"allow_retargeting_load"
>
Обновление списка условий ретаргетинга/аудиторий
</label>
</div>
<div
class=
"px-8 py-4 bg-gray-50 border-t border-gray-100 flex items-center"
>
<button
class=
"text-red-600 hover:underline"
...
...
@@ -102,7 +109,6 @@ export default {
},
remember
:
'form'
,
data
()
{
console
.
log
(
this
.
token
);
return
{
form
:
this
.
$inertia
.
form
({
id
:
this
.
token
.
id
,
...
...
@@ -110,11 +116,15 @@ export default {
token
:
this
.
token
.
token
,
api
:
this
.
token
.
api
,
type
:
this
.
token
.
type
,
allow_retargeting_load
:
this
.
token
.
allow_retargeting_load
,
limit_to_run
:
this
.
token
.
limit_to_run
,
}),
}
},
methods
:
{
onToggleAllowRetargetingLoad
()
{
this
.
form
.
allow_retargeting_load
=
!
this
.
form
.
allow_retargeting_load
;
},
cityAdd
(
id
)
{
this
.
$inertia
.
post
(
this
.
route
(
'token.city.store'
,
[
this
.
token
.
id
,
id
]))
},
...
...
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