/** * 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); }
/** * 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); }