MCPcopy Create free account
hub / github.com/aixed/WeChat-Hook / Route_SendImageMsg

Function Route_SendImageMsg

src/SendImageMsg.cpp:9–40  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7using json = nlohmann::json;
8
9void Route_SendImageMsg(httplib::Server& svr)
10{
11 svr.Post("/SendImgMsg", [](const httplib::Request& req, httplib::Response& res)
12 {
13 json reqJson;
14 json resp;
15
16 try
17 {
18 reqJson = json::parse(req.body);
19 }
20 catch (...)
21 {
22 resp["ret"] = -1;
23 resp["msg"] = "invalid json";
24 res.set_content(resp.dump(), "application/json");
25 return;
26 }
27
28 std::string wxidorgid = reqJson.value("wxidorgid", "");
29 std::string path = reqJson.value("path", "");
30
31
32 WeixinSend::SendImage(wxidorgid, path);
33
34
35 resp["ret"] = 0;
36 resp["retmsg"] = "success";
37
38 res.set_content(resp.dump(), "application/json");
39 });
40}

Callers 1

RegisterRoutesFunction · 0.85

Calls 6

SendImageFunction · 0.85
parseFunction · 0.50
PostMethod · 0.45
set_contentMethod · 0.45
dumpMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected