master^2
weizong song 5 days ago
parent ee1912e173
commit 8b2ec8a590

@ -39,6 +39,7 @@ class VerifyQccEnterprisePackInfo extends Command
} }
$requestRef = sprintf('pack-info-cli-%d-%s', $company->id, now()->format('YmdHisv')); $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->info("开始调用 packInfo{$company->company_name}{$company->credit_code}");
$this->line("请求引用:{$requestRef}"); $this->line("请求引用:{$requestRef}");
@ -47,7 +48,7 @@ class VerifyQccEnterprisePackInfo extends Command
$company, $company,
'enterprise-pack-info-cli', 'enterprise-pack-info-cli',
$requestRef, $requestRef,
fn () => (new YuanheRepository())->enterprisePackInfo([ fn () => $yuanheRepository->enterprisePackInfo([
'creditCode' => $company->credit_code, 'creditCode' => $company->credit_code,
'enterpriseName' => $company->company_name, 'enterpriseName' => $company->company_name,
]), ]),
@ -58,6 +59,7 @@ class VerifyQccEnterprisePackInfo extends Command
); );
} catch (Throwable $exception) { } catch (Throwable $exception) {
$this->error($exception->getMessage()); $this->error($exception->getMessage());
$this->line('签名 timestamp' . ($yuanheRepository->lastRequestTimestamp ?? '(未生成)'));
if ($exception instanceof YuanhePackInfoException) { if ($exception instanceof YuanhePackInfoException) {
$this->table( $this->table(
['HTTP 状态', 'Content-Type', '响应字节数'], ['HTTP 状态', 'Content-Type', '响应字节数'],
@ -77,6 +79,7 @@ class VerifyQccEnterprisePackInfo extends Command
} }
$freshAccount = $account->fresh(); $freshAccount = $account->fresh();
$this->line('签名 timestamp' . ($yuanheRepository->lastRequestTimestamp ?? '(未生成)'));
$this->table( $this->table(
['元禾 code', '元禾 msg', '调用后状态', '首次成功引用'], ['元禾 code', '元禾 msg', '调用后状态', '首次成功引用'],
[[ [[

@ -16,6 +16,7 @@ class YuanheRepository
public $baseUrl; public $baseUrl;
public $customerId; public $customerId;
public $authKey; public $authKey;
public $lastRequestTimestamp;
public function __construct() public function __construct()
{ {
@ -27,7 +28,8 @@ class YuanheRepository
public function getHeader() public function getHeader()
{ {
$timestamp = time() * 1000; $timestamp = (string) floor(microtime(true) * 1000);
$this->lastRequestTimestamp = $timestamp;
$token = $this->customerId . $timestamp . $this->authKey; $token = $this->customerId . $timestamp . $this->authKey;
$token = md5($token); $token = md5($token);
$token = strtoupper($token); $token = strtoupper($token);

Loading…
Cancel
Save