示例#1
0
 /**
  * Send the message.
  *
  * @return bool
  *
  * @throws RuntimeException
  */
 public function send()
 {
     if (empty($this->message)) {
         throw new RuntimeException('No message to send.');
     }
     $transformer = new Transformer();
     $content = $transformer->transform($this->message);
     $message = array_merge(['touser' => $this->to, 'msgtype' => $this->message->type, 'customservice' => ['kf_account' => $this->account]], $content);
     return $this->staff->send($message);
 }
示例#2
0
 /**
  * Send the message.
  *
  * @return bool
  *
  * @throws RuntimeException
  */
 public function send()
 {
     if (empty($this->message)) {
         throw new RuntimeException('No message to send.');
     }
     $transformer = new Transformer();
     if ($this->message instanceof RawMessage) {
         $message = $this->message->get('content');
     } else {
         $content = $transformer->transform($this->message);
         $message = array_merge(['touser' => $this->to, 'customservice' => ['kf_account' => $this->account]], $content);
     }
     return $this->staff->send($message);
 }