MCPcopy Index your code
hub / github.com/NICEXAI/WeWorkFinanceSDK

github.com/NICEXAI/WeWorkFinanceSDK @v1.3.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.3.0 ↗ · + Follow
97 symbols 124 edges 11 files 49 documented · 51%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

WeWorkFinanceSDK

企业微信会话存档SDK(基于企业微信C版官方SDK封装),暂时只支持在linux环境下使用当前SDK。

官方文档地址

https://open.work.weixin.qq.com/api/doc/90000/90135/91774

使用方式

1、安装 go module

go get -u github.com/NICEXAI/WeWorkFinanceSDK

2、从 github.com/NICEXAI/WeWorkFinanceSDK/lib 文件夹下复制 libWeWorkFinanceSdk_C.so 动态库文件到系统动态链接库默认文件夹下,或者复制到任意文件夹并在当前文件夹下执行 export LD_LIBRARY_PATH=$(pwd)命令设置动态链接库检索地址

3、把 module 引入到项目中即可使用

Example

package main

import (
    "bytes"
    "fmt"
    "github.com/NICEXAI/WeWorkFinanceSDK"
    "io/ioutil"
    "os"
    "path"
)

func main() {
    corpID := "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
    corpSecret := "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
    rsaPrivateKey := `
-----BEGIN RSA PRIVATE KEY-----
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-----END RSA PRIVATE KEY-----
`

    //初始化客户端
    client, err := WeWorkFinanceSDK.NewClient(corpID, corpSecret, rsaPrivateKey)
    if err != nil {
        fmt.Printf("SDK 初始化失败:%v \n", err)
        return
    }

    //同步消息
    chatDataList, err := client.GetChatData(0, 100, "", "", 3)
    if err != nil {
        fmt.Printf("消息同步失败:%v \n", err)
        return
    }

    for _, chatData := range chatDataList {
        //消息解密
        chatInfo, err := client.DecryptData(chatData.EncryptRandomKey, chatData.EncryptChatMsg)
        if err != nil {
            fmt.Printf("消息解密失败:%v \n", err)
            return
        }

        if chatInfo.Type == "image" {
            image := chatInfo.GetImageMessage()
            sdkfileid := image.Image.SdkFileID

            isFinish := false
            buffer := bytes.Buffer{}
            index_buf := ""
            for !isFinish {
                //获取媒体数据
                mediaData, err := client.GetMediaData(index_buf, sdkfileid, "", "", 5)
                if err != nil {
                    fmt.Printf("媒体数据拉取失败:%v \n", err)
                    return
                }
                buffer.Write(mediaData.Data)
                if mediaData.IsFinish {
                    isFinish = mediaData.IsFinish
                }
                index_buf = mediaData.OutIndexBuf
            }
            filePath, _ := os.Getwd()
            filePath = path.Join(filePath, "test.png")
            err := ioutil.WriteFile(filePath, buffer.Bytes(), 0666)
            if err != nil {
                fmt.Printf("文件存储失败:%v \n", err)
                return
            }
            break
        }
    }
}

Extension points exported contracts — how you extend this code

Client (Interface)
(no doc) [1 implementers]
client.go

Core symbols most depended-on inside this repo

NewSDKErr
called by 6
error.go
Error
called by 3
error.go
GetContentFromSlice
called by 2
client_linux.go
GetChatData
called by 2
client.go
DecryptData
called by 2
client.go
GetMediaData
called by 2
client.go
RSADecrypt
called by 1
rsa.go
RSADecryptBase64
called by 1
rsa.go

Shape

Struct 44
Method 42
Function 7
Class 3
Interface 1

Languages

Go96%
C++4%

Modules by API surface

message.go38 symbols
chat.go35 symbols
client_linux.go7 symbols
client.go5 symbols
lib/WeWorkFinanceSdk_C.h3 symbols
error.go3 symbols
rsa.go2 symbols
media.go1 symbols
lib/tool_testSdk.cpp1 symbols
example/example.go1 symbols
client_unsupport.go1 symbols

For agents

$ claude mcp add WeWorkFinanceSDK \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact