This commit is contained in:
@ -12,6 +12,7 @@
|
||||
#include <boost/json/object.hpp>
|
||||
#include <boost/json/parse.hpp>
|
||||
#include <boost/json/serialize.hpp>
|
||||
#include <boost/property_tree/xml_parser.hpp>
|
||||
#include <boost/url/parse.hpp>
|
||||
|
||||
namespace WeChat {
|
||||
@ -155,9 +156,21 @@ void Context::registerMoneyNote() {
|
||||
auto echostr = params.find("echostr");
|
||||
wxcpt.VerifyURL((*msg_signature).value, (*timestamp).value, (*nonce).value, (*echostr).value, reply);
|
||||
} else {
|
||||
LOG(info) << "received: " << request.body();
|
||||
std::string message;
|
||||
wxcpt.DecryptMsg((*msg_signature).value, (*timestamp).value, (*nonce).value, request.body(), message);
|
||||
boost::property_tree::ptree ptree;
|
||||
std::istringstream iss(message);
|
||||
boost::property_tree::read_xml(iss, ptree);
|
||||
if (ptree.count("xml.Content") > 0) {
|
||||
std::string content = ptree.get<std::string>("xml.Content");
|
||||
LOG(info) << "content: " << content;
|
||||
}
|
||||
ptree.put("xml.Content","i hate you.");
|
||||
std::ostringstream oss;
|
||||
boost::property_tree::write_xml(oss,ptree);
|
||||
wxcpt.EncryptMsg(oss.str(), (*timestamp).value, (*nonce).value, reply);
|
||||
}
|
||||
|
||||
|
||||
LOG(info) << "reply: " << reply;
|
||||
http::response<boost::beast::http::string_body> s{boost::beast::http::status::ok, request.version()};
|
||||
s.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
||||
|
Reference in New Issue
Block a user