Browse Source

update: move some config to .env

master
Dnomd343 3 years ago
parent
commit
c70282f8dc
  1. 2
      main.php
  2. 7
      models/cfopPic.php
  3. 4
      models/icpQuery.php
  4. 7
      models/ipInfo.php
  5. 7
      models/kmsCheck.php
  6. 4
      models/tldQuery.php

2
main.php

@ -8,6 +8,8 @@ require_once 'functions/RedisCache.php';
require_once 'functions/TgInterface.php';
require_once 'functions/ExtractDomain.php';
fastcgi_finish_request(); // 断开请求连接
$env = loadEnv('.env'); // 载入环境变量
$apiToken = $env['BOT_TOKEN'];
$botAccount = $env['BOT_NAME']; // 机器人用户名

7
models/cfopPic.php

@ -34,13 +34,14 @@ class cfopPicEntry {
}
private function getPicId($type) { // 返回图片文件ID
global $env;
switch ($type) {
case 'gan':
return 'BQACAgUAAxkBAAIBtGEOLnr4Q6D4Z_80bgfXq5xsZMeWAAKtAwACWy55VOU-SGKqc7aMIAQ';
return $env['CFOP_GAN'];
case 'mfg':
return 'BQACAgUAAxkBAAIB3WEOVHKeYrrGhFo-GffB0W-tQRKlAALQAwACWy55VGny8ArGMkfoIAQ';
return $env['CFOP_MFG'];
case 'yx':
return 'BQACAgUAAxkBAAIB32EOVISFQbgmir2abj6QkgqaSX1WAALRAwACWy55VMEuU9lCYTYWIAQ';
return $env['CFOP_YX'];
}
}

4
models/icpQuery.php

@ -1,11 +1,11 @@
<?php
class icpQuery {
private $apiPath = 'https://apidatav2.chinaz.com/single/icp';
private $apiPath;
public function __construct() {
global $env;
$this->apiPath .= '?key=' . $env['ICP_KEY'] . '&domain=';
$this->apiPath = $env['ICP_API'] . '?key=' . $env['ICP_KEY'] . '&domain=';
}
private function getIcpInfo($domain) { // ICP备案查询

7
models/ipInfo.php

@ -1,7 +1,12 @@
<?php
class ipInfo {
private $apiPath = 'https://api.343.re/ip/';
private $apiPath;
public function __construct() {
global $env;
$this->apiPath = $env['ECHOIP_API'];
}
private function changeCoor($num) { // 转为时分秒格式
$stage_1 = floor($num);

7
models/kmsCheck.php

@ -34,7 +34,12 @@ class kmsKeys {
}
class kmsCheck {
private $api = 'https://kms.343.re/';
private $api;
public function __construct() {
global $env;
$this->api = $env['KMS_API'];
}
public function kmsStatus($host, $port) {
$server = $host . ':' . $port;

4
models/tldQuery.php

@ -15,10 +15,10 @@ class tldQueryEntry {
return $info;
}
private function genMessage($info) {
private function genMessage($info) { // 生成返回消息
$msg = '`' . $info['tld'] . '` `(` `' . $info['type'] . '` `)`' . PHP_EOL;
if (count($info['manager']) !== 0) {
$msg .= '*Manager:*' . PHP_EOL;
$msg .= '*Manager*' . PHP_EOL;
foreach ($info['manager']['name'] as $row) {
$msg .= ' ' . $row . PHP_EOL;
}

Loading…
Cancel
Save