Changes
This commit is contained in:
@@ -26,7 +26,7 @@ class CreateVkPost implements ShouldQueue
|
||||
readonly private array $images = [],
|
||||
readonly private int $post_id,
|
||||
readonly private int|null $publish_date = null,
|
||||
|
||||
readonly private string $primary_attachments_mode = 'carousel',
|
||||
)
|
||||
{}
|
||||
|
||||
@@ -34,7 +34,13 @@ class CreateVkPost implements ShouldQueue
|
||||
{
|
||||
try {
|
||||
$vkService = new VkService();
|
||||
$vk_post = $vkService->createPost($this->title, $this->text, $this->images, $this->publish_date);
|
||||
$vk_post = $vkService->createPost(
|
||||
$this->title,
|
||||
$this->text,
|
||||
$this->images,
|
||||
$this->publish_date,
|
||||
$this->primary_attachments_mode
|
||||
);
|
||||
DB::table('posts_vk_posts')->insert(
|
||||
[
|
||||
'post_id' => $this->post_id,
|
||||
|
||||
@@ -28,9 +28,10 @@ class CreateVkPostJob implements ShouldQueue
|
||||
protected $videos;
|
||||
protected $publish_date;
|
||||
protected $public_id;
|
||||
protected $primary_attachments_mode;
|
||||
|
||||
public function __construct(
|
||||
int $post_id, string $title, string $message, array $images = [], array $videos = [], ?int $publish_date = null
|
||||
int $post_id, string $title, string $message, array $images = [], array $videos = [], ?int $publish_date = null, string $primary_attachments_mode = 'carousel'
|
||||
)
|
||||
{
|
||||
$this->post_id = $post_id;
|
||||
@@ -40,6 +41,7 @@ class CreateVkPostJob implements ShouldQueue
|
||||
$this->videos = $videos;
|
||||
$this->publish_date = $publish_date;
|
||||
$this->public_id = config('services.vk.public_id');
|
||||
$this->primary_attachments_mode = $primary_attachments_mode;
|
||||
}
|
||||
|
||||
public function handle()
|
||||
@@ -96,7 +98,7 @@ class CreateVkPostJob implements ShouldQueue
|
||||
$attachmentString = implode(',', $selected_attachments);
|
||||
Log::info("{$logPrefix} Финальная строка вложений: '{$attachmentString}'");
|
||||
|
||||
$vk_post = $wallService->createPost($this->message, $from_group, $attachmentString, $this->publish_date);
|
||||
$vk_post = $wallService->createPost($this->message, $from_group, $attachmentString, $this->publish_date, $this->primary_attachments_mode);
|
||||
|
||||
if (isset($vk_post['post_id'])) {
|
||||
Log::info("{$logPrefix} Пост успешно создан ID: {$vk_post['post_id']}");
|
||||
|
||||
@@ -28,9 +28,10 @@ class UpdateVkPostJob implements ShouldQueue
|
||||
protected $videos;
|
||||
protected $publish_date;
|
||||
protected $public_id;
|
||||
protected $primary_attachments_mode;
|
||||
|
||||
public function __construct(
|
||||
int $post_id, string $title, string $message, array $images = [], array $videos = [], ?int $publish_date = null
|
||||
int $post_id, string $title, string $message, array $images = [], array $videos = [], ?int $publish_date = null, string $primary_attachments_mode = 'carousel'
|
||||
)
|
||||
{
|
||||
$this->post_id = $post_id;
|
||||
@@ -40,6 +41,7 @@ class UpdateVkPostJob implements ShouldQueue
|
||||
$this->videos = $videos;
|
||||
$this->publish_date = $publish_date;
|
||||
$this->public_id = config('services.vk.public_id');
|
||||
$this->primary_attachments_mode = $primary_attachments_mode;
|
||||
}
|
||||
|
||||
public function handle()
|
||||
|
||||
Reference in New Issue
Block a user