weizong song 2 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'));
$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', '调用后状态', '首次成功引用'],
[[

@ -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);

Loading…
Cancel
Save