直播间创建为什么一直提示300031 ?
一直报错:图片尺寸是加工过的,1920*1080px
{"errmsg":"coverimg invalid rid: 5f87f231-7d3ada33-098c7c99","errcode":300031}
代码如下:
// $result = $this->wx->material->uploadImage('/www/wwwroot/dev/houphp/static/fm.png');
// var_dump($result);
$url = 'https://api.weixin.qq.com/wxaapi/broadcast/room/create?access_token=' . $this->access_token;
$beginTime = strtotime("2020-10-15 16:30:10");
$endTime = strtotime("2020-10-15 18:30:10");
$params = [
'name' => "测试直播房间", // 房间名字
'coverImg' => "2xFxG_nxmQkPPD5FP6QqpiuNdRkOFGt7o5zk2AS2VFE", // 通过 uploadfile 上传,填写 mediaID
'startTime' => $beginTime, // 开始时间
'endTime' => $endTime, // 结束时间
'anchorName' => "Amos", // 主播昵称
'anchorWechat' => "jun440964", // 主播微信号
//'subAnchorWechat' => "WxgQiao_03", // 主播副号微信号
//'shareImg' => "" , //通过 uploadfile 上传,填写 mediaID
//'feedsImg' => "", //通过 uploadfile 上传,填写 mediaID
'isFeedsPublic' => 1, // 是否开启官方收录,1 开启,0 关闭
'type' => 1 , // 直播类型,1 推流 0 手机直播
'screenType' => 0, // 1:横屏 0:竖屏
'closeLike' => 0 , // 是否 关闭点赞 1 关闭
'closeGoods' => 0, // 是否 关闭商品货架,1:关闭
'closeComment' => 0 , // 是否开启评论,1:关闭
'closeReplay' => 0 , // 是否关闭回放 1 关闭
'closeShare' => 0, // 是否关闭分享 1 关闭
'closeKf' => 0, // 是否关闭客服,1 关闭
];
$data = json_encode($params);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 60);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'Content-Length:' . strlen($data)));
curl_setopt($ch, CURLOPT_POSTFIELDS , $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($ch);
echo $output;
curl_close($ch);