go v3.7.0.30.25

This commit is contained in:
danbai 2023-05-06 10:58:30 +08:00
parent c094b77d55
commit 21e9201dcb
4 changed files with 469 additions and 400 deletions

View File

@ -1,9 +0,0 @@
# Generate all fields as pointers.
* mangle_names:M_STRIP_PACKAGE
* fallback_type:FT_POINTER
MsgTypes* fallback_type:FT_CALLBACK
RpcContact* fallback_type:FT_CALLBACK
DbNames* fallback_type:FT_CALLBACK
DbTable* fallback_type:FT_CALLBACK
DbField* fallback_type:FT_CALLBACK
DbRow* fallback_type:FT_CALLBACK

View File

@ -5,112 +5,112 @@ option go_package = "./wcf";
option java_package = "com.iamteer";
enum Functions {
FUNC_RESERVED = 0x00;
FUNC_IS_LOGIN = 0x01;
FUNC_GET_SELF_WXID = 0x10;
FUNC_GET_MSG_TYPES = 0x11;
FUNC_GET_CONTACTS = 0x12;
FUNC_GET_DB_NAMES = 0x13;
FUNC_GET_DB_TABLES = 0x14;
FUNC_GET_USER_INFO = 0x15;
FUNC_SEND_TXT = 0x20;
FUNC_SEND_IMG = 0x21;
FUNC_SEND_FILE = 0x22;
FUNC_SEND_XML = 0x23;
FUNC_SEND_EMOTION = 0x24;
FUNC_ENABLE_RECV_TXT = 0x30;
FUNC_DISABLE_RECV_TXT = 0x40;
FUNC_EXEC_DB_QUERY = 0x50;
FUNC_ACCEPT_FRIEND = 0x51;
FUNC_ADD_ROOM_MEMBERS = 0x52;
FUNC_RECV_TRANSFER = 0x53;
FUNC_DECRYPT_IMAGE = 0x60;
FUNC_RESERVED = 0x00;
FUNC_IS_LOGIN = 0x01;
FUNC_GET_SELF_WXID = 0x10;
FUNC_GET_MSG_TYPES = 0x11;
FUNC_GET_CONTACTS = 0x12;
FUNC_GET_DB_NAMES = 0x13;
FUNC_GET_DB_TABLES = 0x14;
FUNC_GET_USER_INFO = 0x15;
FUNC_SEND_TXT = 0x20;
FUNC_SEND_IMG = 0x21;
FUNC_SEND_FILE = 0x22;
FUNC_SEND_XML = 0x23;
FUNC_SEND_EMOTION = 0x24;
FUNC_ENABLE_RECV_TXT = 0x30;
FUNC_DISABLE_RECV_TXT = 0x40;
FUNC_EXEC_DB_QUERY = 0x50;
FUNC_ACCEPT_FRIEND = 0x51;
FUNC_ADD_ROOM_MEMBERS = 0x52;
FUNC_RECV_TRANSFER = 0x53;
FUNC_DECRYPT_IMAGE = 0x60;
}
message Request
{
Functions func = 1;
oneof msg
{
Empty empty = 2;
string str = 3;
TextMsg txt = 4;
PathMsg file = 5;
DbQuery query = 6;
Verification v = 7;
AddMembers m = 8;
XmlMsg xml = 9;
DecPath dec = 10;
Transfer tf = 11;
}
Functions func = 1;
oneof msg
{
Empty empty = 2;
string str = 3;
TextMsg txt = 4;
PathMsg file = 5;
DbQuery query = 6;
Verification v = 7;
AddMembers m = 8;
XmlMsg xml = 9;
DecPath dec = 10;
Transfer tf = 11;
}
}
message Response
{
Functions func = 1;
oneof msg
{
int32 status = 2; // Int
string str = 3; //
WxMsg wxmsg = 4; //
MsgTypes types = 5; //
RpcContacts contacts = 6; //
DbNames dbs = 7; //
DbTables tables = 8; //
DbRows rows = 9; //
UserInfo ui = 10; //
};
Functions func = 1;
oneof msg
{
int32 status = 2; // Int
string str = 3; //
WxMsg wxmsg = 4; //
MsgTypes types = 5; //
RpcContacts contacts = 6; //
DbNames dbs = 7; //
DbTables tables = 8; //
DbRows rows = 9; //
UserInfo ui = 10; //
};
}
message Empty { }
message WxMsg
{
bool is_self = 1; //
bool is_group = 2; //
int32 type = 3; //
string id = 4; // id
string xml = 5; // xml
string sender = 6; //
string roomid = 7; // id
string content = 8; //
string thumb = 9; //
string extra = 10; //
bool is_self = 1; //
bool is_group = 2; //
int32 type = 3; //
string id = 4; // id
string xml = 5; // xml
string sender = 6; //
string roomid = 7; // id
string content = 8; //
string thumb = 9; //
string extra = 10; //
}
message TextMsg
{
string msg = 1; //
string receiver = 2; // @
string aters = 3; // @
string msg = 1; //
string receiver = 2; // @
string aters = 3; // @
}
message PathMsg
{
string path = 1; //
string receiver = 2; //
string path = 1; //
string receiver = 2; //
}
message XmlMsg
{
string receiver = 1; //
string content = 2; // xml
string path = 3; //
int32 type = 4; //
string receiver = 1; //
string content = 2; // xml
string path = 3; //
int32 type = 4; //
}
message MsgTypes { map<int32, string> types = 1; }
message RpcContact
{
string wxid = 1; // id
string code = 2; //
string remark = 3; //
string name = 4; //
string country = 5; //
string province = 6; // /
string city = 7; //
int32 gender = 8; //
string wxid = 1; // id
string code = 2; //
string remark = 3; //
string name = 4; //
string country = 5; //
string province = 6; // /
string city = 7; //
int32 gender = 8; //
}
message RpcContacts { repeated RpcContact contacts = 1; }
@ -118,54 +118,55 @@ message DbNames { repeated string names = 1; }
message DbTable
{
string name = 1; //
string sql = 2; // SQL
string name = 1; //
string sql = 2; // SQL
}
message DbTables { repeated DbTable tables = 1; }
message DbQuery
{
string db = 1; //
string sql = 2; // SQL
string db = 1; //
string sql = 2; // SQL
}
message DbField
{
int32 type = 1; //
string column = 2; //
bytes content = 3; //
int32 type = 1; //
string column = 2; //
bytes content = 3; //
}
message DbRow { repeated DbField fields = 1; }
message DbRows { repeated DbRow rows = 1; }
message Verification
{
string v3 = 1;
string v4 = 2;
string v3 = 1; //
string v4 = 2; // Ticket
int32 scene = 3; // 17 30
}
message AddMembers
{
string roomid = 1; // ID
string wxids = 2; //
string roomid = 1; // ID
string wxids = 2; //
}
message UserInfo
{
string wxid = 1; // ID
string name = 2; //
string mobile = 3; //
string home = 4; // /
string wxid = 1; // ID
string name = 2; //
string mobile = 3; //
string home = 4; // /
}
message DecPath
{
string src = 1; //
string dst = 2; //
string src = 1; //
string dst = 2; //
}
message Transfer
{
string wxid = 1; //
string tid = 2; // id transferid
string wxid = 1; //
string tid = 2; // id transferid
}

