Exemplo n.º 1
0
 /**
  * 发送消息
  *
  * @param string $openId
  *
  * @return bool
  */
 public function to($openId)
 {
     if (empty($this->message)) {
         throw new Exception('未设置要发送的消息');
     }
     $this->message->to = $openId;
     return $this->http->jsonPost(self::API_MESSAGE_SEND, $this->message->buildForStaff());
 }
Exemplo n.º 2
0
 /**
  * 发送消息
  *
  * @param string $openId
  *
  * @return boolean
  */
 public function to($openId)
 {
     if (empty($this->message)) {
         throw new Exception("未设置要发送的消息");
     }
     $this->message->to = $openId;
     Wechat::request('POST', self::API_MESSAGE_SEND, $this->message->buildForStaff());
     return true;
 }
Exemplo n.º 3
0
 /**
  * 发送消息
  *
  * @param string $openId
  *
  * @return bool
  */
 public function totag($tagid, $agentid = 1)
 {
     if (empty($this->message)) {
         throw new Exception('未设置要发送的消息');
     }
     $this->message->totag = $tagid;
     $this->message->agentid = $agentid;
     $message_body = $this->message->buildForStaff();
     return $this->http->jsonPost(self::API_MESSAGE_SEND, $message_body);
 }
Exemplo n.º 4
0
 /**
  * 预览.
  *
  * @param string $openId 接收消息用户对应该公众号的openid
  * @param string $type   接收消息用户的类型
  *
  * @return bool
  */
 public function preview($openId, $type = self::PREVIEW_BY_OPENID)
 {
     $this->message->to = $openId;
     return $this->http->jsonPost(self::API_PREVIEW, $this->message->buildForBroadcastPreview($type));
 }