From e16a7012ef7266d0d631fee6f0971968bb643aa1 Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Wed, 9 Mar 2022 15:11:08 +0800 Subject: [PATCH] fix check bcmath, fix error proof when no bcmath --- disk/Aliyundrive.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/disk/Aliyundrive.php b/disk/Aliyundrive.php index 6d0881a..0d577e8 100644 --- a/disk/Aliyundrive.php +++ b/disk/Aliyundrive.php @@ -573,7 +573,7 @@ class Aliyundrive { } else { if (isset($_POST['CalcProof'])&&is_numeric($_POST['filesize'])) { // Calc proof code - if (!function_exists('hexdec')) { + if (!function_exists('bcadd')) { // no php-bcmath return output(0, 200); } else { @@ -614,8 +614,11 @@ class Aliyundrive { //error_log1($res['body']); $parent_file_id = json_decode($res['body'], true)['file_id']; } - //$response = $this->fileCreate($parent_file_id, $filename, $_POST['filesha1'], $fileinfo['size'], ceil($fileinfo['size']/$_POST['chunksize'])); - $response = $this->fileCreate1($parent_file_id, $filename, $_POST['filesha1'], $_POST['proof_code'], $fileinfo['size'], ceil($fileinfo['size']/$_POST['chunksize'])); + if (!function_exists('bcadd')) { + $response = $this->fileCreate($parent_file_id, $filename, $_POST['filesha1'], $fileinfo['size'], ceil($fileinfo['size']/$_POST['chunksize'])); + } else { + $response = $this->fileCreate1($parent_file_id, $filename, $_POST['filesha1'], $_POST['proof_code'], $fileinfo['size'], ceil($fileinfo['size']/$_POST['chunksize'])); + } $res = json_decode($response['body'], true); if (isset($res['exist'])) { // 已经有