From 8b2ec8a590ef3190e2b661e050413d7b7c056fa8 Mon Sep 17 00:00:00 2001 From: weizong song Date: Mon, 31 Aug 2026 08:32:14 +0800 Subject: [PATCH] up --- app/Console/Commands/VerifyQccEnterprisePackInfo.php | 5 ++++- app/Repositories/YuanheRepository.php | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/Console/Commands/VerifyQccEnterprisePackInfo.php b/app/Console/Commands/VerifyQccEnterprisePackInfo.php index ca3d6a9..e444bc8 100644 --- a/app/Console/Commands/VerifyQccEnterprisePackInfo.php +++ b/app/Console/Commands/VerifyQccEnterprisePackInfo.php @@ -39,6 +39,7 @@ class VerifyQccEnterprisePackInfo extends Command } $requestRef = sprintf('pack-info-cli-%d-%s', $company->id, now()->format('YmdHisv')); + $yuanheRepository = new YuanheRepository(); $this->info("开始调用 packInfo:{$company->company_name}({$company->credit_code})"); $this->line("请求引用:{$requestRef}"); @@ -47,7 +48,7 @@ class VerifyQccEnterprisePackInfo extends Command $company, 'enterprise-pack-info-cli', $requestRef, - fn () => (new YuanheRepository())->enterprisePackInfo([ + fn () => $yuanheRepository->enterprisePackInfo([ 'creditCode' => $company->credit_code, 'enterpriseName' => $company->company_name, ]), @@ -58,6 +59,7 @@ class VerifyQccEnterprisePackInfo extends Command ); } catch (Throwable $exception) { $this->error($exception->getMessage()); + $this->line('签名 timestamp:' . ($yuanheRepository->lastRequestTimestamp ?? '(未生成)')); if ($exception instanceof YuanhePackInfoException) { $this->table( ['HTTP 状态', 'Content-Type', '响应字节数'], @@ -77,6 +79,7 @@ class VerifyQccEnterprisePackInfo extends Command } $freshAccount = $account->fresh(); + $this->line('签名 timestamp:' . ($yuanheRepository->lastRequestTimestamp ?? '(未生成)')); $this->table( ['元禾 code', '元禾 msg', '调用后状态', '首次成功引用'], [[ diff --git a/app/Repositories/YuanheRepository.php b/app/Repositories/YuanheRepository.php index a4bcf12..910813d 100755 --- a/app/Repositories/YuanheRepository.php +++ b/app/Repositories/YuanheRepository.php @@ -16,6 +16,7 @@ class YuanheRepository public $baseUrl; public $customerId; public $authKey; + public $lastRequestTimestamp; public function __construct() { @@ -27,7 +28,8 @@ class YuanheRepository public function getHeader() { - $timestamp = time() * 1000; + $timestamp = (string) floor(microtime(true) * 1000); + $this->lastRequestTimestamp = $timestamp; $token = $this->customerId . $timestamp . $this->authKey; $token = md5($token); $token = strtoupper($token);