From aeb4f3d7fb15f853f5abcc6ff7943fc936fa9d17 Mon Sep 17 00:00:00 2001 From: whwyy Date: Tue, 7 May 2024 14:42:30 +0800 Subject: [PATCH] eee --- wx/SecCheck.php | 44 +++++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/wx/SecCheck.php b/wx/SecCheck.php index 37387a5..65d4d14 100644 --- a/wx/SecCheck.php +++ b/wx/SecCheck.php @@ -6,25 +6,27 @@ namespace wchat\wx; use wchat\common\Result; -enum Scene -{ - - case SCENE_INFO; - case SCENE_REPLY; - case SCENE_DISCAZ; - case SCENE_SHEJIAO; - - - public function getValue(): int - { - return match ($this) { - self::SCENE_INFO => 1, - self::SCENE_REPLY => 2, - self::SCENE_DISCAZ => 3, - self::SCENE_SHEJIAO => 4, - }; - } -} +//if (PHP_VERSION > '8.2') { +// enum Scene +// { +// +// case SCENE_INFO; +// case SCENE_REPLY; +// case SCENE_DISCAZ; +// case SCENE_SHEJIAO; +// +// +// public function getValue(): int +// { +// return match ($this) { +// self::SCENE_INFO => 1, +// self::SCENE_REPLY => 2, +// self::SCENE_DISCAZ => 3, +// self::SCENE_SHEJIAO => 4, +// }; +// } +// } +//} /** @@ -90,7 +92,7 @@ class SecCheck extends SmallProgram * @param string $openId * @return Result */ - public function text(string $content, Scene $scene, string $openId): Result + public function text(string $content, int $scene, string $openId): Result { if (empty($content)) { return $this->sendError('文件不存在', 404); @@ -100,7 +102,7 @@ class SecCheck extends SmallProgram return $this->post('api.weixin.qq.com', $requestUrl, json_encode([ 'content' => $content, 'version' => 2, - 'scene' => $scene->getValue(), + 'scene' => $scene, 'openid' => $openId ], JSON_UNESCAPED_UNICODE), 'application/json'); }