58 lines
1.1 KiB
PHP
58 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace app\common\helper;
|
|
|
|
use think\facade\Db;
|
|
use app\common\server\RedisHelper;
|
|
|
|
/**
|
|
* 环境帮助类
|
|
* 用于获取系统环境参数
|
|
*/
|
|
class EnvHelper
|
|
{
|
|
|
|
|
|
private static $youda_env = null;
|
|
|
|
/**
|
|
* 获取友达环境
|
|
*
|
|
* @return string 友达环境
|
|
*/
|
|
public static function getYoudaEnv()
|
|
{
|
|
if (self::$youda_env !== null) {
|
|
return self::$youda_env;
|
|
}
|
|
$youda_env = env('youda.youda_env', 'production ');
|
|
if ($youda_env) {
|
|
self::$youda_env = $youda_env;
|
|
}
|
|
return self::$youda_env;
|
|
}
|
|
|
|
/**
|
|
* 获取是否为测试环境
|
|
*
|
|
* @return bool 是否为测试环境
|
|
*/
|
|
public static function getIsTest()
|
|
{
|
|
return self::getYoudaEnv() == "test";
|
|
}
|
|
|
|
/**
|
|
* 获取友达web域名
|
|
*
|
|
* @return string 友达web域名
|
|
*/
|
|
public static function getWebDomain()
|
|
{
|
|
if (self::getIsTest()) {
|
|
return "https://testweb.zfunbox.cn";
|
|
}
|
|
return "https://zfunbox.cn";
|
|
}
|
|
|
|
} |