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 3df410e4
authored
May 12, 2021
by
Евгений
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Улучшение #19453
Первоначальная загрузка всех РК аккаунтов.
1 parent
6010941e
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
1 deletions
app/Models/Campaigns.php
app/Service/Requests/Direct/CheckCampaignsChange.php
app/Service/Requests/Direct/GetCampaigns.php
database/migrations/2021_05_11_084828_create_campaigns_table.php
app/Models/Campaigns.php
View file @
3df410e
...
...
@@ -12,6 +12,7 @@ class Campaigns extends Model
protected
$fillable
=
[
'external_id'
,
'Name'
,
'token'
,
'TimeTargeting'
,
'NegativeKeywords'
,
'BlockedIps'
,
...
...
app/Service/Requests/Direct/CheckCampaignsChange.php
View file @
3df410e
...
...
@@ -27,7 +27,8 @@ class CheckCampaignsChange extends DirectRequest {
'external_id'
=>
$campaign
[
'CampaignId'
]
],
[
'updated'
=>
$campaign
[
'ChangesIn'
]
'updated'
=>
$campaign
[
'ChangesIn'
],
'token'
=>
$this
->
getToken
()
->
id
]);
}
}
...
...
app/Service/Requests/Direct/GetCampaigns.php
View file @
3df410e
...
...
@@ -19,6 +19,7 @@ class GetCampaigns extends DirectRequest{
foreach
(
$response
[
'result'
][
'Campaigns'
]
as
$campaign
){
$data
[]
=
[
'external_id'
=>
$campaign
[
'Id'
],
'token'
=>
$this
->
getToken
()
->
id
,
'Name'
=>
$campaign
[
'Name'
],
'TimeTargeting'
=>
json_encode
(
$campaign
[
'TimeTargeting'
]),
'NegativeKeywords'
=>
!
empty
(
$campaign
[
'NegativeKeywords'
][
'Items'
])
?
implode
(
"
\n
"
,
$campaign
[
'NegativeKeywords'
][
'Items'
])
:
''
,
...
...
@@ -39,6 +40,7 @@ class GetCampaigns extends DirectRequest{
Campaigns
::
upsert
(
$data
,
[
'external_id'
],[
'token'
,
'Name'
,
'TimeTargeting'
,
'NegativeKeywords'
,
...
...
database/migrations/2021_05_11_084828_create_campaigns_table.php
View file @
3df410e
...
...
@@ -15,6 +15,7 @@ class CreateCampaignsTable extends Migration
{
Schema
::
create
(
'campaigns'
,
function
(
Blueprint
$table
)
{
$table
->
id
();
$table
->
bigInteger
(
'token'
);
$table
->
bigInteger
(
'external_id'
)
->
unique
();
$table
->
string
(
'Name'
,
255
)
->
nullable
();
$table
->
json
(
'TimeTargeting'
)
->
nullable
();
...
...
@@ -36,6 +37,8 @@ class CreateCampaignsTable extends Migration
\App\Service\Requests\Direct\CheckCampaignsChange
::
STAT
,
])
->
nullable
();
$table
->
timestamps
();
$table
->
foreign
(
'token'
)
->
references
(
'id'
)
->
on
(
'tokens'
);
});
}
...
...
@@ -46,6 +49,9 @@ class CreateCampaignsTable extends Migration
*/
public
function
down
()
{
Schema
::
table
(
'campaigns'
,
function
(
Blueprint
$table
)
{
$table
->
dropForeign
(
'campaigns_token_foreign'
);
});
Schema
::
dropIfExists
(
'campaigns'
);
}
}
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