写死的服务器地址改为自动判断

doctree
zcy 2024-01-09 23:14:55 +08:00
parent b1e28e0e63
commit e2319df3f6
9 changed files with 47 additions and 14 deletions

View File

@ -24,12 +24,19 @@ class Config
* Database user
* @var string
*/
const DB_USER = 'caiyu';
// const DB_USER = 'caiyu';
// /**
// * Database password
// * @var string
// */
// const DB_PASSWORD = 'zhengcaiyu123';
const DB_USER = 'background';
/**
* Database password
* @var string
*/
const DB_PASSWORD = 'zhengcaiyu123';
const DB_PASSWORD = 'a7458969';
/**
* Show or hide error messages on screen
* @var boolean
@ -60,9 +67,13 @@ class Config
if("testingcloud.club" == $_SERVER['SERVER_NAME']){
return "https://www.testingcloud.club/wapi/";
}
if("phpmyadmin" == $_SERVER['SERVER_NAME']){
return "https://sub1.testingcloud.club/wapi/";
}
if("" == $_SERVER['SERVER_NAME']){
return "https://www.testingcloud.club/wapi/";
}
var_dump("server name is ",$_SERVER['SERVER_NAME']);
}
static public function OpenApiUrl() {
if ( "0.0.0.0" == $_SERVER['SERVER_NAME']){
@ -71,6 +82,9 @@ class Config
if("testingcloud.club" == $_SERVER['SERVER_NAME']){
return "https://www.testingcloud.club/sapi/";
}
if("phpmyadmin" == $_SERVER['SERVER_NAME']){
return "https://sub1.testingcloud.club/sapi/";
}
return "https://www.testingcloud.club/sapi/";
}

View File

@ -181,6 +181,7 @@ class ArticleTree extends Controller
]);
}
else{
// print_r($this->params);
View::renderTemplate("/blog/article.html",[
"url"=>\App\Config::ServerUrl(),
'route'=>'article',
@ -189,7 +190,7 @@ class ArticleTree extends Controller
"alltitle" => $titles,
"groups" => $groups,
"group_types"=>$groupstype,
"title"=>urldecode ($this->params[1]),
// "title"=>urldecode ($this->params[1]),
"doc"=>$doc[0],
"docs"=>$doc,
"comments" => $doccoment,
@ -245,6 +246,7 @@ class ArticleTree extends Controller
]);
else
print_r($top5);
View::renderTemplate("/blog/article.html", [
"url"=>\App\Config::ServerUrl(),
'route'=>'article',

View File

@ -410,12 +410,14 @@ function expandNode(e) {
if(domain === '127.0.0.1'){
console.log("debug mode");
}else{
console.log(baseUrl);
baseUrl = "https://www.testingcloud.club/wapi/";
}
if(domain == "192.168.3.100"){
baseUrl = 'http://192.168.3.100/api/public/';
}
if(domain == "sub1.testingcloud.club"){
baseUrl = 'http://sub1.testingcloud.club/api/public/';
}
$('#editable-select').editableSelect({
effects: 'slide',
appendTo: '#search',
@ -457,13 +459,14 @@ function expandNode(e) {
baseUrl = 'http://127.0.0.1/api/public/';
console.log("debug mode");
}else{
console.log(baseUrl);
baseUrl = "https://www.testingcloud.club/wapi/";
}
if(domain == "192.168.3.100"){
console.log(baseUrl);
baseUrl = 'http://192.168.3.100/api/public/';
}
if(domain == "sub1.testingcloud.club"){
baseUrl = 'http://sub1.testingcloud.club/api/public/';
}
var keyword = document.getElementById("term").value;
if (keyword == "") {
clearContent();

View File

@ -178,6 +178,9 @@
if(domain == "192.168.3.100"){
baseUrl = 'http://192.168.3.100/api/public/';
}
if(domain == "sub1.testingcloud.club"){
baseUrl = 'http://sub1.testingcloud.club/api/public/';
}
$('#editable-select').editableSelect({
effects: 'slide',
appendTo: '#search',
@ -223,13 +226,16 @@
baseUrl = 'http://127.0.0.1/api/public/';
console.log("debug mode");
}else{
console.log(baseUrl);
baseUrl = "https://www.testingcloud.club/wapi/";
}
if(domain == "192.168.3.100"){
console.log(baseUrl);
baseUrl = 'http://192.168.3.100/api/public/';
}
if(domain == "sub1.testingcloud.club"){
console.log(baseUrl);
baseUrl = 'http://sub1.testingcloud.club/wapi/';
}
var keyword = document.getElementById("term").value;
if (keyword == "") {
clearContent();

View File

@ -47,12 +47,14 @@ $(document).ready(
if(domain === '127.0.0.1'){
console.log("debug mode");
}else{
console.log(baseUrl);
baseUrl = "https://www.testingcloud.club/wapi/";
}
if(domain == "192.168.3.100"){
var baseUrl = 'http://192.168.3.100/api/public/';
}
if(domain == "sub1.testingcloud.club"){
baseUrl = 'http://sub1.testingcloud.club/api/public/';
}
$.ajax({
method: "POST",
url: baseUrl + "Doc/count",

View File

@ -15,7 +15,7 @@
<h4 class="media-heading">耕耘领域:</h4>
<p>服务端开发</p>
<p>嵌入式开发</p>
<p><a href="https://gitee.com/290198252">git</a></p>>
<p><a href="http://zcy421593.wicp.net:2541/zcy">git</a></p>>
</div>
</div>
{% endblock %}

View File

@ -11,7 +11,7 @@
<ul class="subMenu" style="display: none;font-size: 25px;text-align: center;" >
{% for doc in docs.arr %}
<li>
<a href="https://www.testingcloud.club/wapi/Blog/article?title={{doc.title}}&type={{ docs.key }}">
<a href="{{ url }}/wapi/Blog/article?title={{doc.title}}&type={{ docs.key }}">
{{ doc.title }}
</a>
</li>

View File

@ -1,7 +1,10 @@
rm ../code.tar.gz
del ../code.tar.gz
tar.exe -czf ../code.tar.gz ./*
scp -i ./id_rsa_s ../code.tar.gz ubuntu@117.50.187.222:/home/ubuntu/
ssh -t -i ./id_rsa_s ubuntu@117.50.187.222 sudo tar -zxvf /home/ubuntu/code.tar.gz -C /var/www/html/api/
ssh -t -i ./id_rsa_s ubuntu@117.50.187.222 sudo rm /home/ubuntu/code.tar.gz
@REM scp -i ./id_rsa_s ../code.tar.gz ubuntu@117.50.187.222:/home/ubuntu/
@REM ssh -t -i ./id_rsa_s ubuntu@117.50.187.222 sudo tar -zxvf /home/ubuntu/code.tar.gz -C /var/www/html/api/
@REM ssh -t -i ./id_rsa_s ubuntu@117.50.187.222 sudo rm /home/ubuntu/code.tar.gz
scp -i g://sub1.testingcloud.club_id_ed25519 ../code.tar.gz root@47.92.237.210:/www/server/phpmyadmin
ssh -t -i g://sub1.testingcloud.club_id_ed25519 root@47.92.237.210 sudo tar -zxvf /www/server/phpmyadmin/code.tar.gz -C /www/server/phpmyadmin/api
ssh -t -i g://sub1.testingcloud.club_id_ed25519 root@47.92.237.210 sudo rm /www/server/phpmyadmin/code.tar.gz

View File

@ -47,6 +47,9 @@ if($_SERVER['HTTP_HOST'] == '192.168.3.100'){
if($_SERVER['HTTP_HOST'] == '117.50.176.114'){
$router->AddPrefix("/wapi/");
}
error_reporting(E_ALL);
set_error_handler('Core\Error::errorHandler');
set_exception_handler('Core\Error::exceptionHandler');
try{