From 6cf98140ff800bfb2ddbc0c3959872535eef5402 Mon Sep 17 00:00:00 2001 From: kiritow <1362050620@qq.com> Date: Fri, 17 Nov 2017 14:32:28 +0800 Subject: [PATCH] Fix Framework --- .gitmodules | 3 +++ HTTPWrapper | 2 +- addbook.cpp | 0 addbooktype.cpp | 0 editbook.cpp | 0 editbooktype.cpp | 0 explore.cpp | 0 installer.cpp | 37 ++++++++----------------------------- login.cpp | 0 register.cpp | 0 removebook.cpp | 0 removebooktype.cpp | 0 search.cpp | 0 13 files changed, 12 insertions(+), 30 deletions(-) create mode 100644 addbook.cpp create mode 100644 addbooktype.cpp create mode 100644 editbook.cpp create mode 100644 editbooktype.cpp create mode 100644 explore.cpp create mode 100644 login.cpp create mode 100644 register.cpp create mode 100644 removebook.cpp create mode 100644 removebooktype.cpp create mode 100644 search.cpp diff --git a/.gitmodules b/.gitmodules index dce47f2..ac2c362 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,3 +4,6 @@ [submodule "MySQLWrapper"] path = MySQLWrapper url = http://kiritow.com:3000/HCTECH/MySQLWrapper.git +[submodule "WinUtil"] + path = WinUtil + url = http://kiritow.com:3000/Kiritow/WinUtil diff --git a/HTTPWrapper b/HTTPWrapper index c4392bb..efbdcd7 160000 --- a/HTTPWrapper +++ b/HTTPWrapper @@ -1 +1 @@ -Subproject commit c4392bbb9577687737114f237b0c3af641d75208 +Subproject commit efbdcd7554942a0999a4f29fc95d79e7c9d3c1f8 diff --git a/addbook.cpp b/addbook.cpp new file mode 100644 index 0000000..e69de29 diff --git a/addbooktype.cpp b/addbooktype.cpp new file mode 100644 index 0000000..e69de29 diff --git a/editbook.cpp b/editbook.cpp new file mode 100644 index 0000000..e69de29 diff --git a/editbooktype.cpp b/editbooktype.cpp new file mode 100644 index 0000000..e69de29 diff --git a/explore.cpp b/explore.cpp new file mode 100644 index 0000000..e69de29 diff --git a/installer.cpp b/installer.cpp index d496a4d..949043e 100644 --- a/installer.cpp +++ b/installer.cpp @@ -74,32 +74,6 @@ static vector splitMultiSQL(const string& multisql) return vec; } -template -void _do_make_str(ostringstream& ostr,T&& x) -{ - ostr< -void _do_make_str(ostringstream& ostr,T&& x,Args&&... args) -{ - ostr< -string make_str(Args&&... args) -{ - ostringstream ostr; - _do_make_str(ostr,args...); - return ostr.str(); -} - int main() { Request req; @@ -119,13 +93,11 @@ int main() !req.post["dbuser"].empty() && !req.post["dbpass"].empty() && !req.post["dbname"].empty() && - !req.post["tbprefix"].empty() && !req.post["supass"].empty()) { string s=getFileContent("setup.sql"); - replaceFlag(s,"{prefix}",req.post["tbprefix"]); vector vec=splitMultiSQL(s); - vec.push_back(make_str("insert into ",req.post["tbprefix"],"_user values ('root','",req.post["supass"],"','SuperUser',0,3) ")); + vec.push_back(make_str("insert into bs_user values ('root','",req.post["supass"],"','SuperUser',0,3) ")); int ecode; string emsg; int ret=doInstall(req.post["dbaddr"],req.post["dbuser"],req.post["dbpass"],req.post["dbname"],ParseInt(req.post["dbport"]),vec, @@ -140,6 +112,7 @@ int main() else { j["success"]=1; + WriteDBConfig(req.post["dbaddr"],req.post["dbuser"],req.post["dbpass"],req.post["dbname"],ParseInt(req.post["dbport"])); } } else @@ -149,6 +122,12 @@ int main() j["errmsg"]=make_str("Failed to parse parameters. Please retry."); } } + else + { + j["success"]=0; + j["errcode"]=3; + j["errmsg"]=make_str("Unknown request method."); + } res.content.append(j.dump()); res.show(); diff --git a/login.cpp b/login.cpp new file mode 100644 index 0000000..e69de29 diff --git a/register.cpp b/register.cpp new file mode 100644 index 0000000..e69de29 diff --git a/removebook.cpp b/removebook.cpp new file mode 100644 index 0000000..e69de29 diff --git a/removebooktype.cpp b/removebooktype.cpp new file mode 100644 index 0000000..e69de29 diff --git a/search.cpp b/search.cpp new file mode 100644 index 0000000..e69de29