@@ -561,11 +561,12 @@ public function campaignStatByReferrals($id)
561
561
* @param $bodyOrTemplateId
562
562
* @param $bookId
563
563
* @param string $name
564
- * @param string $attachments
564
+ * @param array $attachments
565
565
* @param string $type
566
566
* @param bool $useTemplateId
567
567
* @param string $sendDate
568
568
* @param int|null $segmentId
569
+ * @param array $attachmentsBinary
569
570
* @return mixed
570
571
*/
571
572
public function createCampaign (
@@ -575,21 +576,18 @@ public function createCampaign(
575
576
$ bodyOrTemplateId ,
576
577
$ bookId ,
577
578
$ name = '' ,
578
- $ attachments = '' ,
579
+ $ attachments = [] ,
579
580
$ type = '' ,
580
581
$ useTemplateId = false ,
581
582
$ sendDate = '' ,
582
- $ segmentId = null
583
+ $ segmentId = null ,
584
+ $ attachmentsBinary = []
583
585
)
584
586
{
585
587
if (empty ($ senderName ) || empty ($ senderEmail ) || empty ($ subject ) || empty ($ bodyOrTemplateId ) || empty ($ bookId )) {
586
588
return $ this ->handleError ('Not all data. ' );
587
589
}
588
590
589
- if (!empty ($ attachments )) {
590
- $ attachments = serialize ($ attachments );
591
- }
592
-
593
591
if ($ useTemplateId ) {
594
592
$ paramName = 'template_id ' ;
595
593
$ paramValue = $ bodyOrTemplateId ;
@@ -605,10 +603,15 @@ public function createCampaign(
605
603
$ paramName => $ paramValue ,
606
604
'list_id ' => $ bookId ,
607
605
'name ' => $ name ,
608
- 'attachments ' => $ attachments ,
609
606
'type ' => $ type ,
610
607
);
611
608
609
+ if (!empty ($ attachments )) {
610
+ $ data ['attachments ' ] = $ attachments ;
611
+ } elseif (!empty ($ attachmentsBinary )) {
612
+ $ data ['attachments_binary ' ] = $ attachmentsBinary ;
613
+ }
614
+
612
615
if (!empty ($ sendDate )) {
613
616
$ data ['send_date ' ] = $ sendDate ;
614
617
}
0 commit comments