diff --git a/app/Controller/TestController.php b/app/Controller/TestController.php index 0ea0806..1c227d3 100644 --- a/app/Controller/TestController.php +++ b/app/Controller/TestController.php @@ -462,27 +462,40 @@ class TestController extends AbstractController } public function test_17(){ - $weChat = new Wechat(1); - $env_version = "release"; - $app_env = \Hyperf\Support\env("APP_ENV",'dev'); - if ($app_env == "dev"){ - $env_version = "trial"; - } + $re = \Hyperf\Context\ApplicationContext::getContainer()->get(CacheInterface::class); + $a = $re->set("wucongxing","1",100); + dump($a); + $b = $re->get("wucongxing"); + dump($b); - $options = [ - "scene" => "?doctor_id=516900370252341248",// query 参数 - "page" => "pages/expertDetail/expertDetail", - "check_path" => false, - "env_version" => $env_version, - ]; + $redis = \Hyperf\Context\ApplicationContext::getContainer()->get(Redis::class); + $c = $redis->get("wucongxing"); + dump($c); - $img_buffer = $weChat->getUnlimitedQRCode($options); - $oss = new Oss(); - - $filename = "applet/doctor/card/516900370252341248.jpg"; - - $oss->putObject($filename, $img_buffer); +// +// $weChat = new Wechat(1); +// +// $env_version = "release"; +// $app_env = \Hyperf\Support\env("APP_ENV",'dev'); +// if ($app_env == "dev"){ +// $env_version = "trial"; +// } +// +// $options = [ +// "scene" => "?doctor_id=516900370252341248",// query 参数 +// "page" => "pages/expertDetail/expertDetail", +// "check_path" => false, +// "env_version" => $env_version, +// ]; +// +// $img_buffer = $weChat->getUnlimitedQRCode($options); +// +// $oss = new Oss(); +// +// $filename = "applet/doctor/card/516900370252341248.jpg"; +// +// $oss->putObject($filename, $img_buffer); } } \ No newline at end of file diff --git a/extend/Wechat/Wechat.php b/extend/Wechat/Wechat.php index 4889b8e..d7dd1d7 100644 --- a/extend/Wechat/Wechat.php +++ b/extend/Wechat/Wechat.php @@ -22,6 +22,8 @@ use Symfony\Contracts\HttpClient\Exception\RedirectionExceptionInterface; use Symfony\Contracts\HttpClient\Exception\ServerExceptionInterface; use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface; use Hyperf\Context\ApplicationContext; +use Hyperf\Guzzle\CoroutineHandler; + /** * 微信类 @@ -70,17 +72,6 @@ class Wechat // 'base_uri' => 'https://api.weixin.qq.com/', // 如果你在国外想要覆盖默认的 url 的时候才使用,根据不同的模块配置不同的 uri 'retry' => true, // 使用默认重试配置 - // 'retry' => [ - // // 仅以下状态码重试 - // 'http_codes' => [429, 500] - // // 最大重试次数 - // 'max_retries' => 3, - // // 请求间隔 (毫秒) - // 'delay' => 1000, - // // 如果设置,每次重试的等待时间都会增加这个系数 - // // (例如. 首次:1000ms; 第二次: 3 * 1000ms; etc.) - // 'multiplier' => 3 - // ], ] );