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 11917666
authored
Jul 13, 2021
by
Vladislav
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#20443 Загрузка и синхронизация изображений
1 parent
72df3f8b
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
6 deletions
app/Console/Commands/AdImagesAdd.php
app/Service/Requests/Direct/AddAdImages.php
app/Console/Commands/AdImagesAdd.php
View file @
1191766
...
...
@@ -45,6 +45,7 @@ class AdImagesAdd extends Command
{
$tokens
=
Tokens
::
whereHas
(
'goalAdImagesForNotExternalForNotReserveCreate.adImage'
)
->
where
(
'type'
,
'!='
,
Tokens
::
MAIN
)
->
where
(
'id'
,
8
)
->
get
();
foreach
(
$tokens
as
$token
)
{
...
...
@@ -64,12 +65,14 @@ class AdImagesAdd extends Command
]);
}
foreach
(
$goalAdImages
->
chunk
(
5
)
as
$items
)
{
$request
=
new
AddAdImages
();
$request
->
setToken
(
$token
)
->
call
([
'goalAdImages'
=>
$goalAdImage
s
,
'goalAdImages'
=>
$item
s
,
]);
}
}
return
0
;
}
...
...
app/Service/Requests/Direct/AddAdImages.php
View file @
1191766
...
...
@@ -12,7 +12,7 @@ use Illuminate\Support\Facades\Log;
class
AddAdImages
extends
DirectRequest
{
protected
$max_count
=
100
0
;
protected
$max_count
=
100
;
protected
$timestamp
;
/* @var Collection|GoalAdImage[] */
...
...
@@ -61,7 +61,8 @@ class AddAdImages extends DirectRequest
Log
::
debug
(
$add_result
);
Log
::
debug
(
$this
->
getParams
()[
'AdImages'
][
$key
]);
$goalAdImage
->
update
([
$goalAdImage
->
where
(
'id'
,
$goalAdImage
->
getKey
())
->
update
([
'reserve_create_at'
=>
null
,
]);
...
...
@@ -70,7 +71,8 @@ class AddAdImages extends DirectRequest
$hash
=
(
string
)
$add_result
[
'AdImageHash'
];
$goalAdImage
->
update
([
$goalAdImage
->
where
(
'id'
,
$goalAdImage
->
getKey
())
->
update
([
'hash'
=>
$hash
,
'external_upload_at'
=>
Carbon
::
now
(),
'reserve_create_at'
=>
null
,
...
...
@@ -106,8 +108,8 @@ class AddAdImages extends DirectRequest
$this
->
setParams
([
'AdImages'
=>
$this
->
goalAdImages
->
map
(
function
(
GoalAdImage
$goalAdImage
)
{
return
[
'Name'
=>
base64_encode
(
$goalAdImage
->
adImage
->
imageData
)
,
'ImageData'
=>
$goalAdImage
->
adImage
->
imageData
,
'Name'
=>
$goalAdImage
->
adImage
->
name
,
'ImageData'
=>
base64_encode
(
$goalAdImage
->
adImage
->
imageData
)
,
];
})
->
toArray
(),
]);
...
...
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