天天看點

微信群發 clientmsgid exist 45065錯誤

出現這種錯誤的原因是,在公衆平台網站上,為訂閱号提供了每天一條的群發權限,為服務号提供每月(自然月)4條的群發權限。而對于某些具備開發能力的公衆号營運者,可以通過進階群發接口,實作更靈活的群發能力。

是以, 最好加 clientmsgid  參數避免重複。

示例

//微信釋出
    public function wxpublish($media_id, $type, $token) {
        $publish_type = $this->_type($type, $media_id);
        // 避免存在相同的用 clientmsgid 參數,避免重複推送
        //一、群發接口新增 clientmsgid 參數,開發者調用群發接口時可以主動設定 clientmsgid 參數,避免重複推送
        $publish_type['clientmsgid'] = "send_tag_3";
        $publish_type = json_encode($publish_type);
        $access_token = $this->get_auth_access_token($token);
        $url = "https://api.weixin.qq.com/cgi-bin/message/mass/sendall?access_token=" . $access_token;
        $result = $this->_sendHttps($url, $publish_type, 'post');
        $arr = json_decode($result, true);
        //dump($arr);exit;

        if ($arr['errcode'] == 0) {
            return array('status' => true, 'msg' => '消息釋出中~');
        } else {
            return array('status' => false, 'msg' => '消息釋出失敗');
        }
    }
           

傳回:

微信群發 clientmsgid exist 45065錯誤

請參閱微信文檔

https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1481187827_i0l21