api/App/Config.php

92 lines
2.2 KiB
PHP

<?php
namespace App;
/**
* Application configuration
*
* PHP version 7.0
*/
class Config
{
/**
* Database host
* @var string
*/
const DB_HOST = '117.50.187.222';
/**
* Database name
* @var string
*/
const DB_NAME = 'background';
const ROUTE_PREFIX_DEV = "/api/public/";
const ROUTE_PREFIX = "/wapi/";
/**
* Database user
* @var string
*/
const DB_USER = 'caiyu';
/**
* Database password
* @var string
*/
const DB_PASSWORD = 'zhengcaiyu123';
/**
* Show or hide error messages on screen
* @var boolean
*/
const SHOW_ERRORS = true;
static public $DEBUG = false;
const ARTICLE_URL = "/api/public/Blog/article";
static public function Url(){
if (true == Config::$DEBUG){
return "/api/public/";
}else{
return "/wapi/";
}
}
static public function DBUrl() {
if ( "0.0.0.0" == $_SERVER['SERVER_NAME']){
return "117.50.176.114";
}
if("testingcloud.club" == $_SERVER['SERVER_NAME']){
return "127.0.0.1";
}
}
static public function ServerUrl() {
if ( "0.0.0.0" == $_SERVER['SERVER_NAME']){
return "http://127.0.0.1/api/public/";
}
if("testingcloud.club" == $_SERVER['SERVER_NAME']){
return "https://www.testingcloud.club/wapi/";
}
if("" == $_SERVER['SERVER_NAME']){
return "https://www.testingcloud.club/wapi/";
}
}
static public function OpenApiUrl() {
if ( "0.0.0.0" == $_SERVER['SERVER_NAME']){
return "http://127.0.0.1:4596";
}
if("testingcloud.club" == $_SERVER['SERVER_NAME']){
return "https://www.testingcloud.club/sapi/";
}
return "https://www.testingcloud.club/sapi/";
}
static public function RedisServer() {
if("localhost" == $_SERVER['SERVER_NAME']){
return "127.0.0.1";
}
if ( "0.0.0.0" == $_SERVER['SERVER_NAME']){
return "192.168.0.200";
}
if("testingcloud.club" == $_SERVER['SERVER_NAME']){
return "127.0.0.1";
}
return "127.0.0.1";
}
}