wechat-php-sdk icon indicating copy to clipboard operation
wechat-php-sdk copied to clipboard

发送消息接口,建议增加一个agentid判断

Open bjdgyc opened this issue 10 years ago • 2 comments

public function sendMessage($data){
        if (!$this->access_token && !$this->checkAuth()) return false;
       // 此处添加
        if (empty($data['agentid'])) {
            $data['agentid'] = $this->agentid;
        }
        $result = $this->http_post(self::API_URL_PREFIX.self::MASS_SEND_URL.'access_token='.$this->access_token,self::json_encode($data));
        if ($result)
        {
            $json = json_decode($result,true);
            if (!$json || !empty($json['errcode']) || $json['errcode']!=0) {
                $this->errCode = $json['errcode'];
                $this->errMsg = $json['errmsg'];
                return false;
            }
            return $json;
        }
        return false;
    }

bjdgyc avatar Jul 17 '15 10:07 bjdgyc

这是为何?

mr-liusg avatar Jul 30 '15 16:07 mr-liusg

如果$data['agentid'] 不存在的话,就不能指定发送的是哪一个企业号

bjdgyc avatar Mar 31 '16 06:03 bjdgyc