From 69948eed13333df3d50efab5f9fc8cd2d0f77efc Mon Sep 17 00:00:00 2001 From: yaooo <272523191@qq.com> Date: Thu, 26 Oct 2023 15:39:42 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=9B=B4=E6=92=AD=E9=80=81?= =?UTF-8?q?=E7=A4=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/api/user/Zhibo.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/app/controller/api/user/Zhibo.php b/app/controller/api/user/Zhibo.php index 99b70d6c..97b424fe 100644 --- a/app/controller/api/user/Zhibo.php +++ b/app/controller/api/user/Zhibo.php @@ -30,6 +30,9 @@ use GuzzleHttp\Client; */ class Zhibo extends BaseController { + private $checkUrl = 'https://ceshi-zhibo.lihaink.cn/api/zhibo/checkGift'; + private $giftUrl = 'https://ceshi-zhibo.lihaink.cn/api/zhibo/sendGiftMessage'; + //用户直播送礼 public function reward() { @@ -40,9 +43,8 @@ class Zhibo extends BaseController } $token = request()->header('x-token'); //查询直播间及礼物接口,验证直播间信息及礼物信息 - $checkUrl = 'https://ceshi-zhibo.lihaink.cn/api/zhibo/checkGift'; $client = new Client(); - $response = $client->request('POST', $checkUrl, [ + $response = $client->request('POST', $this->checkUrl, [ 'verify' => false, 'headers' => ['X-Token' => $token], 'json' => [ @@ -106,16 +108,16 @@ class Zhibo extends BaseController } catch (Exception $e) { return app('json')->fail($e->getMessage()); } - $message = "{$user['nickname']}送出了{$params['gift_name']}"; //发送礼物消息 - $giftUrl = 'https://ceshi-zhibo.lihaink.cn/api/zhibo/sendGiftMessage'; + $message = "{$user['nickname']} 送出了 {$params['gift_name']}"; $client = new Client(); - $client->request('POST', $giftUrl, [ + $client->request('POST', $this->giftUrl, [ 'verify' => false, 'headers' => ['X-Token' => $token], 'json' => [ "live_stream_id" => $params['live_stream_id'], "app_name" => 'shop', + "gift_id" => $params['gift_id'], "message" => $message ] ]); @@ -131,7 +133,7 @@ class Zhibo extends BaseController if (empty($params['type'])) { return app('json')->fail('类型不能为空'); } - $user = $this->request->userInfo(); + $user = $this->request->userInfo(); $where = []; if ($params['type'] == 1) { // 送出的礼物 @@ -157,7 +159,7 @@ class Zhibo extends BaseController 'uzo.amount', 'ub.title', 'uzo.create_time' - ])->fetchSql(false)->select(); + ])->select(); return app('json')->success(compact('count', 'list')); } }