View File

@ -132,8 +132,23 @@ func (c *Client) ExecDBQuery(db, sql string) []*DbRow {
}
return recv.GetRows().GetRows()
}
func (c *Client) AcceptFriend() int32 {
err := c.send(genFunReq(Functions_FUNC_ACCEPT_FRIEND).build())
/*AcceptFriend 接收好友请求
* 接收好友请求
*
* @param v3 xml.attrib["encryptusername"]
* @param v4 xml.attrib["ticket"]
*/
func (c *Client) AcceptFriend(v3, v4 string) int32 {
req := genFunReq(Functions_FUNC_ACCEPT_FRIEND)
q := Request_V{
V: &Verification{
V3: v3,
V4: v4,
}}
req.Msg = &q
err := c.send(req.build())
if err != nil {
logs.Err(err)
}
@ -143,6 +158,59 @@ func (c *Client) AcceptFriend() int32 {
}
return recv.GetStatus()
}
func (c *Client) AddChatroomMembers(roomID, wxIDs string) int32 {
req := genFunReq(Functions_FUNC_ADD_ROOM_MEMBERS)
q := Request_M{
M: &AddMembers{Roomid: roomID, Wxids: wxIDs},
}
req.Msg = &q
err := c.send(req.build())
if err != nil {
logs.Err(err)
}
recv, err := c.Recv()
if err != nil {
logs.Err(err)
}
return recv.GetStatus()
}
// ReceiveTransfer 接收转账
func (c *Client) ReceiveTransfer(transferId, wxID string) int32 {
req := genFunReq(Functions_FUNC_RECV_TRANSFER)
q := Request_Tf{
Tf: &Transfer{Tid: transferId, Wxid: wxID},
}
req.Msg = &q
err := c.send(req.build())
if err != nil {
logs.Err(err)
}
recv, err := c.Recv()
if err != nil {
logs.Err(err)
}
return recv.GetStatus()
}
// DecryptImage 解密图片 加密路径,解密路径
func (c *Client) DecryptImage(src, dst string) int32 {
req := genFunReq(Functions_FUNC_DECRYPT_IMAGE)
q := Request_Dec{
Dec: &DecPath{Src: src, Dst: dst},
}
req.Msg = &q
err := c.send(req.build())
if err != nil {
logs.Err(err)
}
recv, err := c.Recv()
if err != nil {
logs.Err(err)
}
return recv.GetStatus()
}
func (c *Client) AddChatRoomMembers(roomId string, wxIds []string) int32 {
req := genFunReq(Functions_FUNC_ADD_ROOM_MEMBERS)
q := Request_M{
@ -292,8 +360,8 @@ func (c *Client) OnMSG(f func(msg *WxMsg)) error {
if err != nil {
return err
}
socket.SetOption(mangos.OptionRecvDeadline, 2000)
socket.SetOption(mangos.OptionSendDeadline, 2000)
_ = socket.SetOption(mangos.OptionRecvDeadline, 2000)
_ = socket.SetOption(mangos.OptionSendDeadline, 2000)
err = socket.Dial(addPort(c.add))
if err != nil {
@ -305,7 +373,6 @@ func (c *Client) OnMSG(f func(msg *WxMsg)) error {
if err != nil {
return err
}
logs.Info(len(recv))
_ = proto.Unmarshal(recv, msg)
go f(msg.GetWxmsg())
}

File diff suppressed because it is too large Load Diff