mirror of
https://github.com/ttttupup/wxhelper.git
synced 2024-11-05 18:09:24 +08:00
feat:空接口
This commit is contained in:
parent
493d8aa0c8
commit
f2183bb735
56
app/wxhelper/src/chat_room_controller.cc
Normal file
56
app/wxhelper/src/chat_room_controller.cc
Normal file
@ -0,0 +1,56 @@
|
||||
#include "chat_room_controller.h"
|
||||
|
||||
#include "nlohmann/json.hpp"
|
||||
namespace wxhelper {
|
||||
std::string ChatController::GetChatRoomDetailInfo(std::string params) {
|
||||
nlohmann::json ret = {
|
||||
{"code", 200}, {"data", {}}, {"msg", "Not Implemented"}};
|
||||
return ret.dump();
|
||||
}
|
||||
std::string ChatController::GetMemberFromChatRoom(std::string params) {
|
||||
nlohmann::json ret = {
|
||||
{"code", 200}, {"data", {}}, {"msg", "Not Implemented"}};
|
||||
return ret.dump();
|
||||
}
|
||||
std::string ChatController::AddMemberToChatRoom(std::string params) {
|
||||
nlohmann::json ret = {
|
||||
{"code", 200}, {"data", {}}, {"msg", "Not Implemented"}};
|
||||
return ret.dump();
|
||||
}
|
||||
std::string ChatController::DelMemberFromChatRoom(std::string params) {
|
||||
nlohmann::json ret = {
|
||||
{"code", 200}, {"data", {}}, {"msg", "Not Implemented"}};
|
||||
return ret.dump();
|
||||
}
|
||||
std::string ChatController::CreateChatRoom(std::string params) {
|
||||
nlohmann::json ret = {
|
||||
{"code", 200}, {"data", {}}, {"msg", "Not Implemented"}};
|
||||
return ret.dump();
|
||||
}
|
||||
std::string ChatController::QuitChatRoom(std::string params) {
|
||||
nlohmann::json ret = {
|
||||
{"code", 200}, {"data", {}}, {"msg", "Not Implemented"}};
|
||||
return ret.dump();
|
||||
}
|
||||
std::string ChatController::InviteMemberToChatRoom(std::string params) {
|
||||
nlohmann::json ret = {
|
||||
{"code", 200}, {"data", {}}, {"msg", "Not Implemented"}};
|
||||
return ret.dump();
|
||||
}
|
||||
std::string ChatController::TopMsg(std::string params) { return std::string(); }
|
||||
std::string ChatController::RemoveTopMsg(std::string params) {
|
||||
nlohmann::json ret = {
|
||||
{"code", 200}, {"data", {}}, {"msg", "Not Implemented"}};
|
||||
return ret.dump();
|
||||
}
|
||||
std::string ChatController::GetChatRoomMemberNickname(std::string params) {
|
||||
nlohmann::json ret = {
|
||||
{"code", 200}, {"data", {}}, {"msg", "Not Implemented"}};
|
||||
return ret.dump();
|
||||
}
|
||||
std::string ChatController::ModifyChatRoomMemberNickName(std::string params) {
|
||||
nlohmann::json ret = {
|
||||
{"code", 200}, {"data", {}}, {"msg", "Not Implemented"}};
|
||||
return ret.dump();
|
||||
}
|
||||
} // namespace wxhelper
|
78
app/wxhelper/src/chat_room_controller.h
Normal file
78
app/wxhelper/src/chat_room_controller.h
Normal file
@ -0,0 +1,78 @@
|
||||
#ifndef WXHELPER_CHAT_ROOM_CONTROLLER_H_
|
||||
#define WXHELPER_CHAT_ROOM_CONTROLLER_H_
|
||||
|
||||
#include "http_controller.h"
|
||||
|
||||
namespace wxhelper {
|
||||
class ChatController : public http::HttpController<ChatController> {
|
||||
public:
|
||||
PATHS_BEGIN
|
||||
ADD_PATH("/api/getChatRoomDetailInfo", GetChatRoomDetailInfo);
|
||||
ADD_PATH("/api/getMemberFromChatRoom", GetMemberFromChatRoom);
|
||||
|
||||
ADD_PATH("/api/addMemberToChatRoom", AddMemberToChatRoom);
|
||||
ADD_PATH("/api/delMemberFromChatRoom", DelMemberFromChatRoom);
|
||||
|
||||
ADD_PATH("/api/createChatRoom", CreateChatRoom);
|
||||
ADD_PATH("/api/quitChatRoom", QuitChatRoom);
|
||||
ADD_PATH("/api/inviteMemberToChatRoom", InviteMemberToChatRoom);
|
||||
|
||||
ADD_PATH("/api/topMsg", TopMsg);
|
||||
ADD_PATH("/api/removeTopMsg", RemoveTopMsg);
|
||||
|
||||
ADD_PATH("/api/getChatRoomMemberNickname", GetChatRoomMemberNickname);
|
||||
ADD_PATH("/api/modifyChatRoomMemberNickName", ModifyChatRoomMemberNickName);
|
||||
PATHS_END
|
||||
|
||||
public:
|
||||
/// @brief 获取群聊详情
|
||||
/// @param params json
|
||||
/// @return json
|
||||
static std::string GetChatRoomDetailInfo(std::string params);
|
||||
/// @brief 获取群成员
|
||||
/// @param params json
|
||||
/// @return json
|
||||
static std::string GetMemberFromChatRoom(std::string params);
|
||||
|
||||
/// @brief 添加群成员
|
||||
/// @param params json
|
||||
/// @return json
|
||||
static std::string AddMemberToChatRoom(std::string params);
|
||||
/// @brief 删除群成员
|
||||
/// @param params json
|
||||
/// @return json
|
||||
static std::string DelMemberFromChatRoom(std::string params);
|
||||
/// @brief 创建群聊
|
||||
/// @param params json
|
||||
/// @return json
|
||||
static std::string CreateChatRoom(std::string params);
|
||||
/// @brief 退出群聊
|
||||
/// @param params json
|
||||
/// @return json
|
||||
static std::string QuitChatRoom(std::string params);
|
||||
/// @brief 邀请成员入群
|
||||
/// @param params json
|
||||
/// @return json
|
||||
static std::string InviteMemberToChatRoom(std::string params);
|
||||
|
||||
/// @brief 群聊消息置顶
|
||||
/// @param params json
|
||||
/// @return json
|
||||
static std::string TopMsg(std::string params);
|
||||
/// @brief 取消群聊消息置顶
|
||||
/// @param params json
|
||||
/// @return json
|
||||
static std::string RemoveTopMsg(std::string params);
|
||||
|
||||
/// @brief 获取群聊成员昵称
|
||||
/// @param params json
|
||||
/// @return json
|
||||
static std::string GetChatRoomMemberNickname(std::string params);
|
||||
/// @brief 修改群聊成员昵称
|
||||
/// @param params json
|
||||
/// @return json
|
||||
static std::string ModifyChatRoomMemberNickName(std::string params);
|
||||
};
|
||||
} // namespace wxhelper
|
||||
|
||||
#endif
|
40
app/wxhelper/src/contacts_controller.cc
Normal file
40
app/wxhelper/src/contacts_controller.cc
Normal file
@ -0,0 +1,40 @@
|
||||
#include "contacts_controller.h"
|
||||
|
||||
#include "nlohmann/json.hpp"
|
||||
|
||||
std::string wxhelper::ContactsController::GetContactList(std::string params) {
|
||||
nlohmann::json ret = {
|
||||
{"code", 200}, {"data", {}}, {"msg", "Not Implemented"}};
|
||||
return ret.dump();
|
||||
}
|
||||
|
||||
std::string wxhelper::ContactsController::GetContactProfile(
|
||||
std::string params) {
|
||||
nlohmann::json ret = {
|
||||
{"code", 200}, {"data", {}}, {"msg", "Not Implemented"}};
|
||||
return ret.dump();
|
||||
}
|
||||
|
||||
std::string wxhelper::ContactsController::DelContact(std::string params) {
|
||||
nlohmann::json ret = {
|
||||
{"code", 200}, {"data", {}}, {"msg", "Not Implemented"}};
|
||||
return ret.dump();
|
||||
}
|
||||
|
||||
std::string wxhelper::ContactsController::SearchContact(std::string params) {
|
||||
nlohmann::json ret = {
|
||||
{"code", 200}, {"data", {}}, {"msg", "Not Implemented"}};
|
||||
return ret.dump();
|
||||
}
|
||||
|
||||
std::string wxhelper::ContactsController::AddContact(std::string params) {
|
||||
nlohmann::json ret = {
|
||||
{"code", 200}, {"data", {}}, {"msg", "Not Implemented"}};
|
||||
return ret.dump();
|
||||
}
|
||||
|
||||
std::string wxhelper::ContactsController::VerifyApply(std::string params) {
|
||||
nlohmann::json ret = {
|
||||
{"code", 200}, {"data", {}}, {"msg", "Not Implemented"}};
|
||||
return ret.dump();
|
||||
}
|
46
app/wxhelper/src/contacts_controller.h
Normal file
46
app/wxhelper/src/contacts_controller.h
Normal file
@ -0,0 +1,46 @@
|
||||
#ifndef WXHELPER_CONTACTS_CONTROLLER_H_
|
||||
#define WXHELPER_CONTACTS_CONTROLLER_H_
|
||||
|
||||
#include "http_controller.h"
|
||||
|
||||
namespace wxhelper {
|
||||
class ContactsController : public http::HttpController<ContactsController> {
|
||||
public:
|
||||
PATHS_BEGIN
|
||||
ADD_PATH("/api/getContactList", GetContactList);
|
||||
ADD_PATH("/api/getContactProfile", GetContactProfile);
|
||||
ADD_PATH("/api/delContact", DelContact);
|
||||
ADD_PATH("/api/searchContact", SearchContact);
|
||||
ADD_PATH("/api/addContact", AddContact);
|
||||
ADD_PATH("/api/verifyApply", VerifyApply);
|
||||
PATHS_END
|
||||
|
||||
public:
|
||||
/// @brief 好友通讯录
|
||||
/// @param params json
|
||||
/// @return json
|
||||
static std::string GetContactList(std::string params);
|
||||
/// @brief 联系人信息
|
||||
/// @param params json
|
||||
/// @return json
|
||||
static std::string GetContactProfile(std::string params);
|
||||
/// @brief 删除好友
|
||||
/// @param params json
|
||||
/// @return json
|
||||
static std::string DelContact(std::string params);
|
||||
/// @brief 搜索联系人
|
||||
/// @param params json
|
||||
/// @return json
|
||||
static std::string SearchContact(std::string params);
|
||||
/// @brief 加好友
|
||||
/// @param params json
|
||||
/// @return json
|
||||
static std::string AddContact(std::string params);
|
||||
/// @brief 通过好友验证
|
||||
/// @param params json
|
||||
/// @return json
|
||||
static std::string VerifyApply(std::string params);
|
||||
};
|
||||
} // namespace wxhelper
|
||||
|
||||
#endif
|
56
app/wxhelper/src/db_controller.cc
Normal file
56
app/wxhelper/src/db_controller.cc
Normal file
@ -0,0 +1,56 @@
|
||||
#include "db_controller.h"
|
||||
|
||||
#include "nlohmann/json.hpp"
|
||||
#include "utils.h"
|
||||
#include "wechat_db.h"
|
||||
#include "json_utils.h"
|
||||
|
||||
namespace wxhelper {
|
||||
|
||||
std::string DbController::GetDBInfo(std::string params) {
|
||||
std::vector<void*> v = wechat::WeChatDb::GetInstance().GetWeChatDbHandles();
|
||||
nlohmann::json ret_data = {{"data", nlohmann::json::array()}};
|
||||
for (unsigned int i = 0; i < v.size(); ++i) {
|
||||
nlohmann::json db_info;
|
||||
db_info["tables"] = nlohmann::json::array();
|
||||
wechat::DatabaseInfo* db = reinterpret_cast<wechat::DatabaseInfo*>(v[i]);
|
||||
db_info["handle"] = db->handle;
|
||||
std::wstring dbname(db->db_name);
|
||||
db_info["databaseName"] = base::utils::WstringToUtf8(dbname);
|
||||
for (auto table : db->tables) {
|
||||
nlohmann::json table_info = {{"name", table.name},
|
||||
{"tableName", table.table_name},
|
||||
{"sql", table.sql},
|
||||
{"rootpage", table.rootpage}};
|
||||
db_info["tables"].push_back(table_info);
|
||||
}
|
||||
ret_data["data"].push_back(db_info);
|
||||
}
|
||||
ret_data["code"] = 1;
|
||||
ret_data["msg"] = "success";
|
||||
return ret_data.dump();
|
||||
}
|
||||
|
||||
std::string DbController::ExecSql(std::string params) {
|
||||
nlohmann::json jp = nlohmann::json::parse(params);
|
||||
int64_t db_handle = jsonutils::GetInt64Param(jp, "dbHandle");
|
||||
std::string sql = jsonutils::GetStringParam(jp, "sql");
|
||||
std::vector<std::vector<std::string>> items;
|
||||
int success = wechat::WeChatDb::GetInstance().Select(db_handle, sql.c_str(), items);
|
||||
nlohmann::json ret_data = {
|
||||
{"data", nlohmann::json::array()}, {"code", success}, {"msg", "success"}};
|
||||
if (success == 0) {
|
||||
ret_data["msg"] = "no data";
|
||||
return ret_data.dump();
|
||||
}
|
||||
for (auto it : items) {
|
||||
nlohmann::json temp_arr = nlohmann::json::array();
|
||||
for (size_t i = 0; i < it.size(); i++) {
|
||||
temp_arr.push_back(it[i]);
|
||||
}
|
||||
ret_data["data"].push_back(temp_arr);
|
||||
}
|
||||
return ret_data.dump();
|
||||
}
|
||||
|
||||
} // namespace wxhelper
|
20
app/wxhelper/src/db_controller.h
Normal file
20
app/wxhelper/src/db_controller.h
Normal file
@ -0,0 +1,20 @@
|
||||
#ifndef WXHELPER_DB_CONTROLLER_H_
|
||||
#define WXHELPER_DB_CONTROLLER_H_
|
||||
|
||||
#include "http_controller.h"
|
||||
|
||||
namespace wxhelper {
|
||||
class DbController : public http::HttpController<DbController> {
|
||||
public:
|
||||
PATHS_BEGIN
|
||||
ADD_PATH("/api/getDBInfo", GetDBInfo);
|
||||
ADD_PATH("/api/execSql", ExecSql);
|
||||
PATHS_END
|
||||
|
||||
public:
|
||||
static std::string GetDBInfo(std::string params);
|
||||
static std::string ExecSql(std::string params);
|
||||
};
|
||||
} // namespace wxhelper
|
||||
|
||||
#endif
|
95
app/wxhelper/src/misc_controller.cc
Normal file
95
app/wxhelper/src/misc_controller.cc
Normal file
@ -0,0 +1,95 @@
|
||||
#include "misc_controller.h"
|
||||
|
||||
#include "nlohmann/json.hpp"
|
||||
namespace wxhelper {
|
||||
std::string MiscController::CheckLogin(std::string params) {
|
||||
nlohmann::json ret = {
|
||||
{"code", 200}, {"data", {}}, {"msg", "Not Implemented"}};
|
||||
return ret.dump();
|
||||
}
|
||||
std::string MiscController::GetUserInfo(std::string params) {
|
||||
nlohmann::json ret = {
|
||||
{"code", 200}, {"data", {}}, {"msg", "Not Implemented"}};
|
||||
return ret.dump();
|
||||
}
|
||||
std::string MiscController::GetSNSFirstPage(std::string params) {
|
||||
nlohmann::json ret = {
|
||||
{"code", 200}, {"data", {}}, {"msg", "Not Implemented"}};
|
||||
return ret.dump();
|
||||
}
|
||||
std::string MiscController::GetSNSNextPage(std::string params) {
|
||||
nlohmann::json ret = {
|
||||
{"code", 200}, {"data", {}}, {"msg", "Not Implemented"}};
|
||||
return ret.dump();
|
||||
}
|
||||
std::string MiscController::AddFavFromMsg(std::string params) {
|
||||
nlohmann::json ret = {
|
||||
{"code", 200}, {"data", {}}, {"msg", "Not Implemented"}};
|
||||
return ret.dump();
|
||||
}
|
||||
std::string MiscController::AddFavFromImage(std::string params) {
|
||||
nlohmann::json ret = {
|
||||
{"code", 200}, {"data", {}}, {"msg", "Not Implemented"}};
|
||||
return ret.dump();
|
||||
}
|
||||
std::string MiscController::DecodeImage(std::string params) {
|
||||
nlohmann::json ret = {
|
||||
{"code", 200}, {"data", {}}, {"msg", "Not Implemented"}};
|
||||
return ret.dump();
|
||||
}
|
||||
std::string MiscController::GetVoiceByMsgId(std::string params) {
|
||||
nlohmann::json ret = {
|
||||
{"code", 200}, {"data", {}}, {"msg", "Not Implemented"}};
|
||||
return ret.dump();
|
||||
}
|
||||
std::string MiscController::DoOcrTask(std::string params) {
|
||||
nlohmann::json ret = {
|
||||
{"code", 200}, {"data", {}}, {"msg", "Not Implemented"}};
|
||||
return ret.dump();
|
||||
}
|
||||
std::string MiscController::LockWeChat(std::string params) {
|
||||
nlohmann::json ret = {
|
||||
{"code", 200}, {"data", {}}, {"msg", "Not Implemented"}};
|
||||
return ret.dump();
|
||||
}
|
||||
std::string MiscController::UnlockWeChat(std::string params) {
|
||||
nlohmann::json ret = {
|
||||
{"code", 200}, {"data", {}}, {"msg", "Not Implemented"}};
|
||||
return ret.dump();
|
||||
}
|
||||
std::string MiscController::ClickEnterWeChat(std::string params) {
|
||||
nlohmann::json ret = {
|
||||
{"code", 200}, {"data", {}}, {"msg", "Not Implemented"}};
|
||||
return ret.dump();
|
||||
}
|
||||
std::string MiscController::GetLoginUrl(std::string params) {
|
||||
nlohmann::json ret = {
|
||||
{"code", 200}, {"data", {}}, {"msg", "Not Implemented"}};
|
||||
return ret.dump();
|
||||
}
|
||||
std::string MiscController::TranslateVoice(std::string params) {
|
||||
nlohmann::json ret = {
|
||||
{"code", 200}, {"data", {}}, {"msg", "Not Implemented"}};
|
||||
return ret.dump();
|
||||
}
|
||||
std::string MiscController::GetTranslateVoiceText(std::string params) {
|
||||
nlohmann::json ret = {
|
||||
{"code", 200}, {"data", {}}, {"msg", "Not Implemented"}};
|
||||
return ret.dump();
|
||||
}
|
||||
std::string MiscController::OpenUrlByWeChat(std::string params) {
|
||||
nlohmann::json ret = {
|
||||
{"code", 200}, {"data", {}}, {"msg", "Not Implemented"}};
|
||||
return ret.dump();
|
||||
}
|
||||
std::string MiscController::ConfirmReceipt(std::string params) {
|
||||
nlohmann::json ret = {
|
||||
{"code", 200}, {"data", {}}, {"msg", "Not Implemented"}};
|
||||
return ret.dump();
|
||||
}
|
||||
std::string MiscController::DownloadAttach(std::string params) {
|
||||
nlohmann::json ret = {
|
||||
{"code", 200}, {"data", {}}, {"msg", "Not Implemented"}};
|
||||
return ret.dump();
|
||||
}
|
||||
} // namespace wxhelper
|
110
app/wxhelper/src/misc_controller.h
Normal file
110
app/wxhelper/src/misc_controller.h
Normal file
@ -0,0 +1,110 @@
|
||||
#ifndef WXHELPER_CHAT_CONTROLLER_H_
|
||||
#define WXHELPER_CHAT_CONTROLLER_H_
|
||||
|
||||
#include "http_controller.h"
|
||||
|
||||
namespace wxhelper {
|
||||
class MiscController : public http::HttpController<MiscController> {
|
||||
public:
|
||||
PATHS_BEGIN
|
||||
ADD_PATH("/api/checkLogin", CheckLogin);
|
||||
ADD_PATH("/api/userInfo", GetUserInfo);
|
||||
ADD_PATH("/api/getSNSFirstPage", GetSNSFirstPage);
|
||||
ADD_PATH("/api/getSNSNextPage", GetSNSNextPage);
|
||||
ADD_PATH("/api/addFavFromMsg", AddFavFromMsg);
|
||||
|
||||
ADD_PATH("/api/addFavFromImage", AddFavFromImage);
|
||||
ADD_PATH("/api/decodeImage", DecodeImage);
|
||||
ADD_PATH("/api/getVoiceByMsgId", GetVoiceByMsgId);
|
||||
ADD_PATH("/api/ocr", DoOcrTask);
|
||||
|
||||
ADD_PATH("/api/lockWeChat", LockWeChat);
|
||||
ADD_PATH("/api/unlockWeChat", UnlockWeChat);
|
||||
ADD_PATH("/api/clickEnterWeChat", ClickEnterWeChat);
|
||||
ADD_PATH("/api/getLoginUrl", GetLoginUrl);
|
||||
|
||||
ADD_PATH("/api/translateVoice", TranslateVoice);
|
||||
ADD_PATH("/api/getTranslateVoiceText", GetTranslateVoiceText);
|
||||
ADD_PATH("/api/openUrlByWeChat", OpenUrlByWeChat);
|
||||
ADD_PATH("/api/confirmReceipt", ConfirmReceipt);
|
||||
ADD_PATH("/api/downloadAttach", DownloadAttach);
|
||||
|
||||
PATHS_END
|
||||
|
||||
public:
|
||||
/// @brief 检查是否登录
|
||||
/// @param params json
|
||||
/// @return json
|
||||
static std::string CheckLogin(std::string params);
|
||||
/// @brief 获取登录用户信息
|
||||
/// @param params json
|
||||
/// @return json
|
||||
static std::string GetUserInfo(std::string params);
|
||||
/// @brief 朋友圈首页
|
||||
/// @param params json
|
||||
/// @return json
|
||||
static std::string GetSNSFirstPage(std::string params);
|
||||
/// @brief 朋友圈下一页
|
||||
/// @param params json
|
||||
/// @return json
|
||||
static std::string GetSNSNextPage(std::string params);
|
||||
/// @brief 收藏消息
|
||||
/// @param params json
|
||||
/// @return json
|
||||
static std::string AddFavFromMsg(std::string params);
|
||||
/// @brief 收藏图片
|
||||
/// @param params json
|
||||
/// @return json
|
||||
static std::string AddFavFromImage(std::string params);
|
||||
/// @brief 解码图片
|
||||
/// @param params json
|
||||
/// @return json
|
||||
static std::string DecodeImage(std::string params);
|
||||
/// @brief 获取语音文件
|
||||
/// @param params json
|
||||
/// @return json
|
||||
static std::string GetVoiceByMsgId(std::string params);
|
||||
/// @brief 图片ocr
|
||||
/// @param params json
|
||||
/// @return json
|
||||
static std::string DoOcrTask(std::string params);
|
||||
/// @brief 锁定微信
|
||||
/// @param params json
|
||||
/// @return json
|
||||
static std::string LockWeChat(std::string params);
|
||||
/// @brief 解锁微信
|
||||
/// @param params json
|
||||
/// @return json
|
||||
static std::string UnlockWeChat(std::string params);
|
||||
/// @brief 进入微信
|
||||
/// @param params json
|
||||
/// @return json
|
||||
static std::string ClickEnterWeChat(std::string params);
|
||||
/// @brief 获取登录url
|
||||
/// @param params json
|
||||
/// @return json
|
||||
static std::string GetLoginUrl(std::string params);
|
||||
/// @brief 语音转文本
|
||||
/// @param params json
|
||||
/// @return json
|
||||
static std::string TranslateVoice(std::string params);
|
||||
/// @brief 获取语音转文本结果
|
||||
/// @param params json
|
||||
/// @return json
|
||||
static std::string GetTranslateVoiceText(std::string params);
|
||||
/// @brief 通过浏览器打开url
|
||||
/// @param params json
|
||||
/// @return json
|
||||
static std::string OpenUrlByWeChat(std::string params);
|
||||
/// @brief 确认收款
|
||||
/// @param params json
|
||||
/// @return json
|
||||
static std::string ConfirmReceipt(std::string params);
|
||||
/// @brief 下载附件
|
||||
/// @param params json
|
||||
/// @return json
|
||||
static std::string DownloadAttach(std::string params);
|
||||
};
|
||||
} // namespace wxhelper
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user