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 f479c136
authored
Jun 03, 2021
by
Vladislav
Browse files
Options
Browse Files
Download
Plain Diff
fix both in app/Console/Commands/CampaignsAdd.php
2 parents
e93b717c
2a6e24be
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
30 additions
and
20 deletions
app/Console/Commands/CampaignsResume.php
app/Console/Commands/CampaignsSuspend.php
app/Console/Commands/CampaignsUpdate.php
app/Jobs/ProcessCallAPI.php
app/Service/Requests/DirectRequest.php
database/migrations/2021_05_17_141740_create_dictionary_campaigns_table.php
app/Console/Commands/CampaignsResume.php
View file @
f479c13
...
...
@@ -63,11 +63,12 @@ class CampaignsResume extends Command
*/
$tokens
=
Tokens
::
whereHas
(
'dictionaryCampaignsEnabledForExternalDisabled'
)
->
with
([
'dictionaryCampaignsEnabledForExternalDisabled'
=>
function
(
HasManyThrough
$query
)
{
return
$query
->
limit
(
1000
);
},
])
->
where
(
'type'
,
'!='
,
Tokens
::
MAIN
)
// ->with([
// 'dictionaryCampaignsEnabledForExternalDisabled' => function (HasManyThrough $query) {
// return $query->limit(1000);
// },
// ])
->
where
(
'type'
,
'!='
,
Tokens
::
MAIN
)
->
get
();
foreach
(
$tokens
as
$token
)
{
...
...
app/Console/Commands/CampaignsSuspend.php
View file @
f479c13
...
...
@@ -62,11 +62,12 @@ class CampaignsSuspend extends Command
*/
$tokens
=
Tokens
::
whereHas
(
'dictionaryCampaignsNotEnabledForExternalNotDisabled'
)
->
with
([
'dictionaryCampaignsNotEnabledForExternalNotDisabled'
=>
function
(
HasManyThrough
$query
)
{
return
$query
->
limit
(
1000
);
},
])
->
where
(
'type'
,
'!='
,
Tokens
::
MAIN
)
// ->with([
// 'dictionaryCampaignsNotEnabledForExternalNotDisabled' => function (HasManyThrough $query) {
// return $query->limit(1000);
// },
// ])
->
where
(
'type'
,
'!='
,
Tokens
::
MAIN
)
->
get
();
foreach
(
$tokens
as
$token
)
{
...
...
app/Console/Commands/CampaignsUpdate.php
View file @
f479c13
...
...
@@ -43,12 +43,13 @@ class CampaignsUpdate extends Command
public
function
handle
()
{
$tokens
=
Tokens
::
whereHas
(
'dictionaryCampaignsEnabledForExternalNeedUpdated'
)
->
with
([
'dictionaryCampaignsEnabledForExternalNeedUpdated'
=>
function
(
HasManyThrough
$query
)
{
return
$query
->
limit
(
10
);
},
'dictionaryCampaignsEnabledForExternalNeedUpdated.campaign'
])
->
where
(
'type'
,
'!='
,
Tokens
::
MAIN
)
// ->with([
// 'dictionaryCampaignsEnabledForExternalNeedUpdated' => function (HasManyThrough $query) {
// return $query->limit(10);
// },
// 'dictionaryCampaignsEnabledForExternalNeedUpdated.campaign'
// ])
->
where
(
'type'
,
'!='
,
Tokens
::
MAIN
)
->
get
();
foreach
(
$tokens
as
$token
)
{
...
...
app/Jobs/ProcessCallAPI.php
View file @
f479c13
...
...
@@ -12,6 +12,7 @@ use Illuminate\Contracts\Queue\ShouldQueue;
use
Illuminate\Foundation\Bus\Dispatchable
;
use
Illuminate\Queue\InteractsWithQueue
;
use
Illuminate\Queue\SerializesModels
;
use
Illuminate\Support\Facades\Log
;
class
ProcessCallAPI
implements
ShouldQueue
{
...
...
@@ -57,7 +58,13 @@ class ProcessCallAPI implements ShouldQueue
}
}
$response
=
$api
->
execute
();
$limits
->
acceptRezerv
(
$this
->
limitId
,
new
HeaderLimits
(
$response
->
headers
()));
try
{
$limits
->
acceptRezerv
(
$this
->
limitId
,
new
HeaderLimits
(
$response
->
headers
()));
}
catch
(
\Exception
$e
){
Log
::
debug
(
$e
);
Log
::
debug
(
$response
->
headers
());
}
//TODO: обработать результат.
// если не хватило баллов на все что хотели запросить, то в очередь отправляем новый запрос на получение новых данных
AdsHandler
::
getInstance
(
$this
->
api
)
->
handle
(
$response
);
...
...
app/Service/Requests/DirectRequest.php
View file @
f479c13
...
...
@@ -68,7 +68,7 @@ class DirectRequest extends APIRequest
$request
->
setToken
(
$this
->
getToken
());
return
$request
;
}
throw
new
Exception
(
'Unknown Service or Method'
);
throw
new
\
Exception
(
'Unknown Service or Method'
);
return
$this
;
}
...
...
database/migrations/2021_05_17_141740_create_dictionary_campaigns_table.php
View file @
f479c13
...
...
@@ -19,8 +19,8 @@ class CreateDictionaryCampaignsTable extends Migration
$table
->
bigInteger
(
'campaign_id'
)
->
unsigned
();
$table
->
bigInteger
(
'dictionary_id'
)
->
unsigned
();
$table
->
string
(
'name'
,
255
)
->
nullable
();
$table
->
text
(
'negative_keywords'
)
->
nullable
();
$table
->
text
(
'excluded_sites'
)
->
nullable
();
$table
->
json
(
'negative_keywords'
)
->
nullable
();
$table
->
json
(
'excluded_sites'
)
->
nullable
();
$table
->
boolean
(
'synced'
)
->
default
(
1
);
$table
->
boolean
(
'updated'
)
->
default
(
1
);
$table
->
boolean
(
'enabled'
)
->
default
(
1
);
...
...
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