Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
kilvn committed Apr 8, 2021
1 parent 4f45e64 commit 4db1409
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions apps/api/Fcm.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class Fcm extends Base
{
protected static self $instance;
protected string $env;
protected string $test_key;
protected array $header_data = [];

public function __construct()
Expand All @@ -29,6 +30,10 @@ public function __construct()
'timestamps' => $this->timestamp,
'sign' => '',
];

if ($this->env == 'dev' and isset($this->reqData['test_key'])) {
$this->test_key = $this->reqData['test_key'];
}
}

/**
Expand Down Expand Up @@ -68,6 +73,9 @@ public function idcard_check()
}

$api_key = $_ENV['FCM_IDCARD_CHECK_KEY'];
if ($this->env == 'dev' and strlen($this->test_key)) {
$api_key = $this->test_key;
}
$urls = [
'production' => 'https://api.wlc.nppa.gov.cn/idcard/check/' . $api_key,
'dev' => 'https://wlc.nppa.gov.cn/test/authentication/check/' . $api_key,
Expand Down Expand Up @@ -117,6 +125,9 @@ public function idcard_query()
}

$api_key = $_ENV['FCM_IDCARD_QUERY_KEY'];
if ($this->env == 'dev' and strlen($this->test_key)) {
$api_key = $this->test_key;
}
$urls = [
'production' => 'http://api2.wlc.nppa.gov.cn/idcard/authentication/query/' . $api_key,
'dev' => 'https://wlc.nppa.gov.cn/test/authentication/query/' . $api_key,
Expand Down Expand Up @@ -172,6 +183,9 @@ public function behavior()
];

$api_key = $_ENV['FCM_BEHAVIOR_KEY'];
if ($this->env == 'dev' and strlen($this->test_key)) {
$api_key = $this->test_key;
}
$urls = [
'production' => 'http://api2.wlc.nppa.gov.cn/behavior/collection/loginout/' . $api_key,
'dev' => 'https://wlc.nppa.gov.cn/test/collection/loginout/' . $api_key,
Expand Down

0 comments on commit 4db1409

Please sign in to comment.