Fix Framework

This commit is contained in:
Kirigaya Kazuto 2017-11-17 14:32:28 +08:00
parent f354c987a9
commit 6cf98140ff
13 changed files with 12 additions and 30 deletions

3
.gitmodules vendored
View File

@ -4,3 +4,6 @@
[submodule "MySQLWrapper"] [submodule "MySQLWrapper"]
path = MySQLWrapper path = MySQLWrapper
url = http://kiritow.com:3000/HCTECH/MySQLWrapper.git url = http://kiritow.com:3000/HCTECH/MySQLWrapper.git
[submodule "WinUtil"]
path = WinUtil
url = http://kiritow.com:3000/Kiritow/WinUtil

@ -1 +1 @@
Subproject commit c4392bbb9577687737114f237b0c3af641d75208 Subproject commit efbdcd7554942a0999a4f29fc95d79e7c9d3c1f8

0
addbook.cpp Normal file
View File

0
addbooktype.cpp Normal file
View File

0
editbook.cpp Normal file
View File

0
editbooktype.cpp Normal file
View File

0
explore.cpp Normal file
View File

View File

@ -74,32 +74,6 @@ static vector<string> splitMultiSQL(const string& multisql)
return vec; return vec;
} }
template<typename T>
void _do_make_str(ostringstream& ostr,T&& x)
{
ostr<<x;
}
void _do_make_str(ostringstream& ostr)
{
}
template<typename T,typename... Args>
void _do_make_str(ostringstream& ostr,T&& x,Args&&... args)
{
ostr<<x;
_do_make_str(ostr,args...);
}
template<typename... Args>
string make_str(Args&&... args)
{
ostringstream ostr;
_do_make_str(ostr,args...);
return ostr.str();
}
int main() int main()
{ {
Request req; Request req;
@ -119,13 +93,11 @@ int main()
!req.post["dbuser"].empty() && !req.post["dbuser"].empty() &&
!req.post["dbpass"].empty() && !req.post["dbpass"].empty() &&
!req.post["dbname"].empty() && !req.post["dbname"].empty() &&
!req.post["tbprefix"].empty() &&
!req.post["supass"].empty()) !req.post["supass"].empty())
{ {
string s=getFileContent("setup.sql"); string s=getFileContent("setup.sql");
replaceFlag(s,"{prefix}",req.post["tbprefix"]);
vector<string> vec=splitMultiSQL(s); vector<string> 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; int ecode;
string emsg; string emsg;
int ret=doInstall(req.post["dbaddr"],req.post["dbuser"],req.post["dbpass"],req.post["dbname"],ParseInt(req.post["dbport"]),vec, 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 else
{ {
j["success"]=1; j["success"]=1;
WriteDBConfig(req.post["dbaddr"],req.post["dbuser"],req.post["dbpass"],req.post["dbname"],ParseInt(req.post["dbport"]));
} }
} }
else else
@ -149,6 +122,12 @@ int main()
j["errmsg"]=make_str("Failed to parse parameters. Please retry."); 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.content.append(j.dump());
res.show(); res.show();

0
login.cpp Normal file
View File

0
register.cpp Normal file
View File

0
removebook.cpp Normal file
View File

0
removebooktype.cpp Normal file
View File

0
search.cpp Normal file
View File