diff --git a/App/Config.php b/App/Config.php index 27209a3..5d4ac24 100644 --- a/App/Config.php +++ b/App/Config.php @@ -38,7 +38,6 @@ class Config static public $DEBUG = false; const ARTICLE_URL = "/api/public/Blog/article"; - static public function Url(){ if (true == Config::$DEBUG){ return "/api/public/"; @@ -54,4 +53,12 @@ class Config 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/"; + } + } } \ No newline at end of file diff --git a/App/Controllers/NewUi.php b/App/Controllers/NewUi.php index ec7e55e..b857be7 100644 --- a/App/Controllers/NewUi.php +++ b/App/Controllers/NewUi.php @@ -49,7 +49,8 @@ class NewUi extends Controller "groups" => $groups, "group_types"=>$groupstype, "topdoc"=>$top5, - "title"=>"一个博客", + "title"=>"博客", + "openapi"=>\App\Config::OpenApiUrl(), ]); else{ View::renderTemplate("/blog/index.html",[ @@ -63,7 +64,8 @@ class NewUi extends Controller "groups" => $groups, "group_types"=>$groupstype, "topdoc"=>$top5, - "title"=>"一个博客", + "title"=>"博客", + "openapi"=>\App\Config::OpenApiUrl(), ]); } } @@ -114,6 +116,8 @@ class NewUi extends Controller "doc_type"=>$doc[0]["type"], "group_type"=>$docModel->TypeGroup($doc[0]["type"])[0][0], "topdoc"=>$top5, + "openapi"=>\App\Config::OpenApiUrl(), + ]); else{ View::renderTemplate("/blog/article.html",[ @@ -132,6 +136,8 @@ class NewUi extends Controller "doc_type"=>$doc[0]["type"], "group_type"=>$docModel->TypeGroup($doc[0]["type"])[0][0], "topdoc"=>$top5, + "openapi"=>\App\Config::OpenApiUrl(), + ]); } } @@ -170,6 +176,8 @@ class NewUi extends Controller "doc_type"=>$doc[0]["type"], "group_type"=>$docModel->TypeGroup($doc[0]["type"])[0][0], "topdoc"=>$top5, + "openapi"=>\App\Config::OpenApiUrl(), + ]); else View::renderTemplate("/blog/article.html", [ @@ -188,6 +196,7 @@ class NewUi extends Controller "doc_type"=>$doc[0]["type"], "group_type"=>$docModel->TypeGroup($doc[0]["type"])[0][0], "topdoc"=>$top5, + "openapi"=>\App\Config::OpenApiUrl(), ]); } else { View::renderTemplate("/blog/article.html", ['title' => 'test', 'index' => false]); diff --git a/App/Views/blog/index.html b/App/Views/blog/index.html index ce103f7..a4d7fbb 100644 --- a/App/Views/blog/index.html +++ b/App/Views/blog/index.html @@ -136,8 +136,9 @@ } } $(document).ready( - function () { + + var devicePixelRatio = window.devicePixelRatio || 1; dpi_x = document.getElementById('testdiv').offsetWidth * devicePixelRatio; dpi_y = document.getElementById('testdiv').offsetHeight * devicePixelRatio; @@ -163,8 +164,6 @@ }); $(".es-list").left = $("#editable-select").offset().left; var audio = document.getElementById('audio'); - console.log("audio is ",audio); - audio.play(); }) $(function() { var defaultData = [ diff --git a/App/Views/blog/template/tools.html b/App/Views/blog/template/tools.html index 112f624..0a3cc3a 100644 --- a/App/Views/blog/template/tools.html +++ b/App/Views/blog/template/tools.html @@ -109,10 +109,9 @@ function on_click() { } function on_click_ddl(){ - console.log(JSON.stringify($("#ddl").val())) $.ajax({ type:"post", - url:"https://www.testingcloud.club/sapi/openapi/ddl2orm", + url:"{{openapi}}openapi/ddl2orm", contentType: "application/json", async: false, data :JSON.stringify({ @@ -123,8 +122,23 @@ function on_click_ddl(){ }, dataType:"json" }, -); + ); + $.ajax({ + type:"post", + url:"{{openapi}}openapi/ddl2markdown", + contentType: "application/json", + async: false, + data :JSON.stringify({ + data:$("#ddl").val() + }), + success: function(result) { + $('#gencode').text($('#gencode').val() + "\r\n\r\n" + result.Data); + }, + dataType:"json" + } + ) } +
- ddl2sql + sql ddl to struct and markdown,将sql表自动化生成代码内对应的结构体和markdown表格格式,节省宝贵的时间。