Skip to content

Commit

Permalink
fix authcode
Browse files Browse the repository at this point in the history
  • Loading branch information
kakuilan committed May 6, 2024
1 parent caa4bda commit 2e33444
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Helpers/EncryptHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public static function base64UrlDecode(string $data): string {
* @param string $data 数据
* @param string $key 密钥
* @param bool $encode 操作:true时为加密,false时为解密
* @param int $expiry 有效期/秒,为0时代表永久(100年)
* @param int $expiry 有效期/秒,0为永久(100年),负数为已过期
* @return array
*/
public static function authcode(string $data, string $key, bool $encode = true, int $expiry = 0): array {
Expand All @@ -74,7 +74,7 @@ public static function authcode(string $data, string $key, bool $encode = true,
$keyLength = strlen($cryptkey);

if ($encode) {
if ($expiry <= 0) {
if ($expiry == 0) {
$expiry = 3153600000; //100年
}
$expiry = $expiry + $now;
Expand Down

0 comments on commit 2e33444

Please sign in to comment.