WeChatFerry/SDK/sdk.h

58 lines
1.7 KiB
C
Raw Normal View History

2022-08-06 21:44:26 +08:00
#pragma once
2021-02-12 23:21:57 +08:00
#include <functional>
#include <map>
#include <string>
2022-08-07 23:32:25 +08:00
#include <vector>
2021-02-12 23:21:57 +08:00
using namespace std;
typedef struct WxMessage {
int self; // 是否自己发的消息0=否1=是
int type; // 消息类型
int source; // 消息来源0=好友消息1=群消息
wstring id; // 消息ID
wstring xml; // 群其他消息
wstring wxId; // 发送人微信ID
wstring roomId; // 群ID
wstring content; // 消息内容MAC版最大16384即16KB
} WxMessage_t;
2021-08-28 08:33:24 +08:00
typedef struct WxContact {
2022-08-07 23:32:25 +08:00
wstring wxId; // 微信ID
wstring wxCode; // 微信号
wstring wxName; // 微信昵称
wstring wxCountry; // 国家
wstring wxProvince; // 省/州
wstring wxCity; // 城市
wstring wxGender; // 性别
2021-08-28 08:33:24 +08:00
} WxContact_t;
2022-08-07 23:49:37 +08:00
typedef struct WxDbTable {
wstring table; // 表名
wstring sql; // 建表 SQL
} WxDbTable_t;
2022-08-20 22:10:11 +08:00
typedef struct WxSqlResult {
int type;
wstring column;
string content;
} WxSqlResult_t;
2021-02-12 23:21:57 +08:00
typedef map<int, wstring> MsgTypesMap_t;
2021-08-28 08:33:24 +08:00
typedef map<wstring, WxContact_t> ContactMap_t;
2022-08-07 23:49:37 +08:00
typedef vector<WxDbTable_t> DbTableVector_t;
2022-08-20 22:10:11 +08:00
typedef vector<vector<WxSqlResult_t>> SqlRetVector_t;
2021-02-12 23:21:57 +08:00
2022-08-20 17:39:21 +08:00
int WxInitSDK();
2022-08-13 23:33:37 +08:00
int WxDestroySDK();
2022-08-20 15:15:04 +08:00
int WxEnableRecvMsg(const std::function<int(WxMessage_t)> &onMsg);
int WxDisableRecvMsg();
2022-08-20 17:39:21 +08:00
int WxSendTextMsg(wstring wxid, wstring msg, wstring vAtWxids);
2021-08-22 21:57:16 +08:00
int WxSendImageMsg(wstring wxid, wstring path);
2021-08-28 08:33:24 +08:00
ContactMap_t WxGetContacts();
2021-02-12 23:21:57 +08:00
MsgTypesMap_t WxGetMsgTypes();
2022-08-07 23:32:25 +08:00
vector<wstring> WxGetDbNames();
2022-08-07 23:49:37 +08:00
DbTableVector_t WxGetDbTables(wstring db);
2022-08-20 22:10:11 +08:00
SqlRetVector_t WxExecDbQuery(wstring db, wstring sql);