From 3ee101403b2468da745a804d2aa632cfcad8f236 Mon Sep 17 00:00:00 2001 From: Jerry Yan <792602257@qq.com> Date: Wed, 26 Mar 2025 10:31:48 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=A8=E6=88=B7=E7=BB=91=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/controller/api/auth/Bind.php | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 plugs/think-plugs-cms/src/controller/api/auth/Bind.php diff --git a/plugs/think-plugs-cms/src/controller/api/auth/Bind.php b/plugs/think-plugs-cms/src/controller/api/auth/Bind.php new file mode 100644 index 0000000..9b3e612 --- /dev/null +++ b/plugs/think-plugs-cms/src/controller/api/auth/Bind.php @@ -0,0 +1,33 @@ + '用户登录验证', + ]; + public function send() + { + $data = $this->_vali([ + 'phone.mobile' => '手机号错误', + 'phone.require' => '手机号为空', + ]); + Library::$sapp->cache->set(static::genCacheKey($data['phone']), ['code' => 123456, 'time' => time() + 300], 600); + $this->success("测试验证码123456"); + } + + private static function genCacheKey(string $phone, string $scene = self::tLogin): string + { + if (isset(array_change_key_case(static::$scenes)[strtolower($scene)])) { + return md5(strtolower("sms-{$scene}-{$phone}")); + } else { + throw new Exception("未定义的业务"); + } + } +} \ No newline at end of file