添加ddl转markdown工具

deploy
DESKTOP-4RNDQIC\29019 2021-02-28 18:02:23 +08:00
parent d1cdd28136
commit 444c525601
6 changed files with 58 additions and 14 deletions

View File

@ -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/";
}
}
}

View File

@ -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]);

View File

@ -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 = [

View File

@ -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"
}
)
}
</script>
<div style="padding: 5px; margin: 0px;width: 100%">
<div class="row" >
@ -183,7 +197,7 @@ function on_click_ddl(){
</div>
<div class="tab-pane fade in" id="ddl2sql">
<p style="display: block;font-size: 20px ; text-align: center;">
ddl2sql
sql ddl to struct and markdown,将sql表自动化生成代码内对应的结构体和markdown表格格式,节省宝贵的时间。
</p>
<div class="row" style="width: 50%;display: inline-block;">
@ -191,13 +205,28 @@ function on_click_ddl(){
输入ddl:
</div>
<textarea id="ddl" class="col-md-10" style="background: #bbbbbb;height: 600px;" >
</textarea>
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;</textarea>
</div>
<div class="row" style="width: 50%;display: inline-block;margin-left: 30px;">
<div class="col-md-2" style="margin-left: -10px;">
输出代码:
</div>
<textarea id="gencode" class="col-md-10" style="background: #bbbbbb;height: 600px;" >
<textarea id="gencode" class="col-md-10" style="background: #bbbbbb;height: 600px;" readonly>
</textarea>
</div>
<form action="" class="form-horizontal" role="form" style="margin-top: 30px;margin-left: 40%">

View File

@ -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;
}

View File

@ -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