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" + } + ) } +
@@ -183,7 +197,7 @@ function on_click_ddl(){

- ddl2sql + sql ddl to struct and markdown,将sql表自动化生成代码内对应的结构体和markdown表格格式,节省宝贵的时间。

@@ -191,13 +205,28 @@ function on_click_ddl(){ 输入ddl:
+CREATE TABLE `doc` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + `type` int(11) NULL DEFAULT NULL, + `content` longblob NULL, + `author` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + `create_time` datetime(0) NULL DEFAULT NULL, + `update_time` datetime(0) NULL DEFAULT NULL, + `delete_time` datetime(0) NULL DEFAULT NULL, + `version` float(255, 0) NULL DEFAULT 0, + `is_public` int(1) UNSIGNED ZEROFILL NULL DEFAULT 0, + `deleted` int(1) NULL DEFAULT 0, + `origin_url` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 390 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
输出代码:
-
diff --git a/Core/Error.php b/Core/Error.php index a7cbb24..d4acc8a 100644 --- a/Core/Error.php +++ b/Core/Error.php @@ -22,7 +22,7 @@ class Error */ public static function errorHandlerNone($level, $message, $file, $line) { - echo "Handler captured error $level: '$message'" . PHP_EOL; +// echo "Handler captured error $level: '$message'" . PHP_EOL; } diff --git a/Core/Model.php b/Core/Model.php index 8072edb..b299561 100644 --- a/Core/Model.php +++ b/Core/Model.php @@ -58,7 +58,7 @@ abstract class Model $db = new PDO($dsn, Config::DB_USER, Config::DB_PASSWORD, $ssl); //$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); }catch(PDOException $e) { - echo $e->getMessage(); + //echo $e->getMessage(); die; } // Throw an Exception when an error occurs