更新直播送礼

This commit is contained in:
yaooo 2023-10-26 16:11:27 +08:00
parent d6d31ba1fd
commit 7395229cff

View File

@ -43,16 +43,23 @@ class Zhibo extends BaseController
}
$token = request()->header('x-token');
//查询直播间及礼物接口,验证直播间信息及礼物信息
$client = new Client();
$response = $client->request('POST', $this->checkUrl, [
'verify' => false,
'headers' => ['X-Token' => $token],
'json' => [
"live_stream_id" => $params['live_stream_id'],
"master_id" => $params['master_id'],
"gift_id" => $params['gift_id']
]
]);
try {
$client = new Client();
$response = $client->request('POST', $this->checkUrl, [
'timeout' => 5,
'verify' => false,
'headers' => ['X-Token' => $token],
'json' => [
"live_stream_id" => $params['live_stream_id'],
"master_id" => $params['master_id'],
"gift_id" => $params['gift_id']
]
]);
$responseData = json_decode($response->getBody()->getContents(), true);
} catch (RequestException $e) {
return app('json')->fail($e->getMessage());
}
$responseData = json_decode($response->getBody()->getContents(), true);
if (empty($responseData['code'])) {
$failMsg = $responseData['msg'];