Inheritance: extends PFinal\Wechat\Contract\Message
Beispiel #1
0
 /**
  * 客服消息接口,主动给粉丝发消息。当用户和公众号产生特定动作的交互的48小时内有效。
  * @param $openid
  * @param $message
  * @param null $account 客服帐号(显示客服自定义头像)
  * @return array
  * @throws WechatException
  * @throws \Exception
  */
 public static function send($openid, SendMessage $message, $account = null)
 {
     $data = $message->jsonData();
     $type = $message->type();
     $message = array('touser' => $openid, 'msgtype' => $type);
     $data = array_merge($message, $data);
     if ($account != null) {
         $data['customservice'] = array('kf_account' => $account);
     }
     $url = 'https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=ACCESS_TOKEN';
     return parent::request($url, $data);
 }