public function close_kf_session($openid, $kf_account, $text = '')
{
$url = self::API_DOMAIN . 'customservice/kfsession/close?access_token=' . $this->get_access_token();
$xml = sprintf('{
"kf_account" : "%s",
"openid" : "%s",
"text" : "%s"}', $kf_account, $openid, $text);
$res = HttpCurl::post($url, $xml, 'json');
// 异常处理: 获取时网络错误
if ($res === false) {
return Error::code('ERR_GET');
}
// 判断是否调用成功
if ($res->errcode == 0) {
return array(null, true);
} else {
return array($res, null);
}
}