@@ -51,16 +51,9 @@ void chat(const HttpRequestPtr &req, std::function<void(const HttpResponsePtr &)
51
51
}
52
52
void check (const HttpRequestPtr &req, std::function<void (const HttpResponsePtr &)> &&callback)
53
53
{
54
- auto body = req->getBody ();
55
- Json::Value req_json, res_json;
54
+ Json::Value res_json;
56
55
Json::Reader reader;
57
- std::string bodyStr (body);
58
- if (!reader.parse (bodyStr, req_json))
59
- {
60
- callback (HttpResponse::newHttpResponse ());
61
- return ;
62
- }
63
- std::string me, who_send_me;
56
+ std::string me;
64
57
Json::FastWriter writer;
65
58
std::string authHeader = req->getHeader (" Authorization" );
66
59
if (authHeader.substr (0 , 7 ) == " Bearer " )
@@ -85,8 +78,7 @@ void check(const HttpRequestPtr &req, std::function<void(const HttpResponsePtr &
85
78
86
79
auto res = HttpResponse::newHttpResponse ();
87
80
res->addHeader (" Access-Control-Allow-Origin" , " *" );
88
- who_send_me = req_json[" person" ].asString ();
89
- auto output = writer.write (sql_find_my_msg (me, who_send_me));
81
+ auto output = writer.write (sql_find_my_msg (me));
90
82
res->setBody (output);
91
83
callback (res);
92
84
}
@@ -166,7 +158,7 @@ void info(const HttpRequestPtr &req, std::function<void(const HttpResponsePtr &)
166
158
auto res = HttpResponse::newHttpResponse ();
167
159
res->addHeader (" Access-Control-Allow-Origin" , " *" );
168
160
if (req_json[" person" ].asString ()==" " ){
169
- res->setBody (writer.write (get_chat_info (me)));
161
+ res->setBody (writer.write (get_chat_info (me, " " )));
170
162
callback (res);
171
163
}else {
172
164
who_send_me = req_json[" person" ].asString ();
0 commit comments