<?php
namespace app\common\library\wechat\live;
use app\common\library\wechat\WxBase;
class Room extends WxBase
{
public function getLiveRoomList()
{
$accessToken = $this->getAccessToken();
$apiUrl = "https://api.weixin.qq.com/wxa/business/getliveinfo?access_token={$accessToken}";
$params = $this->jsonEncode(['start' => 0, 'limit' => 100]);
$result = $this->post($apiUrl, $params);
$this->doLogs(['describe' => '微信小程序直播-获取直播房间列表接口', 'url' => $apiUrl, 'params' => $params, 'result' => $result]);
$response = $this->jsonDecode($result);
if (!isset($response['errcode'])) {
$this->error = 'not found errcode';
return false;
}
if ($response['errcode'] > 1 && $response['errcode'] != 9410000) {
$this->error = $response['errmsg'];
return false;
}
return $response;
}
}