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

没有获取接收语音消息

Open showname2020 opened this issue 4 years ago • 4 comments

没有获取接收语音消息

showname2020 avatar Jun 21 '21 01:06 showname2020

接收语音消息

$wechat = new Wechat([
    // 开发者中心-配置项-AppID(应用ID)
    'appId'          =>  'wx733d7f24bd29224a',
    // 开发者中心-配置项-服务器配置-Token(令牌)
    'token'          =>  'gaoming13',
    // 开发者中心-配置项-服务器配置-EncodingAESKey(消息加解密密钥)
    // 可选: 消息加解密方式勾选 兼容模式 或 安全模式 需填写
    'encodingAESKey' =>  '072vHYArTp33eFwznlSvTRvuyOTe5YME1vxSoyZbzaV'
]);

// 获取微信消息
$msg = $wechat->serve();

// 接收语音消息
if ($msg['MsgType'] == 'voice') {
  var_dump($msg);
  // $msg 的结构体参考微信文档:
  // https://developers.weixin.qq.com/doc/offiaccount/Message_Management/Receiving_standard_messages.html #语音消息
  $wechat->reply("你也好!");
} else {
  $wechat->reply("听不懂!");
}

被动回复语音消息

// https://developers.weixin.qq.com/doc/offiaccount/Message_Management/Passive_user_reply_message.html#2
$wechat->reply([
  'type' => 'voice',
  'media_id' => 'rVT43tfDwjh4p1BV2gJ5D7Zl2BswChO5L_llmlphLaTPytcGcguBAEJ1qK4cg4r_'
]);

主动发送语音消息

// https://developers.weixin.qq.com/doc/offiaccount/Message_Management/Service_Center_messages.html
$api->send('ocNtAt_K8nRlAdmNEo_R0WVg_rRw', [
  'type' => 'voice',
  'media_id' => 'rVT43tfDwjh4p1BV2gJ5D7Zl2BswChO5L_llmlphLaTPytcGcguBAEJ1qK4cg4r_'
]);

gaoming13 avatar Jun 21 '21 01:06 gaoming13

语音识别。接收到的语音信息是空白的...

------------------ 原始邮件 ------------------ 发件人: @.>; 发送时间: 2021年6月21日(星期一) 上午9:51 收件人: @.>; 抄送: @.>; @.>; 主题: Re: [gaoming13/wechat-php-sdk] 没有获取接收语音消息 (#27)

接收语音消息 $wechat = new Wechat([ // 开发者中心-配置项-AppID(应用ID) 'appId' => 'wx733d7f24bd29224a', // 开发者中心-配置项-服务器配置-Token(令牌) 'token' => 'gaoming13', // 开发者中心-配置项-服务器配置-EncodingAESKey(消息加解密密钥) // 可选: 消息加解密方式勾选 兼容模式 或 安全模式 需填写 'encodingAESKey' => '072vHYArTp33eFwznlSvTRvuyOTe5YME1vxSoyZbzaV' ]); // 获取微信消息 $msg = $wechat->serve(); // 接收语音消息 if ($msg['MsgType'] == 'voice') { var_dump($msg); // $msg 的结构体参考微信文档: // https://developers.weixin.qq.com/doc/offiaccount/Message_Management/Receiving_standard_messages.html #语音消息 $wechat->reply("你也好!"); } else { $wechat->reply("听不懂!"); }

被动回复语音消息 // https://developers.weixin.qq.com/doc/offiaccount/Message_Management/Passive_user_reply_message.html#2 $wechat->reply([ 'type' => 'voice', 'media_id' => 'rVT43tfDwjh4p1BV2gJ5D7Zl2BswChO5L_llmlphLaTPytcGcguBAEJ1qK4cg4r_' ]);

主动发送语音消息 // https://developers.weixin.qq.com/doc/offiaccount/Message_Management/Service_Center_messages.html $api->send('ocNtAt_K8nRlAdmNEo_R0WVg_rRw', [ 'type' => 'voice', 'media_id' => 'rVT43tfDwjh4p1BV2gJ5D7Zl2BswChO5L_llmlphLaTPytcGcguBAEJ1qK4cg4r_' ]);

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

showname2020 avatar Jun 26 '21 08:06 showname2020

语音识别接口还是有问题$msg['Recognition'],0,-3)

------------------ 原始邮件 ------------------ 发件人: @.>; 发送时间: 2021年6月21日(星期一) 上午9:51 收件人: @.>; 抄送: @.>; @.>; 主题: Re: [gaoming13/wechat-php-sdk] 没有获取接收语音消息 (#27)

接收语音消息 $wechat = new Wechat([ // 开发者中心-配置项-AppID(应用ID) 'appId' => 'wx733d7f24bd29224a', // 开发者中心-配置项-服务器配置-Token(令牌) 'token' => 'gaoming13', // 开发者中心-配置项-服务器配置-EncodingAESKey(消息加解密密钥) // 可选: 消息加解密方式勾选 兼容模式 或 安全模式 需填写 'encodingAESKey' => '072vHYArTp33eFwznlSvTRvuyOTe5YME1vxSoyZbzaV' ]); // 获取微信消息 $msg = $wechat->serve(); // 接收语音消息 if ($msg['MsgType'] == 'voice') { var_dump($msg); // $msg 的结构体参考微信文档: // https://developers.weixin.qq.com/doc/offiaccount/Message_Management/Receiving_standard_messages.html #语音消息 $wechat->reply("你也好!"); } else { $wechat->reply("听不懂!"); }

被动回复语音消息 // https://developers.weixin.qq.com/doc/offiaccount/Message_Management/Passive_user_reply_message.html#2 $wechat->reply([ 'type' => 'voice', 'media_id' => 'rVT43tfDwjh4p1BV2gJ5D7Zl2BswChO5L_llmlphLaTPytcGcguBAEJ1qK4cg4r_' ]);

主动发送语音消息 // https://developers.weixin.qq.com/doc/offiaccount/Message_Management/Service_Center_messages.html $api->send('ocNtAt_K8nRlAdmNEo_R0WVg_rRw', [ 'type' => 'voice', 'media_id' => 'rVT43tfDwjh4p1BV2gJ5D7Zl2BswChO5L_llmlphLaTPytcGcguBAEJ1qK4cg4r_' ]);

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

showname2020 avatar Jun 27 '21 21:06 showname2020

您好,gaoming。你的sdk包非常出色。我使用了sdk包,却出现了这个问题: 该公众号提供的服务出现故障,请稍后再试

可有解决办法?感谢

showname2020 avatar Aug 12 '23 05:08 showname2020