This commit is contained in:
Tony 2024-08-08 20:58:45 +08:00
parent b9c1370bfe
commit 3f8e10aa89
4 changed files with 36 additions and 1600 deletions

View File

@ -27,8 +27,9 @@ class MiscController : public http::HttpController<MiscController> {
ADD_PATH("/api/getTranslateVoiceText", GetTranslateVoiceText); ADD_PATH("/api/getTranslateVoiceText", GetTranslateVoiceText);
ADD_PATH("/api/openUrlByWeChat", OpenUrlByWeChat); ADD_PATH("/api/openUrlByWeChat", OpenUrlByWeChat);
ADD_PATH("/api/confirmReceipt", ConfirmReceipt); ADD_PATH("/api/confirmReceipt", ConfirmReceipt);
ADD_PATH("/api/refuseReceipt",RefundReceipt);
ADD_PATH("/api/downloadAttach", DownloadAttach); ADD_PATH("/api/downloadAttach", DownloadAttach);
ADD_PATH("/api/verifyApply", VerifyApply);
PATHS_END PATHS_END
public: public:
@ -100,10 +101,18 @@ class MiscController : public http::HttpController<MiscController> {
/// @param params json /// @param params json
/// @return json /// @return json
static std::string ConfirmReceipt(std::string params); static std::string ConfirmReceipt(std::string params);
/// @brief 拒绝收款
/// @param params json
/// @return json
static std::string RefundReceipt(std::string params);
/// @brief 下载附件 /// @brief 下载附件
/// @param params json /// @param params json
/// @return json /// @return json
static std::string DownloadAttach(std::string params); static std::string DownloadAttach(std::string params);
/// @brief 通过好友
/// @param params json
/// @return json
static std::string VerifyApply(std::string params);
}; };
} // namespace wxhelper } // namespace wxhelper

View File

@ -159,6 +159,19 @@ std::string MiscController::ConfirmReceipt(std::string params) {
nlohmann::json ret = {{"code", success}, {"data", {}}, {"msg", "success"}}; nlohmann::json ret = {{"code", success}, {"data", {}}, {"msg", "success"}};
return ret.dump(); return ret.dump();
} }
std::string MiscController::RefundReceipt(std::string params)
{
SPDLOG_INFO("RefuseReceipt params:{}", params);
nlohmann::json jp = nlohmann::json::parse(params);
std::wstring wxid = jsonutils::GetWStringParam(jp, "wxid");
std::wstring transcationid = jsonutils::GetWStringParam(jp, "transcationId");
std::wstring transferid = jsonutils::GetWStringParam(jp, "transferId");
int64_t success = wechat::WeChatService::GetInstance().DoRefuseReceipt(
wxid, transcationid, transferid);
nlohmann::json ret = { {"code", success}, {"data", {}}, {"msg", "success"} };
return ret.dump();
}
std::string MiscController::DownloadAttach(std::string params) { std::string MiscController::DownloadAttach(std::string params) {
SPDLOG_INFO("DownloadAttach params:{}", params); SPDLOG_INFO("DownloadAttach params:{}", params);
nlohmann::json jp = nlohmann::json::parse(params); nlohmann::json jp = nlohmann::json::parse(params);
@ -169,4 +182,16 @@ std::string MiscController::DownloadAttach(std::string params) {
{"code", 1}, {"data", {"result", result_str}}, {"msg", "success"} }; {"code", 1}, {"data", {"result", result_str}}, {"msg", "success"} };
return ret.dump(); return ret.dump();
} }
std::string MiscController::VerifyApply(std::string params)
{
SPDLOG_INFO("verifyApply params:{}", params);
nlohmann::json jp = nlohmann::json::parse(params);
int32_t permission = jsonutils::GetIntParam(jp, "permission");
std::wstring v3 = jsonutils::GetWStringParam(jp, "v3");
std::wstring v4 = jsonutils::GetWStringParam(jp, "v4");
int64_t success = wechat::WeChatService::GetInstance().VerifyApply(v3, v4, permission);
nlohmann::json ret = { {"code", success}, {"data", {}}, {"msg", "success"} };
return ret.dump();
}
} // namespace wxhelper } // namespace wxhelper

View File

@ -939,7 +939,7 @@ std::wstring wechat::WeChatService::DoDownloadTask(uint64_t msg_id) {
} }
size_t pos = save_path.find_last_of(L'\\'); size_t pos = save_path.find_last_of(L'\\');
if (pos != std::wstring::npos) { if (pos != std::wstring::npos) {
save_path = save_path.substr(0, pos + 1); // 保留最后一个反斜杠 save_path = save_path.substr(0, pos + 1);
} }
break; break;
} }