From 6e1b38a34b813f31256b66b33d61e7332f3ed056 Mon Sep 17 00:00:00 2001 From: Ying Date: Mon, 22 Aug 2022 11:38:13 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E5=A2=9E=E5=8A=A0=E9=AA=8C?= =?UTF-8?q?=E8=AF=81=E8=B6=85=E6=97=B6=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/library/Email.php | 8 +++++++- app/common/library/Sms.php | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/app/common/library/Email.php b/app/common/library/Email.php index 2ac3fc0..28bc68b 100644 --- a/app/common/library/Email.php +++ b/app/common/library/Email.php @@ -40,6 +40,12 @@ class Email */ private $userVModel; + /** + * 验证码过期时间 + * @var string + */ + private $expireTime = 5; //验证码过期时间(分钟) + /** * 错误信息 * @var string @@ -265,7 +271,7 @@ class Email // 是否过期 $expires = time() - strtotime($result['create_time']); - if ($expires <= 60) { + if ($expires <= $this->expireTime * 60) { return true; } diff --git a/app/common/library/Sms.php b/app/common/library/Sms.php index 63663bf..63def5d 100644 --- a/app/common/library/Sms.php +++ b/app/common/library/Sms.php @@ -33,6 +33,12 @@ class Sms protected $smsType = 'alisms'; + /** + * 验证码过期时间 + * @var string + */ + private $expireTime = 5; //验证码过期时间(分钟) + /** * 类构造函数 * class constructor. @@ -134,7 +140,7 @@ class Sms $result->status = 0; $result->save(); $expires = time() - strtotime($result['create_time']); - if ($expires <= 60) { + if ($expires <= $this->expireTime * 60) { return true; } $this->setError("当前验证码已过期!");