public function add_kf($kf_account, $nickname, $password)
{
$password = md5($password);
$xml = sprintf('{
"kf_account" : "%s",
"nickname" : "%s",
"password" : "%s"}', $kf_account, $nickname, md5($password));
$url = self::API_DOMAIN . 'customservice/kfaccount/add?access_token=' . $this->get_access_token();
$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);
}
}