mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-06 10:11:38 +09:00
스키마 수정 및 커밋 빠진 파일 추가
This commit is contained in:
parent
b3aca6bd36
commit
5e577396f3
3 changed files with 26 additions and 23 deletions
|
|
@ -54,12 +54,8 @@ class APNs extends Base implements \Rhymix\Framework\Drivers\PushInterface
|
|||
$alert = [];
|
||||
$alert['title'] = $message->getSubject();
|
||||
$alert['body'] = $message->getContent();
|
||||
if($message->getImage())
|
||||
{
|
||||
$alert['image'] = $message->getImage();
|
||||
}
|
||||
|
||||
$body['aps'] = array('alert' => $alert,'sound' => 'default');
|
||||
$body['aps'] = array('alert' => $alert);
|
||||
$payload = json_encode($body);
|
||||
|
||||
foreach($tokens as $token)
|
||||
|
|
|
|||
|
|
@ -62,22 +62,13 @@ class FCM extends Base implements \Rhymix\Framework\Drivers\PushInterface
|
|||
$notification = [];
|
||||
$notification['title'] = $message->getSubject();
|
||||
$notification['body'] = $message->getContent();
|
||||
if($message->getImage())
|
||||
{
|
||||
$notification['image'] = $message->getImage();
|
||||
}
|
||||
|
||||
// Set android options
|
||||
$options = [];
|
||||
$options['priority'] = 'normal';
|
||||
$options['click_action'] = 'RX_NOTIFICATION';
|
||||
|
||||
foreach($tokens as $i => $token)
|
||||
{
|
||||
$data = json_encode(array(
|
||||
'registration_ids' => [$token],
|
||||
'notification' => $notification,
|
||||
'android' => $options ?: new stdClass,
|
||||
'priority' => 'normal',
|
||||
'data' => $message->getData() ?: new stdClass,
|
||||
));
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ class Push
|
|||
protected $to = array();
|
||||
protected $subject = '';
|
||||
protected $content = '';
|
||||
protected $image = '';
|
||||
protected $click_action = '';
|
||||
protected $data = [];
|
||||
protected $errors = array();
|
||||
protected $sent = false;
|
||||
|
|
@ -198,25 +198,25 @@ class Push
|
|||
}
|
||||
|
||||
/**
|
||||
* Set an image to associate with this push notification.
|
||||
* Set an click-action to associate with this push notification.
|
||||
*
|
||||
* @param string $image
|
||||
* @param string $click_action
|
||||
* @return bool
|
||||
*/
|
||||
public function setImage(string $image): bool
|
||||
public function setClickAction(string $click_action): bool
|
||||
{
|
||||
$this->image = utf8_trim(utf8_clean($image));
|
||||
$this->click_action = utf8_trim(utf8_clean($click_action));
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the image associated with this push notification.
|
||||
* Get the click-action associated with this push notification.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getImage(): string
|
||||
public function getClickAction(): string
|
||||
{
|
||||
return $this->image;
|
||||
return $this->click_action;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -331,6 +331,21 @@ class Push
|
|||
|
||||
$args = new stdClass;
|
||||
$args->member_srl = $member_srl_list;
|
||||
$args->device_type = [];
|
||||
$driver_types = config('push.types') ?: array();
|
||||
if(count($driver_types))
|
||||
{
|
||||
return $result;
|
||||
}
|
||||
if(isset($driver_types['fcm']))
|
||||
{
|
||||
$args->device_type[] = 'android';
|
||||
}
|
||||
if(isset($driver_types['apns']))
|
||||
{
|
||||
$args->device_type[] = 'ios';
|
||||
}
|
||||
|
||||
$output = executeQueryArray('member.getMemberDeviceTokensByMemberSrl', $args);
|
||||
if(!$output->toBool() || !$output->data)
|
||||
{
|
||||
|
|
@ -343,6 +358,7 @@ class Push
|
|||
}
|
||||
|
||||
return $result;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue