sendCustomMessage( )发送客服消息

/**
* @RhaPHP.com geeson
* 发送客服消息
* @param array $data 消息结构{"touser":"OPENID","msgtype":"news","news":{...}}
* @return boolean|array
*/
function sendCustomMessage($data = [])
{
$wxObj = getWechatActiveObj();
$result = $wxObj->sendCustomMessage($data);
if (empty($result)) {
if ($wxObj->errCode == '45015') {
return ['errcode' => -1, 'errmsg' => '发送失败:此用户48小时内没有与公众号有过互动'];
}
return ['errcode' => -1, 'errmsg' => ' errCode:' . $wxObj->errCode . ' errMsg:' . $wxObj->errMsg];

}
if (!isset($result['errcode']) && $result['errcode'] != '0') {
return ['errcode' => -1, 'errmsg' => ' errCode:' . $wxObj->errCode . ' errMsg:' . $wxObj->errMsg];
} else {
return $result;
}
}

0 个评论

要回复文章请先登录注册