PFinal\Wechat\Service\MessageService::sendAll PHP Method

sendAll() public static method

关于群发时使用is_to_all为true使其进入公众号在微信客户端的历史消息列表: 1、使用is_to_all为true且成功群发,会使得此次群发进入历史消息列表。2、为防止异常,认证订阅号在一天内,只能使用is_to_all为true进行群发一次,或者在公众平台官网群发(不管本次群发是对全体还是对某个分组)一次。以避免一天内有2条群发进入历史消息列表。 3、类似地,服务号在一个月内,使用is_to_all为true群发的次数,加上公众平台官网群发(不管本次群发是对全体还是对某个分组)的次数,最多只能是4次。 4、设置is_to_all为false时是可以多次群发的,但每个用户只会收到最多4条,且这些群发不会进入历史消息列表。
public static sendAll ( integer $groupId, PFinal\Wechat\Contract\MassMessage $message, boolean $is_to_all = false ) : array
$groupId integer
$message PFinal\Wechat\Contract\MassMessage
$is_to_all boolean
return array
    public static function sendAll($groupId, MassMessage $message, $is_to_all = false)
    {
        $url = 'https://api.weixin.qq.com/cgi-bin/message/mass/sendall?access_token=ACCESS_TOKEN';
        $data = array('filter' => array('is_to_all' => $is_to_all, 'group_id' => $groupId));
        $data = array_merge($data, $message->jsonData());
        $data['msgtype'] = $message->type();
        return parent::request($url, $data);
    